[K12OSN] Re: How to drive copy Linux

Algot Runebjörk algot.runebjork at coredump.se
Mon Feb 7 19:05:58 UTC 2005

> I am running Red Hat 3 AS with one 36 GB SCSI drive.  I have the drive
> partitioned, home, usr, /, var.  I want to copy the entire drive to
> another SCSI drive attached to the cable so I can install the drive
> drive in an identical server.  Then I can rename and renumber the server
> and be done.  I used Ghost 7.5 which copied the data but would the
> system would not boot.  It got to Grub in the boot squence and stopped.
> How can I get this to work?  Or what is the method to copy or clone a
> Linux drive to another?

If you have an identical disc (same size, same manufacturer etc)
you could use dd.

dd if=/dev/sda of=/dev/sdb

Then again, you might just use cat:

cat /dev/sda > /dev/sdb

Beware that it's not always working when doing that
from a mounted system, so you might want to do
it while running an OS from another unit, like a
bootable, runable Linux on a CD/diskette,
f.e. Knoppix.

But I guess you don't have an identical disc...
Besides that, you could use cp -a,
which will copy everything (including rwx, uid and gid:s)
but then you would need to partition and make a
filesystem on the new drive.
You might want to do that booting from another
drive, say a CD-distro (like Knoppix) or something,
in order to get all files undisturbed.

Example mounting sda1 and sdb1 from a system
booted from a CD (or a diskette):

# mkdir /mnt/hd_a
# mkdir /mnt/hd_b
# mount /dev/sda1 /mnt/hd_a
# mount /dev/sdb1 /mnt/hd_b
# cp -a /mnt/hd_a /mnt/hd_b
# umount /mnt/hd_a
# umount /mnt/hd_b

I guess you get the picture.
But you would still need to install GRUB or LILO or
whatever you want to boot the system with manually.

That will work with whatever drive you're using.

  / Algot

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.5 - Release Date: 2005-02-03

More information about the K12OSN mailing list