I have a particular partition /dev/sdb6 that is mounted in the HWN as /share: /dev/sdb6 on /share type ext3 (rw) I am trying to bind mount this within all my VE's as a global shared directory. This works: # vzctl start 101 # mount --bind /share /vz/root/101/share # vzctl exec 101 ll /share dr-------- 2 root root 4096 2007-10-17 23:29 keys -rw-r--r-- 1 root root 922 2007-10-18 00:02 sources.list # umount /vz/root/101/share # vzctl exec 101 ll /share total 0 # vzctl stop 101 This also works: # vzctl mount 101 # mount --bind /share /vz/root/101/share # ll /vz/root/101/share dr-------- 2 root root 4096 2007-10-17 23:29 keys -rw-r--r-- 1 root root 922 2007-10-18 00:02 sources.list # umount /vz/root/101/share # ll /vz/root/101/share total 0 # vzctl umount But, for some reason, this doesn't work: /etc/vz/conf/vps.mount #!/bin/bash mount --bind /share /vz/root/101/share exit ${?} /etc/vz/conf/vps.umount #!/bin/bash umount /vz/root/101/share exit ${?} It works okay when mounting/starting the VE; however, when I stop/umount the VE, I get an error that says: Stopping VE ... VE was stopped /dev/sdb6 umounted could not umount /vz/root/101/share - trying /share instead umount: /share: not mounted could not umount /vz/root/101/share - trying /share instead umount: /share: not mounted Error executing umount script /etc/vz/conf/vps.umount It actually umounts the /share on my HWN and then errors out. Then, since the script returns an error, the VE's private area is never umounted from /vz/root/101. Anyone know what's wrong? Does a VE automatically remove its own mounts when shutting down? Thanks
Hello belkhal, Some distributions umounts / partition on stopping. Probably in your case /share inside VE may be not mounted when vps.umount script is executed. Therefore I would like to advise you to add such check to your vps.umount script. However I do not understand why /dev/sda6 is umounted. Following string lloks strange for me too: "could not umount /vz/root/101/share - trying /share instead" Could you please add some additional debug checks to you script too? Thank you, Vasily Averin
I've found that Vasily Tarasov has investigated this issue already: http://forum.openvz.org/index.php?t=msg&goto=15183&& amp;srch=could+not+umount#msg_15183 VE really umounts /share partition on stop, but according string is still present in /etc/mtab file on host node. Due this reason vps.umount script umounts real device instead its bind-mounted copy. Vasily recommends to use "-n" in vps.mount script and not use vps.umount script at all. thank you, Vasily Averin