[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dd or cp over network: should I use scp?



On Thu, Feb 24, 2011 at 16:04, Karl E. Jorgensen <karl@fizzback.net> wrote:
> I would recommend rsync instead - simply because if things go wrong during the
> copy, it can pick up from where it left, rather than restarting from scratch:
>
>        rsync -av --numeric-ids / root@otherhost:/
>
> --numeric-ids is to ensure it uses the _numeric_ user/group IDS on the other
> side. You may find that some users have differnt IDs between machines - e.g.
> IDs that are added by packages (e.g. mysql and stuff).
>
>

Thanks, I actually did once run into the problem of uids on a Fedora
box being different from those on a Debian box.


>> Can I actually use dd over the network, maybe by piping to scp
>> somehow? What is the canonical way of doing this?
>> Thanks!
>
> Yes - if the disks are the same size, it's a no-brainer. My personal preference
> for this is to use "nc" - which is lightweight, but does not do encryption.
>
> On the "source" machine, send it out over the network
>        sourcebox:~# dd if=/dev/sda | nc -l -p 9999
>
> and on the destination box - which should be running a "live CD" or similar, as
> blasting over a disk which is in use leads to kernel confusion and human
> madness:
>        destbox:~# nc $IP_OF_OTHER_BOX 9999 | dd of=/dev/sda
>
> You may want to use gzip to trade off CPU usage for better network bandwith:
>
>        sourcebox:~# dd if=/dev/sda | gzip | nc -l -p 9999
>        destbox:~# nc $IP_OF_OTHER_BOX 9999 | gunzip | dd of=/dev/sda
>
> Hope this helps

Thanks Karl!


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com


Reply to: