[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Clone root partition

On Sat, 30 Dec 2006 14:00:38 -0500, Marty wrote:

> For cloning root filesystem drives I use a small script that 
> performs an rsync backup followed up by fixups to the /dev directory, 
> /etc/fstab, and /etc/lilo.conf and then runs lilo -r to make the backup 
> bootable.  (A similar approach could be used for grub.)  The script runs in a 
> few minutes if I disable rsync checksumming.
> Here is the entire script, which uses /dev/hda1 as my backup root drive:
>   mount /dev/hda1 /mnt/hda1
>   time rsync -vxaHD --delete / /mnt/hda1/
>   rsync -xaHD --delete /dev/ /mnt/hda1/dev/
>   cp -a /etc/fstab.hda1 /mnt/hda1/etc/fstab
>   cp -a /etc/lilo.conf.hda1 /mnt/hda1/etc/lilo.conf
>   rm -rf /mnt/hda1/dev/.udevdb
>   lilo -r /mnt/hda1
>   umount /dev/hda1
> This script presumes that udev is installed.  For it to work, I have to manually 
> maintain /etc/fstab.hda1 and /etc/lilo.conf.hda1.

Thanks Marty, your rsync switch is the most comprehensive one I've seen.

Just FYI, when cloning the root partition, there are directories that
don't need to copy over, like /tmp, /proc.  So you may want to add
--exclude switches to your script next time.

Further, with modern Linux that uses udev, like what you are using, the
/dev and /sys don't need to be copied either. You can --exclude them as

Moreover, you may want to reconsider whether you want to clone
/var/cache/apt/archives next time.

The point is that I don't want to clone more than necessary. 
Does anyone know if there will be any side effects if I don't clone the
following directories?



Tong (remove underscore(s) to reply)

Reply to: