The system administrator guide of the Btrfs wiki (here) says:
A Btrfs subvolume can be thought of as a POSIX file namespace.
I remember at first it saying that a subvolume is, as opposed to being able to be thought of as, a "POSIX file namespace". A Google search for
"POSIX file namespace" turn up only things about Btrfs, so the phrase is unhelpful.
Just what is a subvolume in Btrfs? If a subvolume is accessible as a directory from the filesystem root, then how is mounting subvolume any different from bind mounting a directory on any other filesystem to another location without intermediately mounting the root of said filesystem? This is what I mean:
# standard bind mount mkdir /mnt/data mkdir /mnt/docs mount /dev/sda2 /mnt/data mount --bind /mnt/data/docs /mnt/docs umount /mnt/data rmdir /mnt/data # hypothetical method of directly mounting # a file/directory on a filesystem # to some path that achieves the same # as the above mkdir /mnt/docs mount -o path_on_fs=/docs /dev/sda2 /mnt/docs # if /docs on sda2 was a subvolume mkdir /mnt/docs mount -o subvol=/mnt /dev/sda2 /mnt/docs
What is the purpose of the subvolume feature? An example:
/var/lib/machines.raw is a Btrfs filesystem image that is used by
machinectl to store virtual machines and/or containers. Presumably, Btrfs is used for subvolumes. What do the subvolumes do for that?
If a subvolume is useful for containers, does it have built-in isolation for processes running in different subvolumes?