ddcommand makes that boringly easy:
dd if=/dev/sda of=/dev/sdb
Wait a while, and your second SCSI disk (/dev/sdb) is an exact copy of the first (/dev/sda): boot record, partitions, everything. And by the way, the system on /dev/sda need not be Linux. If it is Windows or whatever else, just reboot to some Live Linux CD to make the copy.
But this time, the problem was a little different: I wanted the copy to go to an identical disk, but on another (also identical) computer. Not only did I not want to stop the system during the copy, but I didn't even have the cable to attach my disk to the "master" computer. Well it turned out to be almost as boringly easy than the previous example.
This page (from which this blog entry got it's title) goes into a lot of details, but to sum it up for the impatient, my simple problem was solved like this:
- Boot the machine (which we will call Slave) with some Linux media like a Knoppix live CD. My DHCP server assigned it the IP address 192.168.1.220.
- On Slave, run
nc -l -p 9000 | dd of=/dev/sda
(note that it is important to start with Slave)
- On Master, run
dd if=/dev/sda | nc 192.168.1.220 9000
- Go have a drink
That was it. If you enjoy drinks and want to also take a nap or something, replace your Gigabit switch with an old 10-Base-T hub between the 2 machines.
Don't forget to disconnect the network cable before rebooting Slave into it's brand new system, or you will have an IP address conflict if Master uses fixed IP addresses. And find more interesting names for the poor machines before the PC police gets you.
Update: now that I have used this method several times, I would like to do it with multicast to several machines at once. If you know how to do that, please leave a comment...