rsync

rsync -aHAX source dest 

-u flag will "copy only when the SOURCE file is newer than the destination file or when the destination file is missing". 
And the -a (archive) flag will be recursive
-P or --progress shows progress for each file individually.
H preserves hard-links, 
A copies ACLs,  
X copies extended attributes. 


rsync -avhW --no-compress --progress /src/ /dst/
-a is for archive, which preserves ownership, permissions etc.
-v is for verbose, so I can see what's happening (optional)
-h is for human-readable, so the transfer rate and file sizes are easier to read (optional)
-W is for copying whole files only, without delta-xfer algorithm which should reduce CPU load
--no-compress as there's no lack of bandwidth between local devices
--progress so I can see the progress of large files (optional)



rsync /path/to/local userX@remote.com/path/to/remote
If you want to do this user mapping and not lose permissions settings, don't use -a. First, run the rsync with mywww@myhost.com to get the right username. Then, instead of -a which will cause you to preserve ownership, specify the options manually. From man rsync:
    -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
    -r, --recursive             recurse into directories
    -l, --links                 copy symlinks as symlinks
    -p, --perms                 preserve permissions
    -t, --times                 preserve modification times
    -g, --group                 preserve group
    -o, --owner                 preserve owner (super-user only)
    -D                          same as --devices --specials

So, -a activates all of the above options but you don’t want to preserve the group or owner. This command should do what you want:

rsync -rlptDvz /path/to/local mywww@myhost.com:/path/to/remote

Since you are now logging in as mywww and no longer preserving owner/group information, the copies made by rsync will belong to the mywww user.

--usermap and --groupmap options 
--usermap=tom:www-data

Posted in ITMS

Leave a Reply

Your email address will not be published. Required fields are marked *

*