OpenVZ Forum


Home » General » Support » *SOLVED* how to create a mount script
*SOLVED* how to create a mount script [message #26900] Tue, 05 February 2008 03:57 Go to next message
KyleC is currently offline  KyleC
Messages: 21
Registered: October 2007
Junior Member

Alright, ive read the PDF but it doesnt go into detail how to make a mount script... do i just create 300.mount in /etc/vz/conf and put
mount --bind /vz/private/200/home/xxx /vz2/private/root/300/home/xxx

and it will run that script on boot? if thats the case please let me know or if not let me know how i can have it mount /vz/private/200/home/xxx to /vz2/private/root/300/home/xxx

[Updated on: Thu, 07 February 2008 05:55] by Moderator

Report message to a moderator

Re: how to create a mount script [message #26921 is a reply to message #26900] Tue, 05 February 2008 12:07 Go to previous messageGo to next message
piavlo is currently offline  piavlo
Messages: 159
Registered: January 2007
Senior Member
you can have per VE mount/umount scripts /etc/vz/conf/${VEID}.{mount|umount}
or mount/umount scripts which all VEs will run /etc/vz/conf/vps.{mount|umount}
In case of no-zero exit code of mount script the VE won't be started

You would probably want to move /vz/private/200/home/xxx
to /vz/home/xxx (or somewhere else and bind mount it both from
/vz/root/200/home/xxx /vz/root/300/home/xxx
mount --bind /vz/home/xxx /vz/root/200/home/xxx
mount --bind /vz/home/xxx /vz/root/300/home/xxx

In case you don't want the umount scripts then bind mount with -n
option
mount -n --bind /vz/home/xxx /vz/root/200/home/xxx
mount -n --bind /vz/home/xxx /vz/root/300/home/xxx
Re: how to create a mount script [message #27003 is a reply to message #26921] Wed, 06 February 2008 17:05 Go to previous messageGo to next message
jonwatson is currently offline  jonwatson
Messages: 21
Registered: March 2007
Junior Member
Hello,

I am attempting to do a bind mount on my test VE 1040. For testing purposes, I just want to mount /home/jdw on the host node into /home in VE 1040. I know this isn't a proper setup, but I'm just trying to get the format of the mount script correct.

It seems to me that all I would have to put into /etc/sysconfig/vz-script/1040.mount is:

mount -n --bind /home/jdw /vz/private/1040/home

however, when I attempt to start VE 1040 with this mount script in place I get the following error:

Starting VE ...
Error exec /etc/vz/conf/1040.mount: Exec format error
Error executing mount script /etc/vz/conf/1040.mount

The mount -n --bind /home/jdw /vz/private/1040/home works on the host node at the command line so the format appears to be correct. I have also tried mounting to the VZ root instead of private area as I am not clear where I should be mounting to.

The HN is openvz 2.6.18-53.1.4.el5.028stab053.4 and VE 1040 was built with the centos-4-i386-default template.

Any ideas what I'm doing wrong?

Thanks

Jon
Re: how to create a mount script [message #27011 is a reply to message #27003] Wed, 06 February 2008 19:02 Go to previous messageGo to next message
HubertD is currently offline  HubertD
Messages: 22
Registered: August 2006
Junior Member
Hi Jon,

2 things:

a) I believe that you shouldn't do the bind mounts to /vz/private/.../ but to /vz/root/.../ (could someone please confirm this?)

b) does your mount script only contain the one line with the mount command? If so, try to make it look that way:

#!/bin/sh
mount -n --bind /home/jdw /vz/root/1040/home


and be sure to set the executable flag for the script:
chmod +x /etc/sysconfig/vz-script/1040.mount

I'm not an openvz expert but that's the way it works for me Smile

greetings,

Hubert
Re: how to create a mount script [message #27021 is a reply to message #27011] Thu, 07 February 2008 00:52 Go to previous messageGo to next message
KyleC is currently offline  KyleC
Messages: 21
Registered: October 2007
Junior Member

worked for me, thanks guys!
Re: how to create a mount script [message #27053 is a reply to message #27011] Thu, 07 February 2008 13:39 Go to previous messageGo to next message
jonwatson is currently offline  jonwatson
Messages: 21
Registered: March 2007
Junior Member
Aha. I was missing the shebang because sh is in my path. Apparently it needs to be specified for the mount script to work.

Thanks!

Jon
Re: how to create a mount script [message #30069 is a reply to message #27053] Wed, 07 May 2008 19:08 Go to previous messageGo to next message
ArsDangor is currently offline  ArsDangor
Messages: 6
Registered: March 2008
Junior Member
Hi.

I'm trying what you suggest here, but I don't make it to work.

My mount script:
#!/bin/bash
mount --bind '/vz/mounts/gridlog/psql' /vz/root/3000'/var/lib/pgsql'


All directories exist:
$ ls -lhd /vz/mounts/gridlog/psql /vz/root/var/lib/pgsql

drwxr-x--- 2 root root 4.0K May  7 19:40 /vz/mounts/gridlog/psql/
drwxr-x--- 2 root root 4.0K May  7 20:45 /vz/root/3000/var/lib/pgsql/


But I get the following error if I try to start VE 3000:
Quote:

Starting VE ...
mount: mount point /vz/root/3000/var/lib/pgsql does not exist
It doesn't work if I replace /vz/root with /vz/private, or I change the permissions or I add '-n' to the mount invocation.

I'm using vzctl-3.0.22-1 . Any ideas?

Thanks a lot.


If all the world is a stage, I want better ligthting.
Re: how to create a mount script [message #30071 is a reply to message #30069] Wed, 07 May 2008 20:58 Go to previous message
piavlo is currently offline  piavlo
Messages: 159
Registered: January 2007
Senior Member
/vz/root/3000/ get mounted from /vz/private/3000/
then VE startsup, so you need to create
/vz/private/3000/var/lib/pgsql/ instead

so make shure /vz/private/3000/var/lib/pgsql dir exists prior to starting 3000 VE

[Updated on: Wed, 07 May 2008 21:00]

Report message to a moderator

Previous Topic: HN and VE IPs on different subnets
Next Topic: DRBD+Heartbeat clustering question!
Goto Forum:
  


Current Time: Sun Sep 15 05:19:24 GMT 2024

Total time taken to generate the page: 0.03589 seconds