Clone Or Backup Disks


Table of Contents

Rsync Full System Mirroring (Debian Linux) 
Backup Linux system with rsync 
References 
Disk logical backup tools 
Disk logical backup tools 
Clone root partition 
Clone root partition 
Clone root partition 
Clone root partition 
Clone root partition 
Clone root partition 
"Clone" your Gentoo root partition 
"Clone" your Gentoo root partition 
"Clone" your Gentoo root partition 
how to clone a disk 
Have DVD burner, will backup! 
Have DVD burner, will backup! 
Have DVD burner, will backup! 
Not helpful urls 

Rsync Full System Mirroring (Debian Linux) 

Rsync is a command line utility traditionally used in synchronizing files between two computers over the network, but rsync can also be used as an effective backup tool.

This article explains how to use rsync to backup your whole Linux system setup to a second drive attached to your system. You can use a removable drive, such as an external USB hard drive, so that you can store the backups in a safe place away from your working environment.

I am running Debian 3.1 (Sarge) on a fanless LEX NEO configuration. As I have installed the whole system on a 1GB CF-card, I would like to have a mirror of it on another partition on my harddisk (Let's say I'm going on vacation and desperately need another CF-card and the stores are already closed…). I'd like to be able to boot from that second source.

I have mounted /mirror to /dev/hdd1, my backup partition of the same size like my root partition (in my case the CF-card).

Now, let's copy all the data over to our backup partition:

$> /usr/bin/rsync -a --exclude-from=excludes.cfg --delete / /mirror/

Make sure you exclude all of the following directories/files. I have specified the exclude list in a separate file excludes.cfg:

/proc/
/tmp/
/mnt/
/mirror/
/etc/fstab

The rsync-command above we could run e.g. daily by cronjob. On a regular system this should not take more than 2 minutes as rsync only transfers the data that has been changed in a incremental manner. (besides, Rsync's protocol is pretty smart, see Tom's article on nope.ch).

Copy the original /etc/fstab over to /mirror/etc/fstab and edit it that the new partition get's correctly mounted as /.

In my case this results in the following line:

/dev/hdd1 / ext2 defaults,errors=remount-ro 0 1

Also, make sure, the directories we are never going to synchronize exist on your mirror partition as linux needs them as a mounting point:

$> cd /mirror
$> mkdir -m 1777 tmp
$> mkdir -m 555 proc
$> mkdir -m 755 mnt

Finally, configure grub to correctly boot from the mirrored partition:

Example 1. File /boot/grub/menu.lst

title Debian GNU/Linux, kernel 2.6.8-2-386, MIRROR ON /dev/hdd1
root (hd1,0)
kernel /boot/vmlinuz-2.6.8-2-386 root=/dev/hdd1 ro init=/sbin/preinit ide=nodma
initrd /boot/initrd.img-2.6.8-2-386
savedefault
boot

now, run:

$> grub-install /dev/hdd

If the command fails and grub answeres with something like "/dev/hdd does not have any corresponding BIOS drive", make sure, the device drive has been entered into /boot/grub/device.map, e.g.:

(hd0) /dev/hdc
(hd1) /dev/hdd
(hd2) /dev/sda

That's it! We're done. reboot and run the mirrored system from the grub menu.

documented on: 8/21/2005 by Pipo