How to set up an NFS server on XenServer

Suppose you would like to set up a NFS server on your XenServer-running host for whatever reason, so that other hosts can mount a NFS share exported by the XenServer host.

A fresh installation of XenServer comes with NFS server already installed. So you do not need to install NFS server on your own, and just need to set up NFS export. In this tutorial, I will show you how to set up NFS export on XenServer. I assume that you want to export /export directory via NFS.

$ vi /etc/exports
/export *(rw,async,no_root_squash)
$ exportfs -a
$ service portmap start
$ service nfs start
$ chkconfig portmap on
$ chkconfig nfs on

Now you need to perform one important last step to be able to export the XenServer host's local storage via NFS. By default, portmap on XenServer only binds to the loopback interface (by using "-l" option), so that NFS mount is only possible on loopback address, and no other external host can mount its storage via NFS. You can confirm this behavior as follows.

$ showmount -e localhost
$ showmount -e 192.168.212.205 (which is the IP address assigned to XenServer host)

You will see that the first command will successfully show the export list for localhost, whereas the latter command will fail, due to the reason I mentioned, with the following message:

RPC: Port mapper failure - RPC: Unable to receive"

In order to remove this portmap restriction, modify /etc/sysconfig/portmap as follows.

PMAP_ARGS=""

After modification, restart NFS service.

$ service portmap restart
$ service nfs restart

Check out again if the export is working okay by:

$ showmount -e 192.168.212.205

If it successfully shows the export list for the XenServer host 192.168.212.205, NFS-export is all set.


Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

Leave a comment

Your email address will not be published. Required fields are marked *