rsync recursive on same mount only

21

1

Hopefully, this simple question has a simple answer.

I want to run rsync recursively using the -r option, but without descending into a different mount point (file system). i.e. like the -mount option with the find command, one man page reads, e.g., “Don't descend directories on other filesystems. An alternate name for -xdev, for compatibility with some other versions of find.”

danorton

Posted 2013-07-31T03:40:53.867

Reputation: 556

Answers

29

I believe that you want the -xx option:

-x, --one-file-system
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 lqbindrq 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).

The reason I say -xx is due to the bolded section (emphasis added).

nerdwaller

Posted 2013-07-31T03:40:53.867

Reputation: 13 366

Thanks. I must've passed over that a dozen times on the man page. :-) – danorton – 2013-07-31T14:59:47.937

No worries, I just used the search function (/) and looked for "mount". Took a few nexts. Glad it works! – nerdwaller – 2013-07-31T15:04:13.280