Mount multiple btrfs subvolumes from same device

Hi all,

I’m using an external hdd holding two btrfs subvolumes. I added the disk to /etc/config/fstab two times each having the subvolume as their respective option.

config mount
	option enabled '1'
	option uuid 'XXXXXXXX-36eb-47bb-b0b8-3caXXf6bd700'
	option options 'subvol=lxc'
	option target '/srv/lxc'

config mount
        option enabled '1'
        option uuid 'XXXXXXXX-36eb-47bb-b0b8-3caXXf6bd700'
        option options 'subvol=data'
        option target '/mnt/extern0'

However, turris only mounts the data subvolume but not both. This seems like a bug to me? How can I fix it?

Thanks for help.

It depends on when you need to mount points available. You can mount them manually through rc.local script. However this is executed as the last one so if you need the disk earlier than it might not work.

So I created my own startup script where I mount the subvolumes. it looks like:

#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org

START=19

start() {
        /usr/bin/mount -t btrfs -o commit=5,subvolid=258 /dev/sda /srv/lxc/var
        /usr/bin/mount -t btrfs -o commit=5,subvolid=259 /dev/sda /srv/omnia-logs
}

stop() {
        /usr/bin/umount /srv/lxc/var
        /usr/bin/umount /srv/omnia-logs
}

you create the file in /etc/init.d and then you enable it.

1 Like

Hi Thanks for your answer. I need them available before lxc-auto tries to start the containers.

I’m still wondering why block mount refuses to mount the second subvolume?

I don’t know exactly why but when you look at https://wiki.openwrt.org/doc/uci/fstab there is a comment:

BTRFS, JFS, UBI, XFS and potentially other (F2FS…) are not supported in /etc/config/fstab. Use manual scripting.

Trying to figure out the same thing guys…

Turris only mounts the last instance of the device from the /etc/config/fstab which is pretty anoying. If there only was a possibility to use standard /etc/fstab instead :).