lxc.hook.pre-start script for mounting drives on host

Patrik Stenfeldt

New Member
Jan 6, 2019
I have setup a container with smbd to host files on my home network.

And i have another container that need access to those files.
The way i want to do that is to cifs mount the share on the host and then use it as a mountpoint in the new container.

Everything works perfectly when i start everything manually.

Now i want everything to be able to start automaticly.
Since the container is started after the host i cant add it in the hosts fstab, so i came up with the idea that when container2 starts i just add a lxc.hook.pre-start to execute a script that mounts the share.

The script works when i run it from console on host and if i start the container with the hook, according to logs, the script is executed. But the mount is never mounted.

Are there restrictions to what an lxc hook is allowed to do?
I have a LXC container which needs underlying ZFS mounts. These are on an encrypted pool, so I've been struggling to find a way to mount them at the right point.

In short, one of the things I tried was a hook script to unlock the ZFS pool but the hookscript will not get executed, because PVE will attempt (and fail) to mount the ZFS vols before it runs the hook script.

@proxmox - would be nice if we could have a phase pre-mount in the hookscript to enable this sort of thing.


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!