OpenVZ Forum


Home » General » Support » *SOLVED* Sharing /home between vps, nfs/bind mount not working?
*SOLVED* Sharing /home between vps, nfs/bind mount not working? [message #4942] Fri, 04 August 2006 10:14 Go to next message
xinhes is currently offline  xinhes
Messages: 6
Registered: August 2006
Location: Sundsvall, Sweden
Junior Member
I can't find a working solution to having /home shared between vps servers.

Here is what i have tested:
# mount -o bind /vz/home /vz/private/1002/home
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md0 4032000 1372192 2454988 36% /
none 451656 0 451656 0% /dev/shm
/dev/md2 4032000 186900 3640280 5% /var
/dev/md3 1186166788 527048520 598864508 47% /vz
/vz/home 1186166788 527048520 598864508 47% /vz/private/1002/home
# vzctl exec 1002 ls -la /home
total 8
drwxr-xr-x 2 root root 4096 Aug 4 12:00 .
drwxr-xr-x 24 root root 4096 Aug 3 16:10 ..
-- Sad --

As you can se the bind mounted dir does'nt show up in the vserver it's not supposed to be empty.

Well, next thing to try is to bind mount before starting the vps. Then this happens:
# mount -o bind /vz/home /vz/private/1002/home
# vzctl start 1002
Starting VPS ...
vzquota : (error) Quota on syscall for 1002: Device or resource busy
vzquota on failed [3]
-- Crying or Very Sad --
I have also tried to drop vzquota so its gets recalucated at startup but it still refuses to start with "Device or resource busy"

Anyone got a clue why vzquota complains and refuses to start when I have bind mounted into te vps server?

So I could use nfs then?

No, that also fails because rpc.nfsd refuses to start in the ovkernel like this:
]# uname -a
Linux XXX 2.6.16-026test015.2 #1 Fri Jul 14 16:09:51 MSD 2006 i686 athlon i386 GNU/Linux
# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [FAILED]
Starting NFS mountd: [ OK ]
-- Confused --

Anyone got a clue on how I should proceed?
One solution would be to move /home to another nfs server. But then I'd have to dedicate one server for that purpose.

I have just started converting this server from vserver to openvz and the bind mounts worked fine with vserver.

[Updated on: Fri, 04 August 2006 11:27] by Moderator

Report message to a moderator

Re: Sharing /home between vps, nfs/bind mount not working? [message #4944 is a reply to message #4942] Fri, 04 August 2006 10:35 Go to previous messageGo to next message
Andrey Mirkin is currently offline  Andrey Mirkin
Messages: 193
Registered: May 2006
Senior Member
Start VPS and try this:

# mount -o bind /vz/home /vz/root/1002/home


You can also use 1002.mount/1002.umount scripts to do this mount/umount on start/stop VPS.


Andrey Mirkin
http://static.openvz.org/userbars/openvz-developer.png
Re: Sharing /home between vps, nfs/bind mount not working? (Solution HERE) [message #4946 is a reply to message #4944] Fri, 04 August 2006 11:22 Go to previous messageGo to next message
xinhes is currently offline  xinhes
Messages: 6
Registered: August 2006
Location: Sundsvall, Sweden
Junior Member
Ahh, A simple case of RTFM

Mount/Umount scripts worked just fine:

Since each user usually gets one vps in my setup. I only have to mount one home in each vps. So for the ftp server (vps 1001) it goes like this:

1001.mount:
#!/bin/sh
mount -o bind,ro /vz/home/ftp /vz/root/$VEID/home/ftp

1001.umount:
#!/bin/sh
umount /vz/root/$VEID/home/ftp

#vzctl ecec 1001 df
Filesystem 1K-blocks Used Available Use% Mounted on
simfs 10000000 162724 9837276 2% /
ext3 1186166788 527050296 598862732 47% /home/ftp

OPS, Just noted that bind mounts arent Read-Only. Put that up on the feature wishlist Smile

[Edit]
After fiddling with mount/umount scripts a while I created a global mount/umount script. This means I only have one file to edit and all other files are links to this file. More like automount which im used to. Hardlink vps.umount to this script also:

/etc/sysconfig/vz-scripts/vps.mount:

#!/bin/sh
# Mount/Umount script for vz servers

CMD=${0/*./}
BASEDIR=/vz

# Pull in VPS settings, especially (VE_ROOT)
[ -f /etc/sysconfig/vz ] || exit 1
[ -f $VE_CONFFILE ] || exit 1
. /etc/sysconfig/vz
. $VE_CONFFILE

# Configure directories to be mounted per VPS here
VPSDIRS="\
1001:home/ftp\
1002:home\
"

for m in $VPSDIRS; do
VPS=${m/:*/}
VPH=${m/*:/}
if [ "$VEID" == "$VPS" ]; then
if [ "$CMD" == "mount" ]; then
mount -o bind $BASEDIR/$VPH $VE_ROOT/$VPH
else if [ "$CMD" == "umount" ]; then
umount $VE_ROOT/$VPH
fi fi
fi
done

[Updated on: Mon, 07 August 2006 16:37]

Report message to a moderator

Re: Sharing /home between vps, nfs/bind mount not working? (Follow up Q about vzquota) [message #4949 is a reply to message #4946] Fri, 04 August 2006 11:38 Go to previous messageGo to next message
xinhes is currently offline  xinhes
Messages: 6
Registered: August 2006
Location: Sundsvall, Sweden
Junior Member
I had to turn off user quota on the ext3 filesystem when I converted this server to openvz. So now I have lost quotas on the home directories.

The question is. Can simfs be used to do something like the bind mount. Thus enabling some form of quota on the "bind" mounted home?

[Updated on: Fri, 04 August 2006 11:39]

Report message to a moderator

Re: Sharing /home between vps, nfs/bind mount not working? [message #4982 is a reply to message #4946] Mon, 07 August 2006 13:59 Go to previous message
aistis is currently offline  aistis
Messages: 77
Registered: September 2005
Location: Kaunas, Lithuania
Member

xinhes wrote on Fri, 04 August 2006 14:22

Ahh, A simple case of RTFM

Mount/Umount scripts worked just fine:

Since each user usually gets one vps in my setup. I only have to mount one home in each vps. So for the ftp server (vps 1001) it goes like this:

1001.mount:
#!/bin/sh
mount -o bind,ro /vz/home/ftp /vz/root/$VEID/home/ftp

1001.umount:
#!/bin/sh
umount /vz/root/$VEID/home/ftp

#vzctl ecec 1001 df
Filesystem 1K-blocks Used Available Use% Mounted on
simfs 10000000 162724 9837276 2% /
ext3 1186166788 527050296 598862732 47% /home/ftp

OPS, Just noted that bind mounts arent Read-Only. Put that up on the feature wishlist Smile



try using this patch:

http://bugzilla.openvz.org/show_bug.cgi?id=160


Aistis Zenkevicius
http://static.openvz.org/userbars/openvz-user.png
Previous Topic: running psybnc
Next Topic: firewall into VE and isolating eth's from the host
Goto Forum:
  


Current Time: Fri May 10 14:00:49 GMT 2024

Total time taken to generate the page: 0.01511 seconds