I just spent the entire day trying to figure out why rsync wouldn’t recurse into a Truenas app data folder, despite the -r
flag being present among several others (kept fiddling with it during my day job as a lawyer, that’s how intent I was on figuring this one out). The culprit turned out to be the --one-file-system
flag.
Rsync manual states:
–one-file-system, -x
This tells rsync to avoid crossing a filesystem boundary
when recursing. This does not limit the user’s ability to
specify items to copy from multiple filesystems, just
rsync’s recursion through the hierarchy of each directory
that the user specified, and also the analogous recursion
on the receiving side during deletion. Also keep in mind
that rsync treats a “bind” mount to the same device as
being on the same filesystem.If this option is repeated, rsync omits all mount-point directories from the copy. Otherwise, it includes an empty directory at each mount-point it encounters (using the attributes of the mounted directory because those of the underlying mount-point directory are inaccessible). If rsync has been told to collapse symlinks (via --copy- links or --copy-unsafe-links), a symlink to a directory on another device is treated like a mount-point. Symlinks to non-directories are unaffected by this option.
I don’t understand why removing this flag helped.
I was trying to copy, for testing purposes, a deprecated dataset containing the data directories of a (no longer installed) app. So the source was /mnt/tank/appname
and I expected rsync to recurse into the four child datasets that I had created (via the Truenas GUI) in appname
.
Apparently that’s asking rsync to recurse into different file systems? Why? Intuitively, I would assume this flag refers to, say, a zfs system and a FAT system.
For completeness’ sake, I intend to set up a Time Machine-like rsync script that backs up some folders to an offsite Synology NAS. I’m using:
GitHub - laurent22/rsync-time-backup: Time Machine style backup with rsync. (original shell script)
GitHub - basnijholt/rsync-time-machine.py: Ultralight Time Machine-style backups using rsync (improved python port of that shell script)