Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


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

[Discuss] rsync v. cp in data migration



Greg Rundlett (freephile) wrote:
> Would  cp
>   cp -au /source/* /target
> be preferable to rsync?
>   rsync -vazn --checksum --progress --stats /source/ dest/

I wouldn't use either of these as written. cp is slow (inefficient I/O
buffering), and these rsync options don't handle sparse files and hard
links correctly.

A better way to look at migrations like this is to look at them as
backups and restores rather than file copies. The process then becomes a
matter of using the file system's preferred backup and restore tools
with a pipe in between instead of ancillary storage.

I use rsync as a last resort when the transfer has to happen between two
different kinds of file systems with incompatible backup tools. I also
use it to finish a migration if the source is live up until the last
moment before the work window opens. In these cases I use:

  rsync -avSHP --del source destination

a: archive
v: verbose processing
S: handle sparse files efficiently
H: handle hard links correctly
P: partial/progress

If FAT or NTFS are involved then the switches are "-rltvP".

I don't use -z. Compression isn't necessary for local-to-local or
local-to-remote over fast network links.

If I need a brute force, bulk copy then I still don't use cp. I use tar:

  cd source; tar cSf - . | ( cd dest; tar xpf - )

-- 
Rich P.



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org