openvz: mount folder from host to guest

Find folder with files $cid.conf (101.conf, 1002.conf, etc.), for me it's /etc/vz/conf

and create small shell scrtipt there:

1
2
3
4
5
6
7
8
9
10
#!/bin/bash
. /etc/vz/vz.conf
. ${VE_CONFFILE}
SRC=/path/to/folder/on/host
DST=/path/to/folder/on/guest
if [ ! -e ${VE_ROOT}${DST} ]
then
mkdir -p ${VE_ROOT}${DST}
fi
mount -n -t simfs ${SRC} ${VE_ROOT}${DST} -o ${SRC}

restart container.