It is quite easy to clone identical hard drives using the dd command on GNU/Linux. Make sure that you put the source drive and destination drive in the system so that they don’t affect the boot. If you have a SCSI system, this is most likely done by making the SCSI IDs higher. With IDE, you probably need to put the drives in as secondaries on either channel, assuming your CD-ROM is the primary device on the second chain. On our system, we made the source ID 4 and the destination ID 6. Verify this using dmesg:
[root@srv-33 root]# dmesg | grep sd Kernel command line: ro root=/dev/sda1 console=ttyS0 Attached scsi disk sda at scsi0, channel 0, id 0, lun 0 Attached scsi disk sdb at scsi0, channel 0, id 4, lun 0 Attached scsi disk sdc at scsi0, channel 0, id 6, lun 0 SCSI device sda: 2069860 512-byte hdwr sectors (1060 MB) sda: sda1 sda2 SCSI device sdb: 8388315 512-byte hdwr sectors (4295 MB) sdb: sdb1 sdb2 SCSI device sdc: 8388315 512-byte hdwr sectors (4295 MB) sdc: unknown partition table EXT3 FS 2.4-0.9.19, 19 August 2002 on sd(8,1), internal journal [root@srv-33 root]# |
Notice that with this copy method, we don’t need to worry about partitions, boot sectors, etc. To copy sdb to sdc:
[root@srv-33 root]# dd if=/dev/sdb of=/dev/sdc & [1] 612 [root@srv-33 root]# |
The ampersand throws the task in the background. You may then copy to other destination drives if you wish. Again, this copies everything on the drive (REALLY!!), so you can image any operating system. One cheapie way to recover a server is to image the hard drive in this way. The SIDs (Windows) will be identical as well. You will be at the exact same state as the time of imaging. No worries about open files, as long as you shut down the OS properly on the drive first. This method is not suitable for cloning Windows (NT and above) workstations that will be up at the same time, unless you feel comfortable changing the SIDs, etc. Test this first in a non-production environment, and, oh yeah, read our terms of use.