How to exclude other filesystems but include subvolumes?
Many programs like find, tar, rsync, cp, du, etc have options to exclude other filesystems, eg rsync:
--one-file-system, -x don't cross filesystem boundaries
But this also excludes subvolumes, which are in the same filesystem.
How can I address a btrfs filesystem with all subvolumes, but exclude other filesystems?
Example: I want to copy the / filesystem (with all subvolumes), what is the best solution (for scripting!)?
Signature · 6 lines
Ullrich Horlacher Server und Virtualisierung Rechenzentrum TIK Universitaet Stuttgart E-Mail: [email protected] Allmandring 30a Tel: ++49-711-68565868 70569 Stuttgart (Germany) WWW: https://www.tik.uni-stuttgart.de/ REF:<[email protected]>
Hi,
Quoted 5 lines · Ulli Horlacher
Many programs like find, tar, rsync, cp, du, etc have options to exclude other filesystems, eg rsync:
--one-file-system, -x don't cross filesystem boundariesBut this also excludes subvolumes, which are in the same filesystem.
Yes, because subvolumes are boundaries.
Quoted 5 lines
How can I address a btrfs filesystem with all subvolumes, but exclude other filesystems?
Example: I want to copy the / filesystem (with all subvolumes), what is the best solution (for scripting!)?
The best solution that I've found is to 'mount -o subvolid=5 $your_root_device /somewhere' (I think /btrfs-admin or /.btrfs-admin is logical), where only the root user and the sudo group can read the mountpoint, and only root can write to it. I suspect you'll agree that it's important to include the output of 'btrfs sub list -pta $subvolid_5_mountpoint' in that backup (for use by humans) as well in JSON format if you want to someday automate restoration of the subvolume structure. Ie:
1. Mount a top-level view.
2. List the subvolume structure and insure it ends up in you replicant.
2.5: Optionally recreate the subvolume structure at the target.
3. Replicate everything in one shot, without '--one-file-system, -x'.
Best,
Nicholas