Blog/Finding subvolumes

From Forza's ramblings

2020-09-20: Finding btrfs subvolumes

The diagram shows a simple subvolume structure, and the relationships between the different sets of keys (grouped by inode number).

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


 -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].


  1. Btrfs Trees design[1]