Cloning hard disks over the network:

Boot up destination machine with Knoppix live CD and run nc -l -p 9000 | dd of=/dev/sda Then on the master dd if=/dev/sda | nc <dest-ip> 9000 You can monitor bandwidth usage to see progress: nload eth0 -u M
This is a bit to bit copy so if you have a 500GB hard disk it will take a long time even if have Gigabit Ethernet

By: lv4tech
2009-05-07 05:26:58

What Others Think

Besides the fact this is bad formatted, you forgot to advise if the hard disk contains an OS, both computers must have the same hardware configuration. Also, you need to Ctrl-C to ends nc (just for the master machine because the destination one finishes by itself after that). Although I think "why do you need a dd copy of an entire hard disk drive just for your regular files?" An scp would be better. You might suggest a use, like some corporation which has a lot of the same manufactered computers and need to them running the same OS configuration. However, better cloning just the interest partitions (and restoring the MBR with GRUB, for example). That's more useful if you run a NIS service on your server and the clients share accounts with it. One more comment. You can use the -vv (verbose) flag for nc and track when the copy ends. P.S.: I don't know Knoppix, but with the Ubuntu LiveCD you must need to be root (sudo doesn't work).
o6291408 · 569 weeks and 3 days ago
Having 2 identical machines and wanting to have a hot spare in case something goes wrong with the primary, just switch an internal ip and you are back up and running in a matter of minutes. I think of it like windows system restore, this is done weekly with no downtime for the live machine. If you know a better way of achiving this please do let me know
lv4tech · 569 weeks and 3 days ago
Or you could use the network block driver maybe....
DaveQB · 569 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: