Skip to content

btrfs

"top-level subvolume with ID 5"

Wikipedia says:

Any Btrfs file system always has a default subvolume, which is initially
set to be the top-level subvolume, and is mounted by default if no
subvolume selection option is passed to mount. The default subvolume can be
changed as required.

But this subvolume isn't listed in sudo btrfs subvolume list

1748377807.png

source: https://www.reddit.com/r/btrfs/comments/odo7zh/installed_linux_on_btrfs_with_no_subvolumes_didnt/

Also note this comment in the same reddit post:

1748377927.png

@ isn't special

The below screenshot is from https://youtu.be/Qgg5oNDylG8?t=1289

1748378236.png

At first I thought "@" was something special, that maybe it was telling btrfs to use that subvolume with ID 5 as the "root" partition. But now I think otherwise. Using "@" here is just a subjective choice.

mounting

Suppose you had a partition scheme like this:

nvme0n1     259:0    0 476.9G  0 disk
├─nvme0n1p1 259:1    0     1G  0 part  /boot
├─nvme0n1p2 259:2    0     8G  0 part  [SWAP]
└─nvme0n1p3 259:3    0 467.9G  0 part  /
mkfs.fat -F32 /dev/sdb1
mkswap /dev/sdb2
mkfs.btrfs /dev/mapper/root
mount /dev/mapper/root /mnt
cd /mnt
# ls shows nothing
ls
btrfs subvolume create root
umount /mnt
mount /dev/mapper/root /mnt
# now the ls output is "root" !
ls
root

When you mount the btrfs partition without mentioning a subvolume, you are using the default subvolume, with ID 5.

To actually mount the root subvolume you need to mention it as a monut option:

mount -o subvol=root /dev/mapper/root /mnt

Comments