OpenVZ Forum


Home » General » Support » How about post-VE-start scripts?
How about post-VE-start scripts? [message #34168] Wed, 10 December 2008 15:54 Go to next message
VinzC is currently offline  VinzC
Messages: 14
Registered: December 2008
Junior Member
Hi.

I want to mount a filesystem that I dedicated for SAMBA storage for use in a virtual environment. I explored several threads here and I saw a) ext3 cannot be mounted from a VE (because of threading issues) and b) mount --bind should be used instead from the physical host.

While I have nothing against the --bind way I must first make sure the VE is mounted in /vz/root/<VEID> an running before binding. Hence my question is: does OpenVZ support post-start/post-mount scripts? Or do I have to tweak OpenVZ init script on my Gentoo machine?

Thanks for any hint/suggestion.


Vince C.
Re: How about post-VE-start scripts? [message #34177 is a reply to message #34168] Thu, 11 December 2008 08:57 Go to previous messageGo to next message
piavlo is currently offline  piavlo
Messages: 159
Registered: January 2007
Senior Member
You can use /etc/vz/conf/vps.mount & /etc/vz/conf/vps.umount scripts, here is how i've done it:

projsrv3 ~ # cat /etc/vz/conf/vps.mount
#!/bin/bash

if [ -x /vz/root/${VEID}/.cs-chroot.start ]; then
        /vz/root/${VEID}/.cs-chroot.start
        exit $?
fi
projsrv3 ~ # cat /etc/vz/conf/vps.umount
#!/bin/bash

if [ -x /vz/root/${VEID}/.cs-chroot.stop ]; then
        /vz/root/${VEID}/.cs-chroot.stop
        exit $?
fi
projsrv3 ~ # cat /vz/root/103/.cs-chroot.start
#!/bin/bash

mount -n --bind /vz/template/portage $(dirname $0)/usr/portage || exit ${?}
mount -n --bind /vz/template/portage-distfiles $(dirname $0)/usr/portage/distfiles || exit ${?}
mount -n --bind /vz/template/portage-packages $(dirname $0)/usr/portage/packages || exit ${?}
projsrv3 ~ # cat /vz/root/103/.cs-chroot.stop
#!/bin/bash

umount $(dirname $0)/usr/portage/packages
umount $(dirname $0)/usr/portage/distfiles
umount $(dirname $0)/usr/portage
projsrv3 ~ #                                 
icon14.gif  Re: How about post-VE-start scripts? [message #34194 is a reply to message #34168] Fri, 12 December 2008 16:33 Go to previous message
VinzC is currently offline  VinzC
Messages: 14
Registered: December 2008
Junior Member
Cool, thanks a lot! I completely overlooked that from the documentation. Embarassed Fortunately Gentoo Wiki (from Google cache) mentions such a thing, including per-VE mount/umount scripts.

OpenVZ is definitely well thought. Respect! Smile


Vince C.
Previous Topic: Live Migration - Permission denied error
Next Topic: [solved] 32bit binary in 64bit VE
Goto Forum:
  


Current Time: Wed Jul 17 19:35:04 GMT 2024

Total time taken to generate the page: 0.02656 seconds