OS X: How to start the NFS daemon?

I recently reactivated my backup Mac Mini as a server; for convenience, I installed the OS X Server package.


After fiddling a bit with the interface, I decided I actually need only two services, the File Sharing and Mail.

File sharing configuration.

File sharing configuration.

The file sharing configuration is straightforward. Given the very consumerist direction Apple is heading, I wasn’t very surprised to discover it does not provide any support for NFS (needed to access the calibre library, see the How to use calibre with a network drive? With NFS! post).

Fortunately, the NFS server configuration is not very complicated, and can be set by editing one single file, /etc/exports.

In a terminal, invoke an editor:

 sudo vi /etc/exports

and add a line like:

 /Volumes/Second HD/Harlescu Library -maproot=nobody 172.16.62.12

The first path is the folder to export; the optional address restricts access only to this host (more complex expressions are allowed, see the nfsd manual page).

To be sure that regular users cannot read this file, change the mode bits:

 sudo chmod 640 /etc/exports

To check if the content of the configuration file is valid, use the checkexports command:

 sudo nfsd checkexports

To make the NFS daemon start at boot, use:

 sudo nfsd enable
 sudo nfsd start

To check the service status, use:

 nfsd status

If necessary to restart the server, a pair of stop/start can be used, or a signal:

 sudo kill -1 `cat /var/run/mountd.pid`

To see the NFS mount points, use:

 /usr/bin/showmount -e

The above configuration seemed to be the kind perform and forget, it worked from the first attempt and did not require further changes.

About Liviu Ionescu (ilg)
Hi! My name is Liviu Ionescu (ilg, ilegeul or eunete for colleagues and friends) and I’m a senior IT engineer. Or should I say a real programmer?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: