Sharing files between Ubuntu and OSX (Snow Leopard) using NFS
NFS (Network File System) is an old way of sharing files between UNIX systems. It was written way before the time when we started sharing files the way we are sharing them right now with Windows servers and workstations.
I actually would have not installed it, because I already have a Samba server in the LAN. However, Snow Leopard (even Leopard, probably moreso) has an unpredictable behavior when detecting Samba shares. So I decided to install an NFS share on the same Samba server–just for my mac mini and macbook; of course, if you have linux workstations and notebooks, it wouldn’t hurt to prepare them for NFS use.
To make this solution work, you need to do something on the server side. My server has the following details.
root@whitepc:~# lsb_release -a Distributor ID: Ubuntu Description: Ubuntu 9.04 Release: 9.04 Codename: jaunty
And this is the OSX info

OSX comes with the necessary software to mount an NFS volume, so I didn’t have to do anything on that side.
Preparing the Ubuntu server for NFS
You need to get some packages. Get a terminal (xterm or gnome-terminal or aterm, whatever is your choice)
# apt get install nfs-kernel-server nfs-common portmap sysv-rc-conf
The sysv-rc-conf is just a handy utility so that I can start | stop | restart any service in my Ubuntu box, it’s a ncurses user interface which let you manage the state of services by just pointing to the service using the arrow keys, then pressing the plus sign (+) to start a service and the minus (-) sign to stop a service
After getting the packages, you will need to edit /etc/exports and add some lines so that you can expose the folders that you would like share using NFS
replace /home and /mnt/badass with your own folders that you’d like to share. I had to include the ‘insecure’ option in the exports declaration because OSX wouldn’t let me mount without that option. There are other types of declaration you can do in the exports file, but it’s beyond the scope of this post–I’ll put some more time on this one, then I’ll redo this post to include the other options for NFS exports file.
After you have done editing /etc/exports, you should restart the nfs server, you can do that 2 ways. First is by
$ sudo /etc/init.d/nfs-kernel-server restart
The second is to invoke sysv-rc-conf from the command line, then use your arrow keys to find nfs-kernel-server, then press ‘-’ sign to stop, then press ‘+’ sign to start.
Mounting shares from OSX
Just like any other mounts, you should create a mount point (a folder) in your OSX drive.
$ mkdir ~/mymount
$ cd ~
$ sudo mount servername:/mnt/badass ~/mymount
All the contents of the shared files in your NFS server should now be accessible within the mymount folder, just cd to ~/mymount and use it as it the file system is local to your OSX.
{4 Comments below .. you can add one }
12.5.2009at 19:57
Hello !
First I am a command line novice. I repeat NOVICE
I was able to edit the /etc/exports file but when I restarted NFS the response was…..
exportfs: No host name given with /home/tom/Desktop/macpro (rw,sync,no_subtree_check,insecure), suggest *(rw,sync,no_subtree_check,insecure) to avoid warning
Don’t I need to specify a host name?
OR
Did I type the command on the exports file with the incorrect syntax?
() ().