OpenVZ Forum


Home » General » Support » vps.mount and vps.unmount
vps.mount and vps.unmount [message #21973] Thu, 18 October 2007 10:21 Go to next message
belkhal is currently offline  belkhal
Messages: 9
Registered: October 2007
Junior Member
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
Re: vps.mount and vps.unmount [message #22102 is a reply to message #21973] Sat, 20 October 2007 09:09 Go to previous messageGo to next message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
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
Re: vps.mount and vps.unmount [message #22103 is a reply to message #22102] Sat, 20 October 2007 09:21 Go to previous message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
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
Previous Topic: 3 crashes today -
Next Topic: Howto set static MAC for bridge device?
Goto Forum:
  


Current Time: Wed Nov 13 18:54:16 GMT 2024

Total time taken to generate the page: 0.02966 seconds