3

I've got a big old BTRFS RAID array with a few subvolumes:

# btrfs subvolume list -u /bulk
ID 256 gen 56429 top level 5 uuid 11b16b2e-8f75-ec46-8cgd-4a001c70a4ba path @
ID 257 gen 56428 top level 256 uuid 0c81c066-dge1-464d-bd50-6f56e9d83e0a path @mine
ID 258 gen 56430 top level 256 uuid 6139b708-3226-324b-8bae-9eb810cfd226 path @shared

The root subvolume, @, is mounted at bulk, via fstab I'd like to have the @mine subvolume mounted at some point in my home dir, but for some reason it keeps failing:

# mount -t btrfs -o subvol=/@mine,defaults,nossd,user /dev/sdd2   /home/me/bulk
mount: /home/me/bulk: mount(2) system call failed: No such file or directory.
       dmesg(1) may have more information after failed mount system call.

Interestingly, the main subvolume has no such issues:

# mount -t btrfs -o subvol=/@,defaults,nossd,user /dev/sdd2   /home/me/bulk

The above works directly, no complaints. The same issue happens when I try to mount via /etc/fstab. I also tried when mounting via the UUID, and the subvolume UUID is not found at all, and @share shows exactly the same behaviour.

If I mount @ instead of the subvolume, I can access everything normally, including the subvolumes, as a user, without any read/write issues -- but I'd really prefer to have just the specific subvolume mounted in my home dir, and I'm pretty sure that it must be possible. (and yes, I unmounted `/@' immediately after mounting it, so the mountpoint was empty)

Are there any particular options which are required to mount a subvolume, compared to the root?

In case this is relevant: I'm on Manjaro Plasma, kernel version 5.15.109-1-MANJARO

0

1 Answer 1

4

The subvolume listing is a little misleading, at least to me. The correct way to address the subvolumes is /@/@mine etc.. The hint was in the subvolume listing which shows that:

ID 256 gen 56429 top level 5 uuid 11b16b2e-8f75-ec46-8cgd-4a001c70a4ba path @
ID 257 gen 56428 top level 256 uuid 0c81c066-dge1-464d-bd50-6f56e9d83e0a path @mine

Note the top level 256 in the second line, which indicates that @mine is nested within @ (which has ID 256).

The correct mount command was therefore

mount -t btrfs -o subvol=/@/@mine,defaults,nossd,user /dev/sdd2   /home/me/bulk

...and that's it, done.

For completeness sake, this is the corresponding line I've put in /etc/fstab, and it works, too:

UUID=xxxUIDxxx-ofthe-btrfs-rootxxx /home/me/bulk btrfs subvol=/@/@mine,defaults,nossd,user 0 0

I'm mounting by UUID because mounting by device (e.g. /dev/sdd2) can fail if other drives are added or removed. I've also learned since that the subvolume UUIDs shown by btrfs subvolume list are only accessible to some btrfs commands but cannot be used otherwise, hence the mount command needs to address the root and then provide the subvolume path.

2
  • 1
    I guess an alternative way is with subvolid=256 instead of subvol=…. The subvolume listing is not misleading in this matter. Especially in case of many, many nested subvolumes it will be way easier to use the ID of the subvolume you're after instead of building the path backwards node by node. May 14 at 5:47
  • Thanks, @KamilMaciorowski. I read somewhere to prefer subvol over subvolid, but I can't find the source right now. I believe it had to do with snapshots, which are created and removed, or switched out when reverting to previous versions, in which case a different subvolid becomes associated with a given subvolume path. At least for testing, it can be pretty helpful, though.
    – Zak
    May 17 at 9:55

You must log in to answer this question.

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