Cloning Computers and Reiser File Systems

For the small business owner, it sure is nice to have one main computer for your work, but what happens when it starts to have hardware problems? What you really want is the ability to take the whole hard drive image and put it on another computer, so your main computer can be fixed.

My main development computer needed a new motherboard. I could run it, but at unexpected times, it would turn off all by itself! I knew it was going to take awhile to fix, so I decided to clone the hard drive onto another machine of the same make (IBM). Knowing that the two machines had the same architecture and hard drive size, I was able to use netcat and dd to do the cloning.

Thanks to an article on datastronghold.com about using netcat and dd, it wasn't too hard to do (although it took a long time, about 10 hours).

On the clone, I booted off a knoppix live CD. I hooked up the two computers with a crossover cable to keep the traffic off of the network. On the clone, I needed an IP address, then the dd and netcat line to receive all of the bits from the main machine (as root):

ifconfig eth0 192.168.1.99 up
netcat -l -p 9000 | dd of=/dev/hda

I send everything on the hard drive from my main development machine like this (as root):

dd if=/dev/hda | netcat 192.168.1.99 9000

This worked really well for the first cloning. I shipped off the broken computer and continued working with the exact setup on my clone. It really kept me going without accidentally forgetting any files (which would have been the case if I just started using any other computer.

After I received my main computer with a new motherboard, then I needed to repeat this process with the computers switched: the main computer is the clone and the clone is the master.

I did run into a problem with knoppix turning on power management, so make sure when you boot off the knoppix CD that you type:

knoppix noapm

to ensure the computer will not "sleep" in the middle of receiving data from the master.

Sadly, I booted my main computer after it was cloned, but it returned this weird error about using "--rebuild-tree" and did not complete the boot process. I hadn't seen that before, but I did find the cyberciti article about repairing the ResierFS file system.

So from the basic linux that was offered up after the error, I typed:

reiserfsck –scan-whole-partition –rebuild-tree /dev/hda1

I repeated this for the second partition as well: /dev/hda2.

The reiserfsck process did a valiant effort in saving files, but it was clear not everything was working properly. For instance, Firefox didn't seem to be installed anymore and my httpd.conf file for my apache server was now in binary.

I decided to give it one more try. I repeated the cloning process above and the second time it worked like a charm! I'm now writing this from my main computer and the clone is available for other uses.

What is nice about this process is that you can run the cloning at night and off of the network. It may take hours to complete, but it's not like you have to sit there and watch it. You can go about your business, then boot up your clone once the process is complete.

Special Thanks to Jim Varnum for providing guidance throughout the whole procedure.