Blog/Finding subvolumes
From Forza's ramblings
2020-09-20: Finding btrfs subvolumes[edit | edit source]
Sometimes you want to make a list of all subvolumes under some /path in your filesystem.
One way to do it is to use btrfs subvolume list
. However, this does not list directories with mounted subvolumes. It is also difficult to read it's output.
Using find
might be an easier way. Lets say we want to look in /var
:
# find /var -type d -inum 256
/var/cache /var/db /var/db/repos /var/lib/boinc /var/lib/mysql /var/lib/plexmediaserver /var/lib/redis /var/lib/unifi /var/log /var/spool/jabber /var/spool/mail /var/tmp /var/www
Explanation:
-type d: Means look for directories. -inum 256: Means we should look for directories with inode number 256. Btrfs subvolumes all have this inode number[1].
References