I wanted to clone a 40 GB hard drive, on to another drive. At the same time, having the image saved as a backup for later use could also be beneficial. The easiest way I could think of was through dd. This was a sata laptop harddrive, and I couldn't take it out and hook it up to a desktop machine. I decided to start up ubuntu from a CD and dd the drive over the network as a file on another hard drive. The only problem was that mounting the drive via samba imposed a 2GB limit on the file. The cloning failed.
Instead of smb, I decided to use netcat. The desktop was a windows machine, on which I downloaded netcat for windows, and dd for windows. Opening up a command prompt I gave the following command:
nc -l -p 9000 | dd of=backup.img
On the system that contained the hard drive to be cloned I had booted up into a ubuntu cd, I ran:
dd if=/dev/sda | nc host_ip_to_connect_to port_no
This seems to have worked nicely, and I had a 40 gig image saved on the server. Writing it back, was even easier. Since the file had been created, you could just mount the server as a share, and use plain dd to write the file to the drive on the system you want the hard drive cloned.
Booting into the system, everything seems to be fine, and the system seems to have come up without any problems.
Disclaimer: Your mileage may vary, and you should be careful. Playing around with your hard drive like this can be dangerous, can cause loss of data/hardware...