NFS help

dcalvache

Member
Mar 14, 2009
30
0
6
I was looking at openvz forums and wiki and i can find a way to make a mount of NFS permanent in a VE. In fisical machines is easy as we can configure this in /etc/fstab, but in a Ve i dont know how it is posible.

Any idea?
 
Ty for the answer, but that i need is to mount inside the virtual machine to access the NFS from the virtual machine.
 
I don`t know how you try but:

1. [host]# umount /dev/sda1
2. [host]# mount /dev/sda1 /var/lib/vz/root/101/boot
3. [guest]# # ls -la /boot/

total 16604
drwxr-xr-x 4 root root 1024 Mar 24 09:34 .
drwxr-xr-x 20 root root 4096 Apr 1 06:25 ..
-rw-r--r-- 1 root root 1224980 Jan 14 11:00 System.map-2.6.24-2-pve
-rw-r--r-- 1 root root 83337 Jan 14 11:00 config-2.6.24-2-pve
drwxr-xr-x 2 root root 1024 Mar 24 09:35 grub
-rw-r--r-- 1 root root 13451203 Jan 14 11:01 initrd.img-2.6.24-2-pve
drwx------ 2 root root 1024 Mar 30 16:06 lost+found
-rw-r--r-- 1 root root 94760 Mar 19 2006 memtest86+.bin
-rw-r--r-- 1 root root 2066528 Jan 14 11:00 vmlinuz-2.6.24-2-pve

4. [host] # umount /dev/sda1
5. [guest] # ls -la /boot/

total 8
drwxr-xr-x 2 root root 4096 Dec 4 09:22 .
drwxr-xr-x 20 root root 4096 Apr 1 06:25 ..


Sorry for my previously mistake

/var/lib/vz/private/VID/mount-point - wrong
/var/lib/vz/root/VID/mount-point - correct
 
YEs, this can match with my problem, then all i need is to include the mount in Fstab of the host to make it permanent.


Lots of thanks, ill try tomorrow in the work.

Again Lots of thanks ;)
 
all i need is to include the mount in Fstab of the host to make it permanent.

I suggest to make some script and mount NFS only after VM has started.

If you try to mount before VM :
mount /dev/sda1 /var/lib/vz/root/101/boot
mount: mount point /var/lib/vz/root/101/boot does not exist

If you create a directory /var/lib/vz/root/101/boot and then mount NFS and start VM :
/var/lib/vz/root/101/boot - empty dir

So first you have to start VM and then mount NFS.
 
Ty tom for the answer, but i just managed to get a diferent solution that works for me, i think ...


I write down my solution:

TO USE PERSISTENT NFS SHARE ON VE.


1.- install nfs-common on both host and guest
2.- modify CT to accept NFS. ex.
Code:
vzctl set 101 --features "nfs:on" --save
3.- restart CT.
Code:
vzctl restart 101
4.- create a script that invoques the mount and umount, like this:

store.sh

Code:
#! /bin/sh
### BEGIN INIT INFO
### END INIT INFO

. /lib/init/vars.sh
. /lib/lsb/init-functions


case "$1" in
    start)
        mount -t nfs 10.4.3.87:/home/shares /home/nfs
        ;;
    restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
    stop)
        /etc/init.d/nfs-common restart
        umount /home/nfs
        ;;
    *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac

and save it in /etc/init.d/
modify to make it executable ;)

5 .- and at last, fill the runlevels to load/unload the script, something like this :
Code:
update-rc.d store.sh defaults 95 95




Thank you all guys to make me to meet this solution, if you see something wrong, please told me.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!