Adding two useful bits to the thread re rsync: changing cypher, and using --update
:
As per Wolfman's post, cp -ax
is elegant, and cool for local stuff.
However, rsync
is awesome also. Further to Michael's answer re -W
, changing the cypher can also speed things up (read up on any security implications though).
rsync --progress --rsh="ssh -c blowfish" / /mnt/dest -auvx
There is some discussion (and benchmarks) around the place about a slow CPU being the actual bottleneck, but it does seem to help me when machine is loaded up doing other concurrent things.
One of the other big reasons for using rsync in a large, recursive copy like this is because of the -u switch (or --update). If there is a problem during the copy, you can fix it up, and rsync will pick up where it left off (I don't think scp has this). Doing it locally, cp also has a -u switch.
(I'm not certain what the implications of --update and --whole-file together are, but they always seem to work sensibly for me in this type of task)
I realise this isn't a thread about rsync's features, but some of the most common I use for this are:
- --delete-after etc (as Michael mentioned in follow-up), if you want to sync the new system back to the original place or something like that. And,
- --exclude - for skipping directories/files, for instances like copying/creating a new system to a new place whilst skipping user home directories etc (either you are mounting homes from somewhere else, or creating new users etc).
Incidentally, if I ever have to use windows, I use rsync from cygwin to do large recursive copies, because of explorer's slightly brain-dead wanting to start from the beginning (although I find Finder is OS X even worse)
1Umm... where is the love for
dd
?dd if=/dev/sda1 of=/dev/sdb1 bs=4096
– juniorRubyist – 2017-03-25T05:08:53.123@juniorRubyist +1 for dd. I always use that. But which flags to use? I use
conv=notrunc,noerror,sync
. – BeniBela – 2017-08-30T12:10:47.1802-1 for
dd
for 2 reasons: firstly it's a bad idea to perform a block-level copy of a filesystem that is mounted (which is the case for/
) and secondlydd
won't copy data from sources mounted within the filesystem like/boot
and/home
. – Eric – 2019-08-16T10:37:47.8632-1 for dd also because whatever fragmentation has occurred on the source is copied as well; and a different sized destination isn't automatically handled – duanev – 2019-10-30T17:53:24.507