On Thu, 26 Oct 2000, Matheson wrote: > I want to make an _exact_ copy of my hard-drive to my friend's > hard-drive, including partitions, boot-able, etc. Is their a way to > do this with LInux? I know that I used to use a program with Windoze > that could
If the disks are the same size exactly, you can use dd: dd if=/dev/hdb of=/dev/hdc which will copy /dev/hdb to /dev/hdc. It can take a while (and won't give you status updates), be patient. If the disks are not the same size exactly, you are better off to set up the partition table yourself with fdisk and copy each partition individually. dd if=/dev/hdb1 of=/dev/hdc1 etc etc. To use dd to copy partitions, the filesystem on the source partition has to be unmounted or mounted read-only. (To use dd on a whole disk then *every* filesystem on the disk has to be unmounted or read-only). Note that you will in this case have to make sure that any given destination partition is at least as big as the source partition. It will probably be impossible, if the disks are different geometry, to make the source and destination *exactly* the same size so just be sure the destination is bigger. Depending on how much of your disk is used and unused, it might be faster to use tar. If you have lots of unused space (say more than half the space on the partition is free), you can potentially do better with tar. In this case, of course, both partitions have to be mounted. Then do: cd /mnt/hdb1 tar cf - . | (cd /mnt/hdc1 && tar xpvf - ) (assuming of course the partitions are mounted on /mnt/hdb1 and /mnt/hdc1 respectively, use the appropriate mount points for your system). This has the advantage of potential speed (but will be slower on a full disk), you get status reports, and the filesystem that gets output will come out 100% defragmented. But if anything is writing to a file when it comes time to get it copied then it will not be copied correctly. So if you are trying to copy your whole installation from one disk to another, at least do it in single user mode. :}

