How to duplicate a disk

Rick Stevens rstevens at vitalstream.com
Thu Oct 27 19:26:42 UTC 2005


On Thu, 2005-10-27 at 14:00 -0400, LinuxMedia wrote:
>  > I need to create a exact copy of a RH9 system. This
>  > system has the following partitions: /root, /swap,
>  > and /.
>  >
>  > What I would like was to somehow create a "ghost"
>  > of the disk, so I could disconnect the original
>  > IDE Drive, connect the "ghost" and the system work
>  > as normal.
>  >
>  > If I had a LVM how would it be?
>  >
>  > Is there some application or way to replicate the
>  > disk, create a mirror, ghost, whatever??
>  >
>  > Thanks in advance!
> 
> I know a guy that used to use the "dd" command on a regular basis to 
> clone hard drives. It will *definatly* do a device to device copy.
> 
> I (think) the command looked something like this...
> dd if=/dev/CopyFromDevice of=/dev/CopyToDevice.
> I tried it once, but it was slow. I Probably needed to set the 
> "ibs=BYTES" or "obs=BYTES", but I'm not completly sure. I never really 
> experimented. Take a look at "man dd".

The command is:

	dd if=/dev/fromdevice of=/dev/todevice bs=512

Note, however, that that makes an EXACT copy of the disk.  Unless the
target disk is the same make and model, this probably won't work as the
partitions won't be the same between the two.

If you have disparate drives, you should partition the new drive, then
copy the FILESYSTEMS from one to the other using "cp -a".

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.

If you want to ghost, Norton Ghost 2003 is a usable program for this.

----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-      A day for firm decisions!!!   Well, then again, maybe not!    -
----------------------------------------------------------------------




More information about the fedora-list mailing list