Monday, February 9, 2009

How to mount a NFS Share on Linux

This one may be a bit simple but it may help someone remember the syntax.
This command will mount an NFS share in linux to an exisiting empty folder called /mountpoint.

mount  servername:/nfs-exported-sharename /mountpoint

The servername is the server's name. Note this can be the UNC name (server.domain.com). The nfs-exported-sharename is the NFS share that has been exported on the NFS server. The /mountpoint is the location on the system where you would like to mount this connected share. This directory must exist and be empty before you run the command.

This command is similar to "mapping" a drive in Windows. Once connected you can access the files on the nfs server just the same as you would a file on the local filesystem.  You simply browse or change dirs to /mountpoint/folder/subfolder/filename  etc...

This is an over simplified command as there are many NFS options but this should work by itself. I have used this many times on Centos and Redhat Linux but it should work for most linux versions that have an nfs client installed.

There is also a nice util called automount (linux service autofs) that can be set up to automatically mount and unmount the nfs shares as needed. If anyone would like to see a description of that let me know and I will create a post on how I have it set up and working.



No comments: