How to duplicate a disk

LinuxMedia linuxmedia2 at netscape.net
Sat Oct 29 10:22:19 UTC 2005


 >> Assuming the old drive is /dev/hda, the new one is /dev/hdb AND that
 >>> > you've set up identical partitions and formatted them (with
 >>> > partition 1
 >>> > being the root filesystem, and 2 being the root user's home
 >>> > directory),
 >>> > create new mountpoints and mount the new drive's partitions there:
 >>> >
 >>> >     # mkdir -p /newdrive/rootfs
 >>> >     # mount /dev/hdb1 /newdrive/rootfs
 >>> >     # mkdir -p /newdrive/rootuser
 >>> >     # mount /dev/hdb2 /newdrive/rootuser
 >>> >
 >>> > Then copy the contents:
 >>> >
 >>> >     # cp -ax / /newdrive/rootfs
 >>> >     # cp -ax /root /newdrive/rootuser
 >>> >
 >>> > Don't worry about the swap filesystem, just create the
 >>> > partition for it
 >>> > on the new drive.
 >>> >
 >
 >> Are you saying this will create a bootable drive after
 >> doing a grub-install on the new drive?

 >It should.  You'd need to readdress the new drive, put it on the
 >machine, boot the rescue CD and do a grub-install.  After that, it
 >should be good to go.  I have burned CDs of filesystems that can be
 >copied via "cp -a" to pre-partitioned drives, followed by >"grub-install"
 >and it's worked.

 >The thing I was really trying to stress is that "dd" is not a good tool
 >to use _unless_ the source and target drives are the same make and >model
 >as "dd" does a block-by-block copy...and that includes the partition
 >table and boot sector.  If the drives don't match up, you could end up
 >with a mess.  That holds even for drives in LBA mode on some systems
 >with weird BIOSes.

I completly forgot about all these considerations. Would it suffice to 
just have two drives that are the same size? Or would that even be 
taking a chance? I remember being very careful to get the same makes of 
drives just in case there were slight difference is Brand X's 40 Gig 
drive and Brand Y's 40 Gig drive.

Rocco




More information about the fedora-list mailing list