NFS configuration in Linux and HPUX

nfs configurationLearn how to configure network file system (NFS) in Linux and HPUX servers. Howto export nfs, strat/stop nfs services and control access on it.


Network file system is one of the essential thing in today’s IT infrastructure. One server’s file system can be exported as NFS over network and control access over it. Other server’s can mount these exported mount points locally as a NFS mount. This enables same file system making available to many systems thus many users. Lets see NFS configurations in Linux and HPUX.


Configuration file:

We assume nfs daemon is installed on server and running in background. Once can check if nfs is running on server with service or ps -ef command. For NFS server i.e. server exporting directory should have portmap service running.

/etc/exports is the configuration file which has all exported volume details along with their respective permissions. This file follows format as below :

export host (options) 

where –

  • export is filesystem/directory to be exported
  • host is hostname/IP to which export is accessible where wile cards are acceptable
  • options are permissions which are ro, rw, sync, async.

Refer below chart which can be used to decide your entry in this file.

/etc/exports file can be edited using vi editor or using /usr/sbin/exportfs command.

Start – stop NFS service:

Once you made the changes in file you need to restart nfs daemon to take all these changes in effect. This can be done using service nfs restart command. If your nfs is already running and you just need to take new configuration in action you can reload config using service nfs reload. To stop nfs you can run service nfs stop command.

Even reload config can be achieved by running exportfs -ra. Make sure only additions happened to config file while reloading config otherwise it may affect already connected NFS shares.

Mounting share :

At destination, where export needs to be mounted should have nfs daemon running too. Mounting a share is very easy two step procedure.

  1. Create directory to mount share
  2. mount share using mount command.

To make this permanent i.e. mounting share at boot time, make an entry to /etc/fstab like below so that manually mounting after reboot of server can be avoided.


Configuration file :

This part is same as Linux. In some versions you need to edit /etc/dfs/dfstab file. This file takes sahre commands as a per line entry. It can be filled like below :

share -F nfs -o root=server2:server3 /my_share

Above line means exporting /my_share directory for server2 and server3 with root account access.

Also we need to specify NFS_SERVER=1 parameter in /etc/rc.config.d/nfsconf on NFS server. By default it is set to 0 i.e. server acts as NFS client. Along with this NFS_CORE and START_MOUNTD needs to be marked to value 1 as well.

Start – stop NFS service:

We have covered it here : NFS server start/stop on HPUX

For reloading config file in HPUX, you can run shareall command.

Mounting share :

This part is same as Linux


Any thoughts?