[WBEL-users] Disc cloning

Kirby C. Bohling kbohling at birddog.com
Tue Mar 8 09:37:07 CST 2005

On Tue, Mar 08, 2005 at 09:48:04AM +0100, Benedikt Carda wrote:
> Hey,
> for testing purposes I want to make a clone of my current 80 gig IDE 
> harddisc. What I have done so far:
> Connecting another 80 gig harddisc to the IDE controller, booting the 
> system with Knoppix (a linux version on CD-ROM) and entering the command:
> dd if=/dev/hda of=/dev/hdb
> It took about 2 hours then dd was finished. First it seemed to do the 
> job well, but the last partition on the new hard disc, which was hdb6 
> (/home) was completely messed up. I guess this is because the hard discs 
> are not completely identical, they are both 80 gigs but from different 
> vendors, therefore probably different number of inodes etc.
> Any suggestions how to make a clone disc?
> Best Regards,
> Benedikt Carda

Well, if you were writting to /home with other processes, you could
have easily ended up with a corrupt filesystem.

You could run fsck on the 80 and see what happens.  Alternatively,
boot with a rescue CD and run these commands:

fdisk /dev/hdb 
# fdisk this to be as close to the other disk as you can...

mkdir /tmp/orig
mkdir /tmp/dest

mount /dev/hda1 /tmp/orig
mount /dev/hdb1 /tmp/dest
( cd /tmp/orig ; tar cf - . ) | ( cd /tmp/dest ; tar xvpf - )
umount /tmp/orig
umount /tmp/dest

Later, rinse, repeat for each partition that has a filesystem.  You
probably also will need to do something like mkswap on the swap

Then all that should be left is installing grub onto the /dev/hdb
and mark the same partitions bootable.  I'm not sure of the commands
to do that off the cuff, so I won't write my best guess.  Read the
grub man page, I'm sure I've figured it out using the man page and
the interactive help.  This set of commands should work on two
different drives even if you have different sizes as long as there
is enough space for the files.

If I was a good little Admin, I'd use cpio instead of tar, as this
will only work with GNU tar.  Well, it won't work with original UNIX
tar, because it would open of special devices, where GNU tar by
default will just copy the special device file instead of copying
the contents you get by running "open" on the special device.
However, I'm not a fluent in cpio.


More information about the Whitebox-users mailing list