I have a ZVOL created on the host and partitioned so that I end up with /dev/zd0p1 which I’ve then formatted with ext4 . I have exported this to a container with:
this works fine and on the container I can mount /dev/zd0p1 and write to it no problem.
However I cannot get it to mount when the container is started, even if I put it in /etc/fstab it won’t automatically mount (it uses defaults option so it implies auto and mount at boot).
what am I missing? both host and container are ubuntu 16.04, lxd 2.16.
fwiw I solved the problem by creating a systemd mount file for my device. The core issue seems to be with systemd-fstab-generator which is in charge of creating necessary mount unit files from fstab and is not working.
In my case I added the following to /etc/systemd/system/nethomes.mount:
I then enabled it with systemctl enable nethomes.mount and after restarting the container the zvol was correctly mounted. Please note, the filename must match your mountpoint to work.
I referred to these two links to figure out systemd stuff (I’m completely new to it):