How to set up an NFS server on XenServer

Last updated on March 26, 2016 by Dan Nanni

Suppose you would like to set up a NFS server on your XenServer-running host for whatever reason, so that other hosts can mount an 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. It is assumed that 192.168.212.205 is the IP address assigned to the XenServer host.

# showmount -e localhost
# showmount -e 192.168.212.205

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 running:

$ 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.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean