Samstag, 25. Juni 2011

Hard Disk backup / mirroring with Ubuntu and dd

In this post I will show you how to mirror  your hard disk with Ubuntu and the dd command. I used this method to backup the data from my laptop, which didn't start anymore. I was sure the hard disk was still alive and i wanted to save all my data.

You will need a s-ATA to USB cable like this one
At first you've got to make sure both hard disks are connected to the PC.
In my case /dev/sdc is the source and /dev/sdd is the target hard disk.


Use this command to mirror the whole hard disk, bit per bit.

pv /dev/sdc | dd bs=128k of=/dev/sdd
Where /dev/sdc is the source- and /dev/sdd is the target-hard-disk!

The dd command copies the hard disk bit per bit and the pv command adds a neat progress bar, because by default dd comes with no visual feedback.


For me it took like 3 hours to mirror all the data to my new USB-hard-disk.

Datensicherung / Festplattenbackup mit Ubuntu

Der Laptop, auf dem ich die meisten Artikel hier verfasst habe, hat nach einer Bierdusche das Zeitliche gesegnet. Da die Festplatte aber noch lief und ich die ganzen Daten vor der Reparatur sichern wollte habe ich mich ein bisschen über Datensicherung mit Ubuntu schlau gemacht.

s-ATA-USB-Kabel mit Stromversorgung und IDE-Anschluss
In dem Laptop war eine 320 GB Festplatte verbaut und glücklicherweise habe ich auch eine 320 GB USB-Festplatte von CnMemory. Am einfachsten habe ich mir eine komplette 1:1 Spiegelung der Laptop-Festplatte vorgestellt. Dazu brauchte ich ein s-ATA zu USB Kabel wie z.B. dieses hier.
Ubuntu  hat die s-ATA-Festplatte des Laptops dann sofort als /dev/sdc erkannt. Die USB-Festplatte auf die ich die Daten sichern möchte ist /dev/sdd.

Nach ein wenig googeln und nachlesen in den manpages habe ich mir dann diesen Befehl zusammengesetzt:
pv /dev/sdc | dd bs=128k of=/dev/sdd
Wo /dev/sdc die Quell- und /dev/sdd die Zielfestplatte ist!

dd ist der eigentliche Befehl zum bit-genauen Kopieren der Festplatte ist, durch den Befehl pv wird die Ausgabe von dd mit einem Fortschrittsbalken versehen.


Nach ein paar Stunden war die gesamte Laptop-Festplatte auf meine USB-Festplatte gespiegelt, inklusive der verschiedenen Partitionen und Betriebssysteme!

Mittwoch, 22. Juni 2011

Ubuntu in Big Bang Theory

Saw this episode just a few minutes ago :D

Ubuntu in Big Bang Theory

Lief vor ein paar Minuten auf ProSieben :D

Dienstag, 31. Mai 2011

How to play Minecraft with a Wiimote


How to set up Bluetooth correctly

  1. sudo apt-get install bluez-utils libopenobex1 wmgui wminput
  2. sudo /etc/init.d/bluetooth restart
  3. sudo modprobe uinput
  4. sudo su
    echo "uinput" >> /etc/modules

Edit the file /etc/cwiid/wminput/minecraft eg. with sudo gedit /etc/cwiid/wminput/minecraft and copy and paste the code below. You could also save this file as /etc/cwiid/wminput/minecraft
Now start wminput: sudo wminput -c minecraft -w

Pointing does not work but I'm figuring it out ;)
I think the key assignment is self-explanatory.
#Head Movement
Plugin.acc.X = REL_X
Plugin.acc.Y = REL_Y
#Body Movement
Plugin.nunchuk_stick2btn.Up = KEY_W
Plugin.nunchuk_stick2btn.Down = KEY_S
Plugin.nunchuk_stick2btn.Left = KEY_A
Plugin.nunchuk_stick2btn.Right = KEY_D
#Left Mouse Button, Right Mouse Button and Space
Wiimote.B = BTN_LEFT
Nunchuk.Z = BTN_RIGHT
Wiimote.A = KEY_SPACE
Wiimote.Home = KEY_E
Wiimote.2 = KEY_ESC


[Tutorial] Minecraft mit Wiimote und Nunchuk spielen


Falls Bluetooth noch nicht läuft

Hier habe ich eine Anleitung geschrieben um Bluetooth zum laufen zu bekommen.
  1. sudo apt-get install bluez-utils libopenobex1 wmgui wminput
  2. sudo /etc/init.d/bluetooth restart
  3. sudo modprobe uinput
  4. sudo su
    echo "uinput" >> /etc/modules

Bearbeite die Datei /etc/cwiid/wminput/minecraft z.B. mit sudo gedit /etc/cwiid/wminput/minecraft und füge den Code von unten ein. Du kannst auch diese Datei als /etc/cwiid/wminput/minecraft speichern.
Dann wminput per sudo wminput -c minecraft -w starten.

Die Maus wird dann durch Kippen des Wiimote gesteuern, WASD liegt auf dem Stick den Nunchuk. Die B-Taste ist die Linke Mausstaste, Z (Nunchuk) die Rechte, mit A hüpft man (Leertaste), mit der Home-Taste öffnet man das Inventar (E) und mit Taste 2 drückt man Escape. Ich bin gerade dabei, eine Config zu machen, mit der man Minecraft mit dem Infrarotsensor, also wirklich durch zielen auf den Bildschirm und nicht nur durch kippen
#Head Movement
Plugin.acc.X = REL_X
Plugin.acc.Y = REL_Y
#Body Movement
Plugin.nunchuk_stick2btn.Up = KEY_W
Plugin.nunchuk_stick2btn.Down = KEY_S
Plugin.nunchuk_stick2btn.Left = KEY_A
Plugin.nunchuk_stick2btn.Right = KEY_D
#Left Mouse Button, Right Mouse Button and Space
Wiimote.B = BTN_LEFT
Nunchuk.Z = BTN_RIGHT
Wiimote.A = KEY_SPACE
Wiimote.Home = KEY_E
Wiimote.2 = KEY_ESC


Sonntag, 29. Mai 2011

A fast and easy way to install the Minecraft server in Ubuntu Linux

All you've got to do in order to install the minecraft server is follow these instructions.
Or you can use a shell script i wrote:
  1. download
  2. make it executable ( chmod a+x minecraft_server_setup.sh )
  3. execute it( ./minecraft_server_setup.sh )
show me the magic
#!/bin/bash
echo -n 'Do you want to (i)nstall or (s)tart the minecraft server?'
read watdo
startit(){ 
 if [ -d ~/.minecraft\ server/ ]; then
  cd ~/.minecraft\ server/
  echo -n "Do you have more than 1024MB of RAM?
  (y)es or (n)o"
  read watram
  echo -n "Do you want to start the server with a GUI?
   (y)es or (n)o"
  read watgui
  case "$watram" in 
   y|Y|Yes)
    case "$watgui" in
     y|Y|Yes)
      java -jar minecraft_server.jar
     ;;
     n|N|no|No)
      java -jar minecraft_server.jar nogui
     ;;
     *) echo "Unknown Parameter"
     read ''
     ;;
    esac 
   ;;
   n|N|no|No)
    case "$watgui" in
     y|Y|Yes)
      java -Xmx1024M -Xms1024M -jar minecraft_server.jar
     ;;
     n|N|no|No)
      java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
     ;;
     *) echo "Unknown Parameter" 
     read ''
     ;;
    esac 
   ;;
   *) echo "Unknown Parameter" 
   read ''
   ;;
  esac
 else
  echo "You don't seem to have the Minecraft server installed.
Do you want to install it now?
(y)es or (n)o"
  read watdo
  installit
 fi
 
}
installit(){
 case "$watdo" in
 y|Y|yes|Yes|i|I|install|Install) 
 if [ ! -d ~/.minecraft\ server/ ]; then
  mkdir ~/.minecraft\ server
  cd ~/.minecraft\ server/
  wget http://www.minecraft.net/download/minecraft_server.jar
  chmod a+x minecraft_server.jar
  echo -n "Do you want to start the server now?
   (y)es or (n)o"
  read startnow
  case "$startnow" in
  y|Y|Yes)
   startit
  ;;
  *)  
  ;;
  esac
 else
  echo "The Minecraft Server seems to be installed.
Do you want to start it now?
(y)es or (n)o"
  read watnowdo
  case "$watnowdo" in
  y|Y|yes|Yes)
   startit
  ;;
  *)
  ;;
  esac
 fi
 ;;
 s|S|start|Start)
  startit
 ;;
 n|N|no|No)
  exit 0
 ;;
 *) 
  echo "Unknown Parameter" 
  read ''
 ;;
esac
}
installit
exit 0

I know the code is pretty messy, but it's the first shell script i've written so I'm OK with it ;)