What is archive mode in rsync?
Solution 1:
It's all of these:
-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
--devices
preserve device files (super-user only)
--specials
preserve special files
It excludes:
-H
,--hard-links
preserve hard links
-A
,--acls
preserve ACLs (implies-p
)
-X
,--xattrs
preserve extended attributes
It's perfect for backups. My "default" set of switches is -avzP
- archive mode, be verbose, use compression, preserve partial files, display progress.
Note: Invariably when the descriptions say "preserve", it means make the destination be like the source.
Solution 2:
It make sure the permission, attributes, etc. is same at the both side. rsync only works in that way... if you want to synchronising files, you have to use -a parameter.
This is because rsync compare these permission, attribute, etc. at both side to determining if they are the SAME FILE and decide if it should be updated. if you use rsync -r xxx yyy instead rsync -a xxx yyy, some files will be copy again and again, coz, permission, attribute not be synchronised, and miss matched at both side...