Rsync for archiving
Friday, November 10th, 2006What is “-a (–archive)” in rsync, and the alternative if one just wanted to just get any missing files copied to dest.
-a, –archive = -rlptgoD
-r, –recursive
-l, –links
When symlinks are encountered, recreate the symlink on the destination.
-p, –perms
This option causes the receiving rsync to set the destination permissions to be the same as the source permissions. (See also the –chmod option for a way to modify what rsync considers to be the source permissions.)
-t, –times
This tells rsync to transfer modification times along with the files and update them on the remote system. Note that if this option is not used, the optimization that excludes files that have not been modified cannot be effective; in other words, a missing -t or -a will cause the next transfer to behave as if it used -I, causing all files to be updated (though the rsync algorithm will make the update fairly efficient if the files haven’t actually changed, you’re much better off using -t).
-g, –group
This option causes rsync to set the group of the destination file to be the same as the source file. If the receiving program is not running as the super-user (or if –no-super was specified), only groups that the invoking user on the receiving side is a member of will be preserved. Without this option, the group is set to the default group of the invoking user on the receiving side
-o, –owner
This option causes rsync to set the owner of the destination file to be the same as the source file, but only if the receiving rsync is being run as the super-user (see also the –super option to force rsync to attempt super-user activities). Without this option, the owner is set to the invoking user on the receiving side.
-D The -D option is equivalent to –devices –specials.
–devices
This option causes rsync to transfer character and block device files to the remote system to recreate these devices. This option has no effect if the receiving rsync is not run as the super-user and –super is not specified.
–specials
This option causes rsync to transfer special files such as named sockets and fifos.
# -v, –verbose
# -z, –compress compress file data
# -P equivalent to –partial –progress
# –partial keep partially transferred files
# –progress show progress during transfer
# –size-only only use file size when determining if a file should be transferred
# -W, –whole-file copy whole files, no incremental checks
# –ignore-existing ignore files that already exist on the receiving side
# -n, –dry-run show what would have been transferred
To copy files, without worry about perms, times, groups, etc:
rsync -rlvz –size-only –whole-file –ignore-existing
i.e. rsync -rlvz –size-only –whole-file –ignore-existing –stats ~/Sites/ /Volumes/sites/