Ubuntu – Cloning Ubuntu over network


I want to migrate with my 12.04 to another machine. I have found the way with dd and hope it will work for me. The thing is that I have to somehow connect both drives to do the actual cloning. I'm trying NFS. When I write in /etc/exports:


and invoke exportfs -a I end up with the following error:

exportfs: /dev/sda1 is neither a directory nor a file. Remote access will fail

Any clues how I can overcome the problem? Is it a matter of configuration or NFS is a dead end and I have to use something different?

Best Answer

On the receiver end:

nc -l 5678 | sudo dd if=/dev/stdin of=/dev/sda

Then on the sender end:

sudo dd if=/dev/sda of=/dev/stdout | nc 5678

This copies sda from one PC to another over the network to IP and port 5678. Be sure to install one of the nc packages (just run nc in the terminal and you will get the suggestion if not installed yet.)

Also make sure not any volume on either of the sda drives has a filesystem mounted, so run off a live CD on both ends if you're unsure.