Nfs Mount For Mac



Learning has never been so easy!

I want to auto mount some NFS shares from my Synology NAS when I boot my Mac. Until recently, I had this working. You also want to create /etc/synthetic.conf to create the mount point next time the mac is rebooted. It should contain something like mnt /System/Volumes/Data/mnt – Nick Sillito Oct.

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

  • Open SSH terminal on Mac1. 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.
  • Linux or Mac computers on your network should now be able to mount the /Users directory on this Mac. (In Linux use the mount -t nfs command, or the amd automounter. On another Mac, open Finder, press SHIFT+CTRL+G and enter /net/Mac/Users ).

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.

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).

/Volumes/Macintosh HD -mapall=501

Verify the mount using the command 'showmount -e'
(You will see the following output on Mac1)

'/Volumes/Macintosh HD Everyone'

Catalina

Step 2: To mount this share from Mac2

Open SSH terminal on Mac2
Type in 'cd / && sudo nano .nfsmount.sh'

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

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'

Now make the script executable:
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'

Inside the editor, copy and paste the following code:
------------------------------------------------------------------------------------------------------------------------

Label
.nfsmount
ProgramArguments

/.nfsmount.sh

UserName
root
GroupName
wheel
RunAtLoad

Debug

Mount Nfs Macos High Sierra

---------------------------------------------------------------------------------------------------------------
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.

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'

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/

Nfs Mount Options Macos

Published: Dec 13, 2013 · Last Updated: Jun 06, 2014
Examples

2 Comments

  • Datil
    David_CSG Dec 13, 2013 at 09:57am

    Standard 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.

  • Mace
    Gabrielle.L Dec 13, 2013 at 11:06am

    The 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.

mount a file system
All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree.

The system maintains a list of currently mounted file systems. If no arguments are given to mount, this list is printed.

Nfs Mount Mac Permission Denied

The mount command calls the mount(2) system call to prepare and graft a special device or the remote node (rhost:path) on to the file system tree at the point node. If either special or node are not provided, the appropriate information is taken from the fstab(5) file.
“The Ten Commandments and the Sermon on the Mount contain my religion” ~ John Adams

Related macOS commands:

Mac Nfs Server

bless - Set volume bootability and startup disk options.
diskutil - Disk utilities - Format, Verify, Repair.
df - Display free disk space.
hdiutil - manipulate disk images.
sharing - Create share points for afp, ftp and smb services.
umount - detach/unmount a device.

Mac Mount Nfs Share

Copyright © 1999-2020 SS64.com
Some rights reserved