OpenVZ Forum


Home » General » Support » *SOLVED* Sharing /home between vps, nfs/bind mount not working?
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 previous 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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: running psybnc
Next Topic: firewall into VE and isolating eth's from the host
Goto Forum:
  


Current Time: Thu Jul 18 22:36:46 GMT 2024

Total time taken to generate the page: 0.02480 seconds