Thursday, January 26, 2006

Create exact copy of a root partition in Linux (easy)

If you have a same size additional partition in your box you can easily create an exact copy of the source partition. You will need to start in rescue mode 1st to perform the action below.


dd if=/dev/hdaX1 of=/dev/hdaX2 bs=8192

X1 = source partition
X2 = target partition

After which you will need to change the GRUB and the FSTAB to reflect the changes
a) Grub needs a ned entry for the new partition
b) FSTAB needs a change from the X1 drive to the X2 drive

The Priest (with major thanks to Anders Johansson)