11

Is there a command to show which btrfs subvolumes are mounted on each mountpoint?

Alternatively, is there somewhere (e.g. in the /proc or /sys trees) where the information can be read?

The output from the df command simply shows the filesystem's root device and /etc/mtab (aka /proc/mounts) doesn't contain the subvol=... option.

StarNamer
  • 3,162
  • excellent! mount doesn't contain the subvol=... option, either. – user1902689 Jun 25 '15 at 04:31
  • @user1902689: I don't understand your comment. If I mount a btrfs subvolume using mount -tbtrfs -osubvol=home,compress=zlib,autodefrag,recovery /dev/sdc /home then /etc/mtab contains a line /dev/sdc /home btrfs rw,relatime,compress=zlib,space_cache,autodefrag,recovery 0 0. The subvol=... option isn't included. What are you referring to? – StarNamer Jun 28 '15 at 15:36

2 Answers2

18

findmnt -nt btrfs, the source subvolume is in [...], the mountpoint is the first column. Alternatively, you could look into the file /proc/self/mountinfo yourself.

llua
  • 6,900
  • 1
    thanks! - didn't know about findmnt. (I use mount | grep btrfs per answer below.) – go2null Sep 03 '17 at 22:38
  • 1
    Thanks. For those like me that land here via google looking for a way to just list the mountpoints using btrfs, just add the --output TARGET parameter: findmnt -nt btrfs --output TARGET – Boris Feb 17 '19 at 16:34
5

On older systems that don't have the nicely-formatted findmnt command, just run mount with no arguments. It will spit out a list of devices, mountpoints, types and options. Pipe it to grep for btrfs if you want to filter it down for easy reading.

Perkins
  • 365