How To Mount and Use NFS ISO Share on Proxmox VE

Posted on 106 views

The Network File System (NFS) is a well-proven, widely-supported and standardized network protocol used to share files between separate computer systems. The Network Information Service (NIS) is commonly used to provide centralized user management in the network. When NFS is combined with NIS, you’re able to have file and directory permissions for access control in the network. The default configuration of NFS is to completely trust the network and any machine connected to a trusted network is able to access any files that the server makes available.

In Proxmox Virtualization Environment you can use local directories or locally mounted shares for storage. A directory is a file level storage that can be used to store content type like containers, virtual disk images, ISO images, templates, or backup files. In this post we discuss how you can configure NFS share on Proxmox VE for ISO images. The same process applies for any other storage purpose like storage of virtual disk images and templates.

In Proxmox VE, storage configurations are located in the file /etc/pve/storage.cfg. You can list contents in /var/lib/vz/ directory:

$ ls /var/lib/vz/
dump  images  template

Within templates directory we can see iso and cache sub-directories.

$ ls /var/lib/vz/template/
cache  iso

The table below shows a predefined directory layout to store different content types into different sub-directories

Content type Subdir
VM images images//
ISO images template/iso/
Container templates template/cache/
Backup files dump/
Snippets snippets/

Configure NFS server Share

Login to the server that will act as NFS server and configure export for ISO contents. If you’re using a ready solution with NFS feature, you can skip this steps.

Install NFS server package on your Linux system.

### RHEL Based systems ###
sudo yum -y install nfs-utils
sudo systemctl enable --now rpcbind nfs-server
sudo firewall-cmd --add-service=nfs --permanent
sudo  firewall-cmd --reload
#If use NFSv3 allow the following
sudo firewall-cmd --add-service=nfs3,mountd,rpc-bind --permanent
sudo firewall-cmd --reload

### Debian Based systems ###
sudo apt -y install nfs-kernel-server

Let’s now configure NFS export by editing the file below

$ sudo vim /etc/exports
/nfs/isos *(rw,no_root_squash,no_subtree_check)

In the example we’re setting /nfs/isos as NFS share for ISO images on Proxmox VE.

Confirm it works after the changes by re-exporting shares:

$ sudo exportfs -rrv
exporting *:/nfs/isos

Mount NFS ISO share on Proxmox VE server

Install NFS utility packages in your Debian / Ubuntu system.

sudo apt -y install nfs-common

Our NFS server setup is:

  • NFS Server IP address: 172.20.30.3
  • ISO Export path on NFS Server: /nfs/isos

Ensure you don’t have any data inside isos directory:

ls /var/lib/vz/template/iso/

On Proxmox VE, which acts as NFS client, execute the following to display RPC information of the remote NFS server.

$ rpcinfo -p 172.20.30.3
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100005    1   udp  20048  mountd
    100005    1   tcp  20048  mountd
    100005    2   udp  20048  mountd
    100005    2   tcp  20048  mountd
    100024    1   udp  46068  status
    100024    1   tcp  43599  status
    100005    3   udp  20048  mountd
    100005    3   tcp  20048  mountd
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    3   tcp   2049
    100003    3   udp   2049  nfs
    100227    3   udp   2049
    100021    1   udp  44453  nlockmgr
    100021    3   udp  44453  nlockmgr
    100021    4   udp  44453  nlockmgr
    100021    1   tcp  35393  nlockmgr
    100021    3   tcp  35393  nlockmgr
    100021    4   tcp  35393  nlockmgr

Run the showmount to display all active folder exports in an NFS server:

$ showmount -e 172.20.30.3
Export list for 172.20.30.3:
/nfs/isos *

Option 1: Configure mount using Proxmox pvesm (Recommended)

pvesm is a powerful Proxmox VE Storage Manager command line tool. Use the tool to scan for NFS shares in the server we just configured.

$ sudo pvesm scan nfs  172.20.30.3
/nfs/isos *

We’re going to run commands shared below to configure NFS Storage for ISO images on our Proxmox environment.

sudo pvesm add nfs NFS-iso --server 172.20.30.3 --path /var/lib/vz/template/iso/ --export /nfs/isos --content iso

Where:

  • 172.20.30.3 is the IP address of NFS server
  • /nfs/isos is the path to the iso folder on NFS server (NFS export path)
  • /var/lib/vz/template/iso/ path on Proxmox server where NFS share is mounted

Listing contents of /etc/pve/storage.cfg after command execution.

$ cat /etc/pve/storage.cfg
dir: local
	path /var/lib/vz
	content iso,vztmpl,backup

lvmthin: local-lvm
	thinpool data
	vgname pve
	content rootdir,images

nfs: NFS-iso
	export /nfs/isos
	path /var/lib/vz/template/iso/
	server 172.20.30.3
	content iso

We can confirm new lines were added to the file. With the df command you can check if mounting was successful.

$ df -hT /var/lib/vz/template/iso
Filesystem            Type  Size  Used Avail Use% Mounted on
172.20.30.3:/nfs/isos nfs4  400G   39G  341G  11% /var/lib/vz/template/iso

Option 2: Configure mount using /etc/fstab

You can also use mount command for runtime testing if Proxmox server can access NFS server and exported directory.

sudo mount -t nfs  172.20.30.3:/nfs/isos  /var/lib/vz/template/iso/

To persist the configurations use /etc/fstab file.

$ sudo vim /etc/fstab
# Add NFS ISO share mount
172.20.30.3:/nfs/isos  /var/lib/vz/template/iso    nfs     defaults        0 0

Unmount before testing:

sudo umount /var/lib/vz/template/iso

Validate mounting can be done successfully

sudo mount /var/lib/vz/template/iso

Check with the df command:

 $ df -hT /var/lib/vz/template/iso/
Filesystem            Type  Size  Used Avail Use% Mounted on
172.20.30.3:/nfs/isos nfs4  400G   20G  360G   6% /var/lib/vz/template/iso

Login to Proxmox Web dashboard and check the status of your mount

nfs-iso-storage-proxmox-1024x196

We can see a list of images available on NFS share. From here VM installation with the ISOs can begin.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.