OpenVZ Forum


Home » General » Support » *SOLVED* Umount action script problem
*SOLVED* Umount action script problem [message #10715] Mon, 26 February 2007 23:29 Go to next message
mcarreira is currently offline  mcarreira
Messages: 30
Registered: February 2007
Member
I am trying to automate the access from VE to another disk using the "mount --bind" process.
I created two action scripts like these:

#/vz/sysconfig/vz-scripts/120.mount
#!/bin/bash
/bin/mount --bind /nova /vz/root/120/teste
exit $?

#/vz/sysconfig/vz-scripts/120.umount
#!/bin/bash
/bin/umount /vz/root/120/teste
exit $?

and they worked like I was expecing except for a little annoying behaviour:
If I start and stop VE several times, the mountpoint /nova is also unmounted.
Better explaining:

If I do for the first time:
# vzctl start 120
# vzctl stop 120

and then:
# ls -l /nova

I can see that the content list of "/nova" is still there.
But if I repeat the operation the "ls -l" don't show anything. Is empty, although /proc/mounts shows me that /nova is still mounted.

Is this a vzctl bug, or am I doing something wrong?

Thanks,

M.C.

[Updated on: Wed, 07 March 2007 07:30] by Moderator

Report message to a moderator

Re: Umount action script problem [message #10723 is a reply to message #10715] Tue, 27 February 2007 08:49 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
Hello,

Can you inform me, what kernel do you use?

Secondly, can you confirm this your phrase: "But if I repeat the operation the "ls -l" don't show anything. Is empty, although /proc/mounts shows me that /nova is still mounted."
I suspect, that you meant /etc/mtab, not this file.

Thanks,
Vasily
Re: Umount action script problem [message #10802 is a reply to message #10723] Fri, 02 March 2007 19:38 Go to previous messageGo to next message
mcarreira is currently offline  mcarreira
Messages: 30
Registered: February 2007
Member
I use Centos 4.4, and kernel from centos-4-default.
In fact, the file is /proc/mounts.
/etc/mtab not always is updated, so I rather trust /proc/mounts.
What I mean is that when I repeat the same operation using the script, the /nova is also unmounted unexpectedly (it doesn't happens the first time).

M.C.
Re: Umount action script problem [message #10813 is a reply to message #10802] Sun, 04 March 2007 08:08 Go to previous messageGo to next message
seyko2 is currently offline  seyko2
Messages: 188
Registered: February 2007
Location: Moscow
Senior Member

Hi! I'm a user. I meet this problem too. I use GENTOO.
My solution for this problem:

1) do not use symlinks to /proc/mounts in VE0 and VE
Contents of /etc/mtab in VE
 simfs / auto rw,noatime 0 0
 proc /proc proc rw 0 0
 sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0
 tmpfs /dev tmpfs rw,nosuid 0 0
 devpts /dev/pts devpts rw,nosuid,noexec 0 0
 none /dev/shm tmpfs rw 0 0


2) all binds are unmounted automatically when VE stops

Problem is in contents of VE0 /etc/mtab -- openvz do not edit this one when unmounts. Then there is global umount script which do not perform any real unmount. It only removes lines from /etc/mtab

/etc/vz/vps.umount
  #!/bin/bash
  # after stoping VE but before unmounting root area
  #!!! all mounted on /vz/root/${VEID} FS are unmounted automaticaly
  #echo vps.umount begin VEID=${VEID}
  #  umount /vz/root/${VEID}/usr/portage
  #  umount /vz/root/${VEID}/usr/portage-distfiles
  #  umount /vz/root/${VEID}/usr/portage-overlays
  sed -i -e "\|^.* /vz/root/${VEID}/.* .*|d" /etc/mtab
  #echo vps.umount end
  true
  exit ${?}
Re: Umount action script problem [message #10842 is a reply to message #10802] Mon, 05 March 2007 16:27 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
It's really very strange, what you're saying. I checked it on my node with 2.6.18-ovz and 2.6.9-ovz kernels and no luck to reproduce the problem. I can look at it more precisely, if you give me an access to the node in question.

Vasily
Re: Umount action script problem [message #10897 is a reply to message #10842] Tue, 06 March 2007 15:40 Go to previous messageGo to next message
seyko2 is currently offline  seyko2
Messages: 188
Registered: February 2007
Location: Moscow
Senior Member

How do you test it? I think key point there may be a _bind_ mount. Can you decribe _your_ test? A we try to reproduce it on our equipment...
Re: Umount action script problem [message #10903 is a reply to message #10842] Tue, 06 March 2007 23:23 Go to previous message
mcarreira is currently offline  mcarreira
Messages: 30
Registered: February 2007
Member
Thanks to Vasily precious help, the problem is corrected!
There are two critical points:
The script /vz/sysconfig/vz-scripts/120.mount must have the "-n" option, like:

#!/bin/bash
/bin/mount -n --bind /nova /vz/root/120/teste
exit $?

But the unmount script (/vz/sysconfig/vz-scripts/120.umount) MUST_NOT_EXIST!
I forgot that everything is unmounted during a shutdown.
Even with the "mount -n" option if the unmount script is used, we have problems after some more "start/stop".

M.Carreira
Previous Topic: *CLOSED* softirq stats for a VE
Next Topic: Package Group Installation.
Goto Forum:
  


Current Time: Mon Jul 22 21:30:23 GMT 2024

Total time taken to generate the page: 0.04234 seconds