netcat(thanks for the tip, Jeff!). You can backup an entire drive by creating an image of it on another machine. It's really easy to do, and it comes in real handy.
On the remote computer, you should have enough hard disk space to fit the image of the source computer's hard disk. Run the following on the remote computer:
$ nc -l -p 1234 > file.img
You can replace
1234with a port number of your choosing (1024 and above if you're not root), and you can also replace
file.imgwith any filename.
On the source computer, let's say we want to back up hard disk
sdato the remote host with the IP address of
10.0.0.4. We would run:
$ dd if=/dev/sda bs=64k | buffer -S 10M | nc 10.0.0.4 1234
The first command,
/dev/sda64k blocks at a time and pipe it into the program
buffer, which in turn feeds it into netcat (
nc). The destination is
10.0.0.4and the port number is
1234, since that is the number we used on the remote machine. The use of the
bufferprogram is optional, it's meant to improve network performance.
Once it's done a neat little file called
file.imgwill sit on the remote computer containing the disk image for the source computer's
You can actually use the image file in programs such as Qemu, and boot the operating system on it (if it has one) in a virtual machine. Hard disk images are also useful for cloning the setup of an OS on multiple computers.
Note that if your hard disk contains an OS or software that have unfriendly proprietary licenses such as Microsoft Windows, it is probably a violation of some stick-in-the-mud license agreement to do this procedure. However if you're using a free OS such as Linux, you're in the clear.