This one is really easy once you know it, so I like to share it with you. I wanted to move a shared directory from our storage server to a container on proxmox; However I don’t want to add ~4TB on data to my regular backup, so I thought a NFS service would be needed; seems its not ! You can simply mount a directory to your -running- container!


mount --bind LOCAL_DIR /var/lib/vz/root/114/INSIDE_CONTAINER

LOCAL_DIR : that’s the directory on the “host” node, for me this was /data/groups
INSIDE_CONTAINER : that’s the directory inside the container starting from / : root so  /var/lib/vz/root/114/media/groups/ inside the container linked to /media/groups

This probably won’t survive a reboot; So I added this to /etc/vz/conf/114.mount

sources :

#!/bin/bash
source /etc/vz/vz.conf
source ${VE_CONFFILE}
mount -n --bind /data/groups ${VE_ROOT}/media/groups

serverfault
bind mounts in openvz man
topic question @ openvz