2

On the btrfs wiki page about subvolumes it says that by default, at creation of a btrfs (i.e make.btrfs <devicenode>) a top level subvolume with an subvolume ID=5 is created.

A freshly created filesystem is also a subvolume, called top-level, internally has an id 5. This subvolume cannot be removed or replaced by another subvolume.

I tried hence showing this subvolume using the btrfs subvolume list -a /btrfs.mountpoint, but it does not show up, why?

update In an attempt of (self-help) I tried to find out more about this top-level subvolume ID=5, which is (as stated) above created. I hence tried to mount to real btrfs root (which I supposed to be subvolume id=0) and look at its content like this:

# mount a specific subvolume of a btrfs 
$> mount -t btrfs -o subvolid=0 /dev/sda /mnt
# show the output of the "."-entry of the subvolume-root (show inodevalue)
$> ls /mnt -lai | head -n 2
total 112656
 256 drwxr-xr-x  1 root root      432 May 25 09:08 .

after unmounting again I did the same (using this time the subvolume ID=5)

# mount a specific subvolume of a btrfs 
$> mount -t btrfs -o subvolid=5 /dev/sda /mnt
# show the output of the "."-entry of the subvolume-root (show inodevalue)
$> ls /mnt -lai | head -n 2
total 112656
 256 drwxr-xr-x  1 root root      432 May 25 09:08 .

and it produces the very same output (just like the subvolume ID=5) was the root subvolume and ID=5 at the same time. Maybe this shows some light why it does not show up with btrfs subvolume list -a command?

Anyway since even the root volume is assigned a subvolid (at least for use with mount) it seems odd that nothing shows up at btrfs subvolume list -a.

(update corrected, the mistake of pasting the wrong btrfs subvolume command)

update2

the man pages for the btrfs and the btrfs-progs and the cited wiki page (see beginning of question), are not very precise in laying out how in terms of filesystem volumne-root, subvolume, subvolids.... btrfs is created.

According do some explaining on the mailing list it is that:

[a]ll subvolumes are accessible from the volume mounted when you use -o subvolid=0. (Note that 0 is not the real ID of the root volume, it's just a shortcut for mounting it.) [emphasis added] (source https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg17141.html)

this leads me to believe that, despite the first citation the subvolume id 5 is the root (at least in my case).

Anyway some years ago the btrfs mailing list showed a case where not even all ordinary snapshots have been correctly reported by btrfs subvolume list , making me believe that there is also the possibility that all the problem of not showing the subvolume could be a bug.

More so then ever I would appreciate somebody shading some light on this, in an answer to this question.

  • Yeah, it is strange. I had the same problem. The first subvolume I create has the id 5. The main file system has no subvolume number. – zkilnbqi Sep 17 '17 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.