How to add mount in /etc/fstab?

Silverblue and mounting an additional file system via fstab (or is there another possiblity?)

I have added another btrfs subvol which I want to mount at, say /var/data, and additionally I want to access it via /data

I did the following under root

mkdir /var/data
chattr -i /
cd /
ln -s var/data data
chattr +i /

Then rebooted and both symlink and /var/data directory do exist.

Now I wanted to have this mounted in fstab. I added an entry for mounting the subvol

UUID=a0d300df-97b2-40a6-b8fa-f16a201a365e /var/data      btrfs   subvol=data    0 0

but then the system didn’t boot any longer.

How can I do this? Thank you.

1 Like

I just assume that via /etc/fstab an additonal mount isn’t possible. Now, trying to figure out how to configure systemd-mount. I created a file var-data.mount in /etc/systemd/system but systemctl status var-data.mount tells me Unit var-data.mount could not be found.

systemctl daemon-reload

Thanks.

I did

systemctl daemon-reload
systemctl list-unit-files -t mount

The latter gave

...
var-data.mount                bad       disabled  
...

which indicates that the content of var-data.mount is wrong.

Here it is

[Unit]
Description=Mount /var/data
After=var-home.mount

[Mount]
What=/dev/disk/by-uuid/a0d300df-97b2-40a6-b8fa-f16a201a365e
#What=/dev/vda2
Where=/var/data
Type=btrfs
Options=subvol=data

[Install]
WantedBy=multi-user.target

Any idea what is wrong here?

1 Like

systemd-analyze verify FILE

Thanks. Didn’t know that.

Running it systemd-analyze verify var-data.mount yields

/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/alsa-restore.service:15: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
/usr/lib/systemd/system/mcelog.service:8: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.

which doesn’t really help.

sudo systemctl restart var-data.mount
sudo journalctl --no-pager -u var-data.mount

Thanks a lot. The second command helped.

Got

var-data.mount: Failed to open /etc/systemd/system/var-data.mount: Permission denied

Then it occured to me that I forgot to check label.

restorecon -v var-data.mount

and now all is ok.

2 Likes

I don’t see any Btrfs subvolumes created. Have you done this before?
That way you created only the “data” folder.
Example: btrfs subvolume create /var/data
In this case, which is a nested subvolume, there is no need to specify it on “/etc/fstab”
To list the subvolumes: sudo btrfs subvolume list /
Hope to be of help.

Yes, I had created the subvolume before but not nested.

1 Like

Thanky you @emanuc for pointing to nested subvolumes which simplifies the situation.

But I should add that the real problem I had is how to add mount(s) for a second SSD.