by adrian_b · 4y ago · 0 comments
This may be enough for some users, but "--archive" does not copy all file metadata, so it may cause surprises.
rsync must be invoked with "--archive --xattrs --acls" to guarantee complete file copies.
Unfortunately all command-line utilities for file copying that are available for UNIX-like operating systems use default options that do not copy most file metadata and they usually need many non-default flags to make complete file copies.
Nevertheless, rsync is the best of all alternatives, because when invoked correctly it accurately copies all file metadata even between different file systems and different operating systems, in cases when other copying utilities may lose some file metadata without giving any errors or warnings for the users.
https://serverfault.com/questions/842531/how-to-perform-incr...
Btrfs and apfs also support auto-snapshotting and replication, but I don't have experience with them.
Also, snapshots are NOT backups. And one definitely should not rely on snapshots along to keep their files safe.
(I wish this was handled by rsync.)
However many old versions of file systems lacked support for things like high-resolution timestamps, extended attributes or access-control lists. Because such support has been introduced much later, there are a lot of programs for archiving, backup and copying which lose such metadata, at least with their default options.
While equivalent metadata exists on Linux XFS and EXT4, Windows NTFS, FreeBSD UFS and ZFS etc. each platform has different APIs for accessing file metadata (and on Linux the API may vary even between the many available file systems), so only few programs, like rsync, are able to copy everything while taking care to use the correct API to replicate the metadata without losing information.
tl;dr try this if rsync fails in unexpected ways:
echo "Syncing ~/.ssh directory"
rsync --archive --delete --xattrs ~/.ssh/ laptop:.ssh/