3

With the following subvolumes on a btrfs filesystem on /dev/sda3:

root
root/home

and the following mount:

/dev/sda3 on /

Is the /home folder on the root subvolume, or on the root/home subvolume?

1 Answer 1

2

The default subvolume

When you create a brand new BTRFS filesystem, the system not only creates the initial the root subvolume (numbered 0) but also tags it as being the default subvolume. When you ask the operating system to mount a subvolume contained in a BTRFS volume without specifying a subvolume number, it determines which of the existing subvolumes has been tagged as "default subvolume" and mounts it. If none of the exiting subvolumes has the tag "default subvolume" (e.g. because the default subvolume has been deleted), the mount command gives up with a rather cryptic message:

# mount /dev/loop0 /mnt
mount: No such file or directory

It is also possible to change at any time which subvolume contained in a BTRFS volume is considered the default volume. This is accomplished with btrfs subvolume set-default. The following tags the subvolume 261 as being the default:

# btrfs subvolume set-default 261 /mnt

After that operation, doing the following is exactly the same:

# mount /dev/loop0 /mnt
# mount -o subvolid=261 /dev/loop0 /mnt

From http://www.funtoo.org/BTRFS_Fun

1
  • I had mounted the default subvolume without setting the appropriate subvolid in the mount flags. Hence I ended up with a volume mounted that had a /root folder with a /root/home etc. It seems the answer to my question is actually Yes. Btrfs does indeed mount nested volumes.
    – Joshka
    Sep 29, 2013 at 9:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .