• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Ghost/clone a linux hard drive

bubbles

Limp Gawd
Joined
Dec 16, 2005
Messages
180
I want to clone my server OS hard drive to another drive (same model and size) as a backup, ready to go.

I tried Acronis but it can't copy the GRUB stuff, the new drive won't boot.

Is there an easy way to do this?
 
Tru dat spacehonkey.

I will be a bit more verbose. DD is a block byte copy utility. If your drives are identical, you can simply duplicate the primary at the byte level.

Lets say your boot disk is /dev/sda. Your boot disk won't be /dev/sda1. The "1" indicates a partition on the disk. You want the whole disk because this will catch your MBR and the partition table.

You will then need to identify your backup disk. Let's for example suppose it is /dev/sdb. If you are using the drive in something like an esata or usb shell and dynamically connected the drive and you have an xwindows desktop up you may need to dismount the drive for this to work properly as most modern distros automount externally connected drives automatically.

Note also if you copy the system in multi-user mode you may wind up with an inconsistent filesystem. You are best served to drop down into single user mode to do this. The command you would use to duplicate your disk (based on the assumption that your boot disk is /dev/sda and your data disk is /dev/sdb):

dd if=/dev/sda of=/dev/sdb bs=1024k

I think the if and of parameters are self explanatory. The bs parameter is block size which will just increase the performance of the copy. Leaving it off will cause it to complete, it will just take longer.

IF you understand this you can use a sigusr1 ipc signal to get a progress and throughput report ouf of dd.

After its done, just detatch the drive and come back up into multiuser. Store the drive somewhere safe. Like a save at grandmas house.
 
Acronis didn't grab the MBR? I haven't ever dumped an image with Acronis, but I've imaged many, many systems at work with Acronis and it's always worked great...

For linux imaging, I recommend sdfisk (partition table dumping/creation), partimage, and either dd-ing the MBR or scripting a GRUB install.
 
Back
Top