Open main menu

OpenVZ Virtuozzo Containers Wiki β

Editing Bind mounts

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 5: Line 5:
 
CTID=777
 
CTID=777
  
echo '#!/bin/bash
+
cat << EOF > /etc/vz/conf/${CTID}.mount
 +
#!/bin/bash
 
. /etc/vz/vz.conf
 
. /etc/vz/vz.conf
 
. ${VE_CONFFILE}
 
. ${VE_CONFFILE}
Line 12: Line 13:
 
if [ ! -e ${VE_ROOT}${DST} ]; then mkdir -p ${VE_ROOT}${DST}; fi
 
if [ ! -e ${VE_ROOT}${DST} ]; then mkdir -p ${VE_ROOT}${DST}; fi
 
mount -n -t simfs ${SRC} ${VE_ROOT}${DST} -o ${SRC}
 
mount -n -t simfs ${SRC} ${VE_ROOT}${DST} -o ${SRC}
' > /etc/vz/conf/${CTID}.mount
+
EOF
  
 
chmod +x /etc/vz/conf/${CTID}.mount
 
chmod +x /etc/vz/conf/${CTID}.mount
Line 21: Line 22:
 
{{Note|When specifying destination directory, always use /vz/root/ or ${VE_ROOT} env. variable <nowiki>(avoid using /vz/private)</nowiki>}}
 
{{Note|When specifying destination directory, always use /vz/root/ or ${VE_ROOT} env. variable <nowiki>(avoid using /vz/private)</nowiki>}}
 
{{Note|When binding directories from one container to another, make sure you have proper boot order (See [[Man/vzctl.8|BOOTORDER]] param.)}}
 
{{Note|When binding directories from one container to another, make sure you have proper boot order (See [[Man/vzctl.8|BOOTORDER]] param.)}}
 
 
'''Instruction above will not work on OpenVZ 7 until you run the script below to enable Bind mounts:'''
 
 
<source lang="bash">
 
cat <<'EOF' > /etc/vz/conf/vps.mount
 
#!/bin/bash
 
. ${VE_CONFFILE}
 
VE_MOUNT=$(echo ${VE_CONFFILE} | sed 's/\.conf$/.mount/')
 
[ -x ${VE_MOUNT} ] && . ${VE_MOUNT}
 
exit 0
 
EOF
 
 
chmod +x /etc/vz/conf/vps.mount
 
</source>
 
  
 
== See also ==
 
== See also ==

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Templates used on this page: