Submitted by
guvnor on Fri, 12/19/2008 - 11:52
What it is: A basic guide to sharing and mounting remote NFS shares
Intended Audience: Users whose experience of UNIX is limited to that of very secure custom UNIX devices such as the Nokia IPSO range of devices or secure webservers. In these kinds of environments the primary file transfer method tends to be FTP or TFTP. Users who have not worked in a LAN environment with UNIX hosts might not be familiar with one of the primary methods of transferring files and accessing and mounting remote file systems which is NFS. Users who have come from a primarily Windows File server (or less likely nowadays Netware) background who are used to mapping network drives through Windows Explorer or NET USE or MAP commands would benefit if they are unsure on how to share filesystems between UNIX or LINUX hosts.

Creating a NFS Share from your Unix File Server
This example assumes two unix hosts one NFS server which exports (or shares) it's file system running Solaris 10 hostname rasputin and a generic unix client, hostname alexandra, that will mount the remote file system on rasputin.
From Solaris 10 machine (hostname rasputin)
Step 1. Check the NFS daemon is running by typing the following command:
ps -ef | grep nfsd
If is running you should get some output like this:
ps -ef | grep nfsd
daemon 299 1 0 May 13 ? 711:31 /usr/lib/nfs/nfsd
root 27827 27822 0 19:06:25 pts/1 0:00 grep nfsd
If it is not running and you just get your ps command echoed (below) you need to start the nfsd
ps -ef | grep nfsd
root 27846 27822 0 19:08:38 pts/1 0:00 grep nfsd
Step 2. Now the NFS server is verified as running you can create a folder for exporting (Windows calls this sharing) in this example
share -F nfs -o rw -d bin /exports/bin
(also add this to the /etc/dfs/dfstab file for the share to export automatically at reboot)
This assumes you have a directory called /exports/bin. The /exports/
is a Solaris convention and you don’t have to use it you can export or share any folder you want.
Now from the client machine (hostname: alexanda) you wish to mount this file system from create a directory or mountpoint where you are going to mount the shared NFS from e.g.
mkdir /public
Next mount the file sytem
mount Rasputin:/disk1/bin /public
After a moment it should be mounted and ready for use.
Type
ls /public and you should see the Rasputin file system.
NOTE if you are using AIX to mount or share file systems you need to get name resolution working (either DNS or Hosts) on both the client and the server or it will fail to mount using IP addresses won’t work. Not sure why AIX is funny like that as Solaris and Linux work ok regardless of whether you use IP or hostname.
Don't forget if you want it to remount the remote filesystem at boot you need to specify that on the client (options to do do this varies from client OS to client OS but for example AIX smitty has a section for this) as NFS mounts are not automatically remembered.