Mounting subvolume as /srv


How to configure /etc/config/storage (or other config file) to mount subvolume of SSD (I have whole system running from SSD) as /srv?
When /srv is placed directly on root of SSD (@ subvolume) I have problems with snapshots (I ran out of space today, had to remove some snapshots).

mount-points are set in /etc/config/fstab

And how to apply this settings (without reboot)?
There is no block-mount package.

try /sbin/block mount

Ok, I coultn’t install block-mount, because lists were not updated:/
Now everything works.

It doesn’t work.
/sbin/block refuses to mount subvolume of already mounted device.

block: /dev/sda1 is already mounted on /

More info here:

I’ve modified /etc/init.d/fstab and added mount command just after block mount command.
It works (propably until next TurrisOS update, we’ll see).

I’ve modified /etc/init.d/srv to accept subvolume option in /etc/config/storage

--- srv.orig    2019-09-26 01:24:28.000000000 +0200
+++ srv 2019-10-05 11:51:39.916782285 +0200
@@ -40,12 +40,18 @@
                mkdir -p /srv

+       # Other subvolume?
+       config_get SUBVOL srv subvolume
+       if [ -z "${SUBVOL}" ]; then
+               SUBVOL='@'
+       fi
        # Mount it
        if [ "$(blkid "$DEV" -s TYPE -o value)" = ext4 ]; then
                mount -t ext4 -o noatime "$DEV" /srv || die "Can't mount $DEV as /srv"
                create_notification -n error "Your srv is ext4, you should convert to btrfs to enjoy all features"
-               mount -t btrfs -o subvol=@,noatime "$DEV" /srv || die "Can't mount $DEV as /srv"
+               mount -t btrfs -o subvol=${SUBVOL},noatime "$DEV" /srv || die "Can't mount $DEV as /srv"

        # Find root device

Now, with subvolume option, config is:

config srv 'srv'
        option uuid '9d09ad7a-5b41-45bf-9fd1-8f9f5f5a05b6'
        option subvolume '@srv'
1 Like

Would you please send us pull request, so we can review it, accept it and kept your ownership?

Please, do that for me. Ownership is not required.
I assume that You have this file somewhere on Your gitlab and I have no account there (and do not need another account:).

(and do not need another account:).

You can use for example github account. :wink:

Ok, can You point me, where is that file?

It’s this file:

It’s already created and sent to @cynerd