User:Rewood/How to mount NFS shares on Sun Workstations.

From WolfTech
< User:Rewood
Revision as of 16:34, 16 March 2006 by Rewood (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For mounting NFS, there are a few simple steps. Figure out what workstation is going to mount nfs stuff and where that nfs mount is coming from. Make sure that the server allows the workstation access to the NFS share. Create temporary or lasting mounts to the NFS share. Hope it all works. Figure out workstation and server:

If you only have one NFS server, that part is easy. In general, there will be multiple workstations, and you will have to mount the NFS shares from that server on each box individually.

Allow workstation NFS access from the server:

Depending on the configuration of the NFS server, all machines may already have access to mount the NFS shares or only certain machines may have access. You will need to make sure that any shares you plan to mount are accessible to the workstation you are planning to use them from.

The file that controls all this from the server (assuming a Linux Realmkit install) is /etc/exports. Of course, you will have to be root to edit it.

The following is an excerpt from the man page for /etc/exports:

  1. sample /etc/exports file

/ master(rw) trusty(rw,no_root_squash) /projects proj*.local.domain(rw) /usr *.local.domain(ro) @trusted(rw) /home/joe pc001(rw,all_squash,anonuid=150,anongid=100) /pub (ro,insecure,all_squash)

The first line exports the entire filesystem to machines master and trusty. In addition to write access, all uid squashing is turned off for host trusty. The second and third entry show examples for wildcard hostnames and net- groups (this is the entry `@trusted'). The fourth line shows the entry for the PC/NFS client discussed above. Line 5 exports the public FTP directory to every host in the world, executing all requests under the nobody account. The insecure option in this entry also allows clients with NFS implementations that don't use a reserved port for NFS.

For further information on the configuration of /etc/exports you can execute the command "man exports" on the server.

Mounting NFS shares on the workstation(s):

Assuming the server allows the workstation access to the NFS shares, there are no interfering networking problems, and you are not cursed with complete stupidity, this step is quite simple. Don't forget you have to be root.

Temporary Mounts:

The general format of the mount command for NFS shares is:

> mount -F type -o option1[,more_options] /workstation/mount/point

(All one line, of course.)

I like to keep my NFS shares, at least those used for general purpose, under /local/nfs. This is entirely an admin preference, but it does kind of make sense with the current Sun realmkit installs. In any event, make sure there is an empty directory at the location you want to mount the share.

For example:

The server is, the share (which we get from /etc/exports) is /export/nfs, and the place we want to mount it on the workstation is /local/nfs (which we've already created and know is empty).

> mount -F nfs /local/nfs

If the server is happy, you should be able to cd into /local/nfs and see the share.

This of course, mounts the share without any of the nifty options you can do, which you can read about on a realm machine by "man mount_nfs". For somewhat recommended options, see below.

Permanent Mounts:

Permanent mounts require that you add a line to the /etc/vfstab file -- and do it properly. You can read more about the /etc/vfstab file by "man vfstab". However, the line(s) you will want to add will have much in common with the information provided for temporary nfs mounts.

> - /mount/point nfs - yes OPTIONS

where OPTIONS is a comma separated (no spaces after commas) list of the options available. For general purpose, a good selection of options is:


Again, these options can be read about in detail in the man page for mount_nfs ("man mount_nfs").

Simply adding the appropriate line to the end of the /etc/vfstab file should (assuming everything else is happy) cause the nfs share to be mounted at boot time. It also allows you to mount the nfs share easily after you've edited the vfstab file but have not rebooted (which you may not always be able to do right away).

If everything is correct, you should me able to simple issue the command:

> mount /mount/point

where /mount/point is the valid mount point you specified in the vfstab file. This should use the information provided in the vfstab file and mount the appropriate nfs share with the specified options.