4

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.

  • Does the subdirectory /srv exists? mount needs the target directory to already exist before the partition/subvolume can be mounted there. – Lie Ryan Feb 15 '15 at 1:27
  • Yes, /srv is somehow a "default" directory that always exists in a fresh install. – ThiagoCMC Feb 15 '15 at 2:07
  • So, this might be a BUG. But against which package should I register it at Launchpad.net? – ThiagoCMC Feb 19 '15 at 15:36
  • Why do you seem to be mounting an LVM VG (volume group)? Shouldn't you be mounting an LV (logical volume)? I'm currently not at my workstation that has LVM and BTRFS right now, so I can't check whether the mapper name should look like (/dev/mapper/fs--1--vg-root), but they look odd. If I recall correctly, in my workstation the BTRFS is mounted with the LV's UUID. I believe you can also mount with the /dev/vgblah/lvbleh, but I've never tried mounting it with /dev/mapper. From a quick search, the naming convention used by device mapper for an LV seems to be /dev/mapper/vgblah-lvbleh. – Lie Ryan Feb 19 '15 at 16:46
  • Hey Ryan! I've updated the question, I added the /home partition that come from installation, I've used it as an example, and it mounts using /dev/mapper, so, I tried to copy it as an example. Still doesn't work... I'm wondering here... Are you able to mount a BTRFS subvolume created by you after the installation? – ThiagoCMC Feb 20 '15 at 0:58
0

Looks like bug - I've stumbled across a similiar problem: https://unix.stackexchange.com/q/190698/34801

Mounting with subvolid= works.

This should work:

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

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

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.