[STEP 1] create the destination directory in the container:
in this example, I am mounting /mnt/<name> from hardware node to /data_ssd in container
mkdir /data_ssd
chmod -R 777 /data_ssd
shutdown the container:
shutdown -h now
[STEP 2] prepare the mount to whatever partition you would like to access (ON HARDWARE NODE)
on the proxmox HN:
mkdir /mnt/<name> (name example 'ssd_shared')
chmod -R 777 /mnt/<name>
in this example I am mounting an LVM partition called lvm_ssd.
lets make sure the partition will be mounted automatically on HN boot.
blkid (copy the UUID of the newly created LVM partition)
Then make sure your fstab file has the following entry:
nano /etc/fstab
UUID=<uuid> /mnt/<name> ext4 defaults,noatime,nodiratime,noacl,data=writeback,barrier=0,nobh,discard,errors=remount-ro 0 2
To make sure the fstab setting work, execute the command below to auto-mount all fstab entries
mount -a
[STEP 3] setup the container's configuration file to allow container to access the shared mount
cd /etc/pve/openvz
nano <ctid>.mount (ctid is the container ID for example 112)
#!/bin/bash
. /etc/vz/vz.conf
. ${VE_CONFFILE}
SRC=/mnt/<name>
DST=/data_ssd
if [ ! -e ${VE_ROOT}${DST} ]; then mkdir -p ${VE_ROOT}${DST}; fi
mount -o noatime -n -t simfs ${SRC} ${VE_ROOT}${DST} -o ${SRC}
[STEP 4] Test by starting the container
once container has started back up, execute the 'mount' command to see all your mounted partition in your container. Mine looks like this:
/mnt/md0/private/112 on / type simfs (rw,relatime)
/mnt/ssd_shared on /data_ssd type simfs (rw,noatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
none on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
none on /run type tmpfs (rw,nosuid,noexec,relatime,size=419432k,mode=755)
none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
none on /run/shm type tmpfs (rw,relatime)
The one I highlighted in yellow is the /mnt/ssd_shared (from HN) that was already mounted to /data_ssd inside container 112.
You can also use 'df' (disk free) command to check the available disk space, mine looks like this:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/simfs 167772160 113525032 54247128 68% /
/dev/simfs 16513960 4398600 11276500 29% /data_ssd
none 419432 996 418436 1% /run
none 5120 0 5120 0% /run/lock
none 2097152 0 2097152 0% /run/shm
You are done!