NFS Share from Proxmox host

monkeyboy

New Member
Nov 25, 2014
7
0
1
I recently bought an HP Proliant Microserver (n54l with 8GB RAM, 1 x 120GB SSD and 2 x WD 3TB HDD's) with the intention of learning about linux and virtualization. My intention was to use the SSD for running the operating systems and the HDD's forr storing music / films / photos / personal documents etc. So far I've created 4 partitions on each HDD and configured them in RAID1 using mdadm.

I'm comfortable with mounting these partitions as directories but I'm struggling to understand how I now go about setting them up as NFS shares. I want to be able to set up the Proxmox host as the NFS server with the virtual machines as NFS clients.

Also, how does fstab fit in to this? I'm vaguely aware that I'll need to edit fstab to ensure the directories are mounted automatically when I restart the server but don't understand how I go about doing this.

Any help would be appreciated!
 
you just want to install a NFS server?

Code:
[COLOR=#000000][FONT=Courier New][I]apt-get install nfs-kernel-server[/I][/FONT][/COLOR]
and google for "nfs-kernel-server debian"
 
Hi, follow this steps:

Update: apt-get update
Install: apt-get install nfs-common nfs-kernel-server
Edit your file NFS: nano /etc/exports
You have entry new line in /etc/exports of directory to shared i.e: /mnt/backupvm 192.168.50.0/255.255.255.0(rw)

/mnt/backupvm is your directory,
192.168.50.0/255.255.255.0 is your network
rw are the permissions


Start the services:
service nfs-common start
service nfs-kernel-server start


In Proxmoz

Go to DataCenter>Storage
Clic in Add>NFS

ID: backupvm - or the name you want
Server: 192.168.50.20 - IP of server
Export: Clic the list and select de directory "/mnt/backupvm
Content: Disk Image, ISO Image, VZDump backup file, etc.
Nodes: All
Enable: Select
Max Backups: 5 - or more

The fstab is only if you want mount a disk in a directory i.e: /home

I hope this help!

Regards!
 
Hi, follow this steps:


The fstab is only if you want mount a disk in a directory i.e: /home

Regards!

Hi, thanks for the detailed reply - exactly what I was looking for! I've been away all week so will give it a go tomorrow! A couple of final questions:

1. So before put a new line in /etc/exports do I need to create a directory and mount the disk to the directory? And would the most appropriate place to create these directories be in /home ?
2. If yes to no. 1, should I still edit fstab to ensure that the disk is automatically mounted to the relevant directory in the future? As otherwise I'd be sharing the directory via NFS share but it wouldn't actually show any files as the disk wouldn't be mounted?

Sorry if these are really obvious questions!
 
Hi monkeyboy,

1. Only you must perform a "mount" if you are installing a new hard drive or partition in Proxmox, if you only have one partition then you have to create a folder where you want example: /mnt/backupvm (or /home/copiasvm wherever you want) and add a new line to the file "/etc/exports" how this:

/mnt/backupvm 192.168.50.0/255.255.255.0(rw)


2. Only if you have installed a new hard drive or partition you must modify the fstab file

Best regards
 
Thanks for clarifying. I've created the four directories and mounted the relevant partitions to them. I also edited fstab so they automatically mount - I've confirmed this after rebooting my server. I then followed your instructions as per editing /etc/exports.

In Proxmox (web interface), I've been able to add NFS shares without a problem - however, I'm now getting an error when I try and assign the shares to a couple of virtual machines I have. I select the vm in the proxmox interface, go to Hardware > Add > Hard Disk. In the window that opens up, I select storage > 'mymusic' (type = nfs, though it shows avail=0 and capacity=0) and leave everything else as default (VIRTIO, 32GB, QEMU, no cache). When I click Add, I get the following error message:

mkdir /mnt/pve/mymusic/images: Permission denied at /usr/share/perl5/PVE/Storage/Plugin.pm line 794 (500)

Do you have any ideas how I go about addressing this? I don't know if it makes any difference but the proxmox OS is running on an SDD that I initially put in the server and I've then added additional HDD's on which I created the mentioned directories and wish to use as NFS storage across the virtual machines.
 
Was having the same issue.

mkdir /mnt/pve/shared_vol/images
mkdir: cannot create directory ‘/mnt/pve/shared_vol/images’: Permission denied

While trying to mount a zfs sharenfs.

Solution was the same indicated above but not on /etc/exports but zfs sharenfs parameter directly

zfs set sharenfs="no_root_squash,rw=@10.10.1.0/24,rw=@10.10.2.0/24" rpool/shared_vol
 

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!