Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#314259 - 20/09/2008 10:48 Cloning Linux disks
StigOE
addict

Registered: 27/10/2002
Posts: 568
I have a couple of Linux machines here (main and spare) where I need to clone the main machine's disks over to the spare machine. My search-fu seems to be a bit weak today so I can't seem to find how to best do it. I found one place where it says
' In theory "dd if=/dev/hda of=/dev/hdb" would work. However, dd by partition will be better since you do want to clone the swap partition.',
but I seem to remember that doing the whole drive in one go has been mentioned here before, so what is the best way? I have a Ubuntu CD and a Knoppix CD, so I don't need to boot from the drives that I need to clone.

Stig

Top
#314260 - 20/09/2008 11:14 Re: Cloning Linux disks [Re: StigOE]
LittleBlueThing
addict

Registered: 11/01/2002
Posts: 612
Loc: Reading, UK
Unless you are trying to save a few minutes then 'dd' is fine.

I personally use 'ddrescue' which you can get by running:
apt-get install gddrescue
The small benefit is that you can watch the progress and it will retry any errors it may find.
The useage is:
ddrescue /dev/hda /dev/hdb

Booting from a liveCD is a must but you seem to know that.

Make sure you know which disk is which to make sure you don't erase your good disk; there are *NO* checks. The command:
smartctl -i /dev/hda
will show you the serial number, or alternatively, with a modern liveCD you may find that:
ls -laF /dev/disk/by-id/
will show enough information to see which hd is which.
_________________________
LittleBlueThing Running twin 30's

Top
#314264 - 20/09/2008 14:32 Re: Cloning Linux disks [Re: StigOE]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14491
Loc: Canada
Quote:
In theory "dd if=/dev/hda of=/dev/hdb" would work.

Or more simply, cat /dev/hda > /dev/hdb

You can double the cloning speed if you put the drives on separate cables, in which case the command becomes: cat /dev/hda > /dev/hdc

Top
#314266 - 20/09/2008 14:54 Re: Cloning Linux disks [Re: mlord]
StigOE
addict

Registered: 27/10/2002
Posts: 568
Thanks, both of you.

I used dd_rescue. I guess this is the same as ddrescue, but that's what came with Knoppix 5.1.1. Ubuntu 8.04 didn't want to boot, it stopped somewhere in the boot process.

Almost finished with the second set of disks now, so time to check if it actually worked... :-)

Stig

Top