How are subvolumes and disks mounted without fstab?

I was poking around my NAS when I decided to check out how /etc/fstab was laid out since the whole subvolume creation/mounting process was automated through the Shares tab in the GUI. When I checked it out, however, it only had my root mount points, and nothing from my data drives, which were mounted under /mnt2. So I’m wondering what is going on in the background to automatically mount the drives and subvolumes. Thanks for any help.

@KVB Hello again.

We do it programatically. That way we can do mounts as and when we please. This gives us more control over such things and avoids race conditions that may apply if we are trying to ‘fiddle’ with existing system managed volumes.

Take a look at the following file:
https://github.com/rockstor/rockstor-core/blob/master/src/rockstor/fs/btrfs.py
for the ‘stuff’ we need to do.

It may well be that in the future we do the actual mount via say systemd but it currently has some issues with btrfs mounts particularly in the case of mult-device setups where for example one device is missing. So we leave the system drive’s functional mount to fstab and we do the exploration mount of the system drive for our own purposes. Plus all data drives are entirely under our mount regime. Oh and I don’t think systemd existed when we started!

As the systemd / btrfs ‘rift’ closes we can approach moving to using systemd to do our actual mounts and just instruct systemd (via fstab) accordingly.

Hope that helps.

2 Likes

I see, thanks for the reply. I didn’t expect for such a custom approach to have been taken, but if systemd is unreliable with multi-device btrfs mounting, I guess it’d be necessary to do so. Helps show how much work was put into this project that most end users probably won’t know exists.

4 Likes