Rsync --one-file-system flag prevents recursion into child datasets?

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)

It refers to not crossing a file system mount point. Many Unix utilities (du, find, …) take the same flag for exactly the same purpose.

1 Like

So every dataset one creates via the GUI (as opposed to folders created via the CLI) is a separate mount point? What’s the design reason behind this? Is it because this allows access to data that’s physically spread over different drives?

I guess /mnt/sort of gives it away, … but of course hindsight is 20/20.

Independent policies with respect to encryption, compression, snapshots, replication, quota, ACLs, … almost everything you can control in ZFS and hence in TrueNAS happens at the dataset level.

Generally just “management of data”.

We use ZFS for hosting, essentially our own private cloud solution. Picture a server with 100 customer containers running. Each container a dataset - snapshot/rollback/backup/update/… of each customer independent of the others.

1 Like

Thanks for taking the time to explain.

Not to be obtuse, but couldn’t you obtain the same level of differentiation with folders and permissions?

No. Compression, encryption, block size, quota, … are per dataset settings. You cannot apply any of these to folders.

2 Likes