Setting up an NFS share between a virtual Parallels Ubuntu server and OS X Mountain Lion

17th Jul, 2013 | parallels symfony

Parallels upto now has made my life very easy for virtualisation. Instances run fast, don't slow down the mac and setting up shared directories so remote server and host can see the same application files works flawlessly. Until today that is...

Today I need to setup Symfony2. During it's setup, config and running it uses a combination of cli and web tools which did not get on with my usual shared directory setup. I could either get it running on the mac without the ubuntu server able to see it or working on ubuntu without the IDE on the mac able to see it.

The solution turned out to be simple - NFS to the rescue!

On the mac to setup the NFS server edit the /etc/exports file to specify the directory to share and the network range that can see it. Most importantly is  -mapall=root:wheel which ensures that all client writes appear as root, so there are no permission hassles on the client end.

UPDATE: on using this method to share a system directory on another project the share failed, so it may not be possible to use this option in all cases.

# /etc/exports
path/to/share -mapall=root:wheel -network -mask
# Then to restart service 
nfsd enable 
nfsd stop 
nfsd start 

# Final check 
showmount -e

At the client end create a mount point and mount:

mount -v <IP of server(Mac)>:<Shared dir path on server> <mount path>

And for good measure add into /etc/fstab

<IP of server(Mac)>:<Shared dir path on server> <mount path> nfs soft,intr,rsize=8192,wsize=8192 0 0