Copying a drive over the network

My sister’s laptop was acting badly and I determined that the hard drive sounded like it was in bad shape. We tried using SpinRite to “fix” the drive but instead we got the message that the drive was in imminent danger of failing and we should save as much of the data off as possible before kissing the drive goodbye. But this isn’t as easy as it is with a desktop unless you have the right hardware or the right software.

Generally speaking, I would have just taken the drive out and slapped it into my Linux box and do a straight DD of the drive to mirror it’s contents onto a good drive. However, since this was a laptop hard drive, I would need a 2.5″ IDE to 3.5″ IDE drive converter. That would allow me to connect a smaller laptop drive into a regular desktop computer. These can easily be bought from a CompUSA or NewEgg.com.

Alternatively, I can use a Knoppix CD to boot the laptop into Linux and use Netcat and DD over the local network.

First, I had to set my desktop up to listen. The following command will have netcat listening on port 1010 and will output anything that is sent to that port into dd into a file called /tmp/laptop.img:
nc -l -p 1010 | dd of=/tmp/laptop.img

Then, I started the transfer on the laptop:
dd if=/dev/hda1 | nc 192.168.1.50 1010

This takes the output of the dd command (which is exporting the contents of the drive partition /dev/hda1) and sends it using netcat to my desktop at address 192.168.1.50 over port 1010. I picked this tip up from http://blogs.techrepublic.com.com/networking/?cat=212 while I was researching converting a physical machine to VMWare.

It’s slower going over a network connection than plugging the drive directly into the desktop but it is an option if you don’t want to spend the $10 on the IDE converter.

No comments yet.

Leave a Reply