unsharpTech

Avatar

when the bleeding edge just doesn’t cut it

My rsync Command

Ok so I started out using rsync with the options ‘-a –progress –delete’ and I thought that was doin’ the job just fine. But recently I migrated our old 600mhz Dell Optiplex GX110 to a Sans Digital MobileNAS MN2L dual drive RAID NAS and the rsyncs weren’t going as planned.

Rsync Screenie

The rsync argument ‘-a’ preserves permissons, owner, groups, etc. (-a for archive) but I would run it repeatedly to get the latest changes and it would start copying the whole thing over again. After visiting the rsync man page I came up with a new set of arguments that seem to be working out great.

rsync -rtmvh --stats --progress /path/to/source /path/to/destination/

Argument descriptions:

-r, –recursive recurse into directories

-t, –times preserve modification times

-m, –prune-empty-dirs prune empty directory chains from file-list

-v, –verbose increase verbosity

-h, –human-readable output numbers in a human-readable format

–stats give some file-transfer stats

–progress show progress during transfer

*Optional: –delete delete extraneous files from dest dir

I wanted to log this before my .bash_history gets messed up again. :)

2 Comments, Comment or Ping

  1. Diego Alvarez

    Excelent script

    The only thing is that –stats –progress –delete hast to be with –:
    rsync -rtmvh –stats –progress –delete /path/to/source/ /path/to/destination/

    Thanks :)

  2. sam

    Yeah I forgot that’s a common problem with the editor in Wordpress, it turns double-slashes into one. :|

    Thanks a lot, if you have other any improvements or caveats please contribute.

    * All right - I remembered to put the command in <code></code> tags.
    * I installed SyntaxHighlighter Plus and used ‘bash’ as the language but the command shows up funny :(
    It’s still an improvement I guess.

    Thanks, Sam

Reply to “My rsync Command”