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
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
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
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 greetings, Hubert
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
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.
/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