Tag Archives: backup

Backup/Restore remote disk images.

There are occasion when backing up data is not enough. You may want a snapshot of your whole system. There are some great tools out there like Clonezilla, which in turn uses partdisk, or Ghost if you don’t mind closed source. But you can do this using tools almost certainly available even in the most minimal of linux installs.
Caveats:
  • The image is easily restorable to the hardware it was created on. If you restore to another computer it will create unexpected issues.¬†Usually¬†fixable by creating a new initrd
  • The partition sizes are fixed and must be restored to a harddrive of equal or larger size.
  • dd creates a byte level copy of your harddrive, empty space is included in the backup. Without gzip a 160GB disk will create a 160GB disk image. With Gzip the image will still be very large.

Backup image to another Linux machine

If you have a Linux workstation with a large enough hard-drive you can simply backup and restore across the network. You will need root access to both boxes. Netcat is also available for Windows and Mac.

1. On the Destination Where you are storing the backup

In this example /dev/sda is the harddrive you want to backup/restore. Make sure you choose the correct harddrive.

 # nc -l 1010 > harddrive.img.gz

2. On the source computer The machine being backed-up

# dd if=/dev/sda | gzip -cf | nc -q 10 xxx.xxx.xxx.xxx 1010

Restore image form another Linux machine

1. On the Targe The machine you are restoring to

  • You will need to boot into a live image, I suggest Ubuntu, from USB or a CD.
  • From the now booted, live operating system:
    # nc -l 1010 | gzip -dcf | dd of=/dev/sda

2. On the Source machine The machine with the image saved

# nc -q 10 xxx.xxx.xxx.xxx 1010 < harddrive.img.gz