playing around with a btrfs (4.4) machine (server 16.04) I ran into this


ubuntu server 16.04 installed on btrfs with standard subvolumes for / and home

what I want to achieve

put /var into it's own subvolume (on the same harddrive for now)

what I did

  1. sudo mkdir /subvol
  2. sudo btrfs subvolume create /subvol/var
  3. sudo rsync -azv /var/* /subvol/var/
  4. create a line in /etc/fstab for the subvolume (which I have copied from the existing line for the @home subvolume. It looks like this
    UUID=79a74d84-2f0e-4098-9c58-f721eab913ee /mnt/var btrfs \ defaults,compress=lzo,subvol=@var 0 2

  5. sudo mount -a

expected behavior

the new subvolume var (located in /subvol/var) get's mounted on /var

actual behavior

:~$ sudo mount -a mount: mount(2) failed: No such file or directory

Not sure whether the approach generally is good. It's the idea I could come up with. Any hints what my problem here is?


As per the btrfs section on the ubuntu wiki (presuming that layout is still applicable), the default setup is a btrfs root containing the @ and @home submvolumes.

/subvol/var is here presumably created inside the mounted @ and hence its path relative to the btrfs root (subvolid=5) would be <FS_TREE>@/subvol/var, instructions below are based on this assumption.

So you probably either want to move the subvolume to <FS_TREE>/@var, via something like

mnt -o subvolid=5 /mnt
mv /mnt/@/subvol/var /mnt/@var
umount /mnt

and keep the fstab entry as it is.

Or, edit the fstab entry to match the current location

UUID=79a74d84-2f0e-4098-9c58-f721eab913ee  /mnt/var btrfs \
defaults,compress=lzo,subvol=@/subvol/var   0   2

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.