Is there a way to make a btrfs subvolume tree like what is shown below? (Only subvolumes - no regular directories or files.)
# tree /mnt/1 /mnt/1 ├── a ├── snapshot │ ├── a │ └── subv └── subv └── b
This example is created from a "sample" btrfs with no regular directories or files.
tree <mountpoint> shows all directories and files, not just the subvolumes. Using the
-d option shows only directories, which is better, but still shows non-subvolume directories.
So, on an installed system, you get:
# tree / / ├── bin -> usr/bin ├── boot │ ├── grub │ │ ├── fonts │ │ │ └── unicode.pf2 │ │ ├── grub.cfg │ │ ├── grub.cfg.example │ │ ├── grubenv │ │ ├── i386-pc │ │ │ ├── 915resolution.mod │ │ │ ├── acpi.mod │ │ │ ├── adler32.mod │ │ │ ├── affs.mod ... <over 242,000 lines snipped>
tree -x? It's not exactly what you asked for, but it may suit your purpose.
btrfs subvolume list /currently gives me 10 lines.
tree -x /gives me over 108,000 lines.
/a/b/cexist but the intermediate
/a/bis not a subvolume but a regular directory. Omit the second level in the tree? But then where would
/a/zwere a subvolume? Or show a blank placeholder in place of
/a/bwhich isn't a subvolume? Also seems problematic. Anyway, maybe I'm just not imaginative enough to see the solution. Good luck.
btrfs subvolume list /, I see ID ### gen ### top level ### path <path>. Is the top level number corresponding to the ID numbers? If so, I'd be happy for a tree generated on that basis, where top level 5 (at least on my system, indicating the "top-level" subvolumes) are shown, with recursive branches showing any subvolumes with that node's top level. I'm guessing it would probably have to be a btrfs-progs feature.