Overview
Although SMB is the prefered protocol for connecting Macs to shares, in multi-operating system environments, there are times when you need to connect to an NFS share instead. This tutorial covers guiding you through it on network that does not have central user identity infrastructure, like NIS or LDAP.
Prepare the NFS Share on the Server
![Nfs mount for mac mojave Nfs mount for mac mojave](/uploads/1/2/6/6/126610208/648303847.png)
![Nfs Mount For Mac Nfs Mount For Mac](/uploads/1/2/6/6/126610208/781866164.png)
We need to create an account for you on the NFS server and then map your OS X user and group ids to it’s. Without this, and unless you have NIS or some other central user database, you will not be able to access the share.
- Log onto the NFS server.
- Create your user account. We’re going set the User and Group IDs to 5000.
- Set a password for our NFS user account. Make sure it’s complex.
- Open the exports file into a text editor, like VI or Nano.
- Add the following line, replacing the highlighted values to match your environment.
- Save your changes and exit the text editor.
- Make sure your export has the appropriate permissions. In our example, we need to make macuser the owner and group for it.
From OS X's man page for mountnfs. 'nfs.conf (5) can be used to configure some NFS client options. In particular, nfs.client.mount.options can be used to specify default mount options'. To get the Finder to default to using NFS v4 add the following to /etc/nfs.conf using the terminal command 'sudo vi /etc/nfs. Add this line to /etc/nfs.conf on the Mac: nfs.client.mount.options=sec=krb5. Shut down the Mac, then restart, and when it comes back up, log back in with an AD account. Attempt the mount from Finder Go Connect to Server. Enter nfs://fqdn/mountpoint. Fqdn in this context is the SC zone name you've configured on the cluster. We use NFS with Docker For Mac because of the superior read speeds (something necessary when working with Rails applications like we do). It works great most of the time. It’s based on this great blog post: Set Up Docker For Mac with Native NFS. NFS uses a /etc/exports file that maps out how a directory is exported to remote hosts. The settings in autonfs require existing directories, and in Sierra, I can’t create one. I cannot mount an NFS share using the nfs: protocol, since apparently this isn’t supported. Apparently Sierra changed a few rules regarding the /Volumes directory. How can I mount an NFS share as an ordinary volume? Mount NFS share in /Volumes as a drive, but.
Enable NFS on OS X
Before we can connect to our NFS server we need to enable the NFS service on OS X. Oddly enough, the service doesn’t automatically start when you attempt to make a connection.
- Open a Terminal window.
- Start the NFS service.
- When prompted, enter your password.
- Close the Terminal window.
Launch Connect to Server
- From the Finder menu, click Go
- Click Connect to Server from Go’s drop down menu.
- Alternatively, you can also press Command+K to launch Connect to Server.
Connect an NFS Share
- In the Server Address field, enter nfs:// to define the network protocol for CIFS, and then enter either the IP address or the hostname of the file server with the export path.
- To add the server to your Favorite Servers list, click the ‘+’ button.
- Click Connect to connect to the share.
Learning has never been so easy!
Assume we have 2 Macs, Mac1 and Mac2. This document will help you to create a NFS share on Mac1 and access it from Mac2. Mac2 will preserve the mount during reboots.
3 Steps total
Step 1: To create an NFS share on Mac1
Open SSH terminal on Mac1
Type in 'sudo nfsd enable'
This starts the nfs server and sets it to startup on reboot.
Type in 'sudo nfsd enable'
This starts the nfs server and sets it to startup on reboot.
Edit /etc/exports (create if it does not exist)
Type the full path of the folder you want to share.
Optional: Use the “-alldirs” option to allow clients to mount any directory under there.
If your UIDs across machines do not match the “-mapall” will map all IDs with an ID that has access to the directory.
You can find your ID by typing “id” at the terminal on Mac1.
The /etc/exports on the Mac1 will looks like this (I have used the Macintosh HD volume in this example; you can add/edit lines if you need to share more volumes).
If your UIDs across machines do not match the “-mapall” will map all IDs with an ID that has access to the directory.
You can find your ID by typing “id” at the terminal on Mac1.
The /etc/exports on the Mac1 will looks like this (I have used the Macintosh HD volume in this example; you can add/edit lines if you need to share more volumes).
/Volumes/Macintosh HD -mapall=501
Book reader for mac. Verify the mount using the command 'showmount -e'
(You will see the following output on Mac1)
(You will see the following output on Mac1)
'/Volumes/Macintosh HD Everyone'
Step 2: To mount this share from Mac2
Open SSH terminal on Mac2
Type in 'cd / && sudo nano .nfsmount.sh'
Type in 'cd / && sudo nano .nfsmount.sh'
Best hard drive for macbook air. Copy and paste the following lines to the nano editor
--------------------------------------------------------------------------------------
mkdir /Volumes/Mac1-Macintosh-HD
sudo mount -o rsize=32768,wsize=32768,intr,noatime -t nfs Mac1 (or IP Address):/Volumes/ Macintosh HD /Volumes/Mac1-Macintosh-HD
-------------------------------------------------------------------------------------------------------------
Save and exit the nano editor
--------------------------------------------------------------------------------------
mkdir /Volumes/Mac1-Macintosh-HD
sudo mount -o rsize=32768,wsize=32768,intr,noatime -t nfs Mac1 (or IP Address):/Volumes/ Macintosh HD /Volumes/Mac1-Macintosh-HD
-------------------------------------------------------------------------------------------------------------
Save and exit the nano editor
This will create a Bash script to create a directory called Mac1-Macintosh-HD under /Volumes and map the Mac1 volume under it.
Set the permissions of the script for root access only:
Type in 'sudo chown -R root:admin .nfsmount.sh'
Type in 'sudo chown -R root:admin .nfsmount.sh'
Now make the script executable:
Type in 'sudo chmod u=rwx .nfsmount.sh'
Type in 'sudo chmod u=rwx .nfsmount.sh'
Now we’ll need to create a .plist file for launchd to handle the script, do the following:
Type in 'cd /Library/LaunchDaemons && sudo nano nfsmount.plist'
Type in 'cd /Library/LaunchDaemons && sudo nano nfsmount.plist'
Inside the editor, copy and paste the following code:
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
Label
.nfsmount
ProgramArguments
.nfsmount
ProgramArguments
/.nfsmount.sh
UserName
root
GroupName
wheel
RunAtLoad
root
GroupName
wheel
RunAtLoad
Mac Os Nfs
Debug
---------------------------------------------------------------------------------------------------------------
Save and exit the editor and then change the necessary permissions
Type in 'sudo chown -R root:wheel nfsmount.plist'
Save and exit the editor and then change the necessary permissions
Type in 'sudo chown -R root:wheel nfsmount.plist'
Next, we’ll load the plist into launchd:
Type in 'sudo launchctl load nfsmount.plist'
Confirm that the plist loaded:
Type in 'sudo launchctl list | grep nfsmount'
If the plist name appears, it’s installed.
Type in 'sudo launchctl list | grep nfsmount'
If the plist name appears, it’s installed.
Reboot Mac2 and check if the Mac1 volume is accessible under /Volumes/Mac1-Macintosh-HD
Done!
To remove the .plist, type the following:
Type in 'sudo launchctl unload -w /Library/LaunchDaemons/nfsmount.plist'
Type in 'sudo launchctl unload -w /Library/LaunchDaemons/nfsmount.plist'
Step 3: Reference
http://seanmcgrath.wordpress.com/2010/07/05/setup-nfs-on-mac-os-x-10-6/
http://powercycled.wordpress.com/2012/04/25/spoof-mac-address-from-boot-using-launchd/
http://powercycled.wordpress.com/2012/04/25/spoof-mac-address-from-boot-using-launchd/
Published: Dec 13, 2013 · Last Updated: Jun 06, 2014
2 Comments
Mac Nfs Client
- DatilDavid_CSG Dec 13, 2013 at 09:57amStandard best practices for the location(s) on a Unix system for custom scripts are /usr/local/bin or /opt/local/bin
(although the 'opt' directory is commonly used by MacPorts or other custom tools)Rather than as a hidden file on the top level of the drive. - MaceGabrielle.L Dec 13, 2013 at 11:06amThe computer is called a Mac (short for Macintosh), not a MAC. Generally, MAC refers to Media Access Control, a hardware identifier assigned to a network interface.