Wednesday, October 29, 2008

clone the filesystem/machine

I was reading LinuxJournal's email update regarding latest articles released, i came through a short article regarding cloning the filesystem, although the author have made a simple & easy way to do so, but i and many others did'nt like it, even in article's comments, i found a very simple n short way of cloning the filesystem i.e. rsync + ssh, here it is :p

Why not just use rysnc after booting the target from a livecd (assuming it's a new install), enabling ssh and mounting the target partition?

mkdir /mnt/fake
mount -o bind / /mnt/fake
cd /mnt/fake
rsync -avz --progress ./*

/boot /home or /var other other partitions can be done the same way, and attributes are preserved. Bind mounting will keep rsync from trying to copy /proc /dev or /sys from your original / partition, too. Only / has to be bind mounted before copying.

I guess its the perfect way, though there are many other options !


No comments: