OpenVZ Forum - RDF feed
type: channel
items: *SOLVED* strange mount/umount issues
items: Re: strange mount/umount issues

*SOLVED* strange mount/umount issues
type: item
description: I've got several VEs, one is for light web server as frontend ( nginx ) and some VE with user's apaches/other stuff ( backends ) One of users wanted to view frontend logs, so i decided to mount dir from FRONTEND to BACKEND. veid 1010 is FRONTEND, and veid 1600 is BACKEND. 1600.mount is: root@nekobus:/etc/vz/conf# cat 1600.mount #!/bin/bash # Mount script to bind-mount /var/something into a VPS [ -f /etc/vz/vz.conf ] || exit 1 [ -f $VE_CONFFILE ] || exit 1 . /etc/vz/vz.conf . $VE_CONFFILE echo -n "mounting nginx logs inside pnoenix..." if [[ -d $NGINX_DIR/var/log/nginx/phoenixlogs ]] then mount --bind $NGINX_DIR/var/log/nginx/phoenixlogs $VE_ROOT/home/phoenix/nginx-logs echo " done" else echo " failed" fi where NGINX_DIR is path to FRONTEND's root ( /var/lib/vz/root/1010/ ) Then I start BACKEND and mount script works, we can see: root@nekobus:/etc/vz/conf# vzctl exec 1600 mount|grep nginx simfs on /home/phoenix/nginx-logs type simfs (rw) root@nekobus:/etc/vz/conf# mount |grep nginx /var/lib/vz/root/1010/var/log/nginx/phoenixlogs on /var/lib/vz/root/1600/home/phoenix/nginx-logs type none (rw,bind) then i stop BACKEND and my umount script is: root@nekobus:/etc/vz/conf# cat 1600.umount #!/bin/bash # Mount script to bind-mount /var/something into a VPS [ -f /etc/vz/vz.conf ] || exit 1 [ -f $VE_CONFFILE ] || exit 1 . /etc/vz/vz.conf . $VE_CONFFILE umount $VE_ROOT/home/phoenix/nginx-logs exit 0 stopping VE: root@nekobus:/etc/vz/conf# vzctl stop 1600 Stopping VE ... VE was stopped umount: /var/lib/vz/root/1010/var/log/nginx/phoenixlogs: not mounted umount: /var/lib/vz/root/1010/var/log/nginx/phoenixlogs: not mounted VE is unmounted while umount complains, path is unmounted: root@nekobus:/etc/vz/conf# mount|grep nginx|wc -l 0 If i comment out "exit 0" and try to stop VE, i see: root@nekobus:/etc/vz/conf# vzctl stop phoenix Stopping VE ... VE was stopped umount: /var/lib/vz/root/1010/var/log/nginx/phoenixlogs: not mounted umount: /var/lib/vz/root/1010/var/log/nginx/phoenixlog…
creator: coolcold
date: 2007-05-07T15:18:34-00:00

Re: strange mount/umount issues
type: item
description: Hello it's known issued. Use 'Search' at the forum and you'll find the answer Vasily.
creator: Vasily Tarasov
date: 2007-05-08T10:25:20-00:00

Re: strange mount/umount issues
type: item
description: I have the same problem but I couldn't find a solution on the forum. Which post describes the solution for this issue?
creator: heruan
date: 2007-05-27T10:45:29-00:00

Re: strange mount/umount issues
type: item
description: OK, I can't find appropriate posts at the moment either! So I explain the problem once again. The thing is that when you produce mount command on HN (e.g. from 101.mount script), the entry in /etc/mtab on HN appears. Later when VE stops all mount points in VE are umounted automatically even _without_ umount script. But the entry in /etc/mtab is still there! It makes mount a bit crazy... So, you should use `mount -n` in mount script and don't use umount script at all. HTH, Vasily.
creator: Vasily Tarasov
date: 2007-05-27T11:23:20-00:00

Re: strange mount/umount issues
type: item
description: Perfectly clear, thanks! I'll try asap.
creator: heruan
date: 2007-05-27T12:19:22-00:00