How to mount btrfs subvolume, it isn't working / mounting

I just did:

# btrfs subvolume create /@srv

then:

# btrfs subvolume list /
ID 257 gen 73 top level 5 path @
ID 258 gen 71 top level 5 path @home
ID 260 gen 65 top level 257 path @srv

And added to /etc/fstab, like this:

/dev/mapper/fs--1--vg-root /home btrfs defaults,compress=zlib,subvol=@home 0 2
/dev/mapper/fs--1--vg-root /srv btrfs defaults,compress=zlib,subvol=@srv 0 2

...where /home is the default that come from Ubuntu's installation and /srv is the one that I manually added, based on what I'm seeing "as an example (i.e., /home)".

But it does not mount, look:

# mount /srv
mount: mount(2) failed: No such file or directory

Subdir /srv exists:

# file /srv
/srv: directory

What am I missing?

BTW, the subvolumes @ and @home are okay. But I am unable to create more subvolumes and mount it, side by side with, for example, @home.

8

2 Answers

Looks like bug - I've stumbled across a similiar problem:

Mounting with subvolid= works.

This should work:

/dev/mapper/fs--1--vg-root /srv btrfs defaults,compress=zlib,subvolid=260 0 2

Just tried it and found out, that you should specify subvol=/@ or subvol=/@home – with a leading slash.

So, my working /etc/fstab with one automount and one manually mountable subvolume now looks like this:

/dev/sdb /backup btrfs noatime,nodiratime,subvol=/@ 0 0
/dev/sdb /snapshots btrfs noauto,noatime,nodiratime,subvol=/@snapshots 0 0

Before, I didn't use leading slashes and mount /snapshots failed. Now mount /snapshot works.

System:

# uname -a
Linux debian-9 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64 GNU/Linux
# btrfs --version
btrfs-progs v4.7.3
# btrfs subvolume list -up /backup
ID 258 gen 10 parent 5 top level 5 uuid b2740892-9b17-9147-b930-83de797d20df path @
ID 259 gen 8 parent 5 top level 5 uuid 10560ce1-b6f5-1248-94a0-c0a7734b804f path @snapshots

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like