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?

2 Answers 2


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.

  • Thank you very much! It was so easy:) In the meantime I started doubting if cloning is such a good idea. I will copy all the drivers and randomly installed packages from the 'sender' machine. What do you think? Is it healthy to reinstall the system from time to time to make it work better or I can just make a clone and enjoy everything working immediately?
    – savick01
    Commented Jul 19, 2013 at 19:08
  • @savick01 That's a new question - please ask it as such. And if you think this was useful, then consider marking it as correct.
    – gertvdijk
    Commented Jul 19, 2013 at 22:28
  • 0. I already upvoted it and will accept when test (now I have no internet cable available and wifi is too slow(-:). 1. AFAIK discussion questions are not welcome at SE sites, so I just asked for your opinion via comment. 2. If you think it fits here, I can ask it, but there already is a similar question here. Would you be so kind to post your opinion there including the 'healthy or unnecessary to reinstall' part?
    – savick01
    Commented Jul 19, 2013 at 22:46
  • Yeah! Everything works perfectly! And the cloning process was very fast - much faster than normal copying files. I think it was a good decision to make a clone. P.S. I disabled proprietary drivers before clone just in case.
    – savick01
    Commented Jul 21, 2013 at 14:15

I can't comment, but I'd like to add to @gertvdijk 's answer that you can use | pv | to show a progress report and it is also wise to add explicit buffer size bs=8M (e.g.) to speed things up (default is 512 bytes which is pretty small). The size depends on your hardware and if you're cloning on local gigabit network or a slower connection. The final command on the receiving end could look like this (add sudo if needed):

nc -l 5678 | dd if=/dev/stdin | pv | of=/dev/sda bs=8M


Just noticed that since version 2.1, dd has a status display. Just add status=progress:
- 1. Receiver nc -l 5678 | dd if=/dev/stdin of=/dev/sda bs=8M status=progress
- 2. Sender dd if=/dev/sda of=/dev/stdout bs=8M | nc 5678

I just cloned a 8TB drive over 1 Gbit local network in 37 hrs (60mb/s) with the above commands.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .