You will also, after mounting the drive on the host, need to mount the directory in the LXC.
Bind Mount the Directory to the LXC Container
You’ll need to edit the LXC container’s configuration file to set up the bind mount. The configuration file is usually located at /etc/pve/lxc/<vmid>.conf
, where <vmid>
is the ID of your LXC container.
You can add a line to the configuration file:
mp0: /mnt/data,mp=/data
This line means that the host directory /mnt/data
will be mounted to /data
inside the container.
You can add this line by editing the file with a text editor or by running the following command:
echo "mp0: /mnt/data,mp=/data" >> /etc/pve/lxc/<vmid>.conf
Make sure to replace <vmid>
with the actual ID of your LXC container.
After this, restart the LXC container to apply the changes:
pct stop <vmid>
pct start <vmid>
Inside the container, you should now see the host’s /mnt/data
directory mounted as /data
.