last updated November 3, 2018 in CategoriesLinuxMac OS XUNIX

How do I access my enterprise NAS server by mounting NFS filesystem onto my Mac OS X based system using GUI and command line based tools?

Network File System (NFS), a distributed file system protocol developed by Sun Microsystems. NFS is the common for file sharing on NAS server and Linux / UNIX systems like, HP-UX, Solaris, Mac OS X, and others. Mac OS X cn be setup as an NFS client to access shared files on the network. Mounting NFS volumes in OS X can be done using following methods:

a] Command line option.

b] GUI option.

macOS X Mount NFS Share / Set an NFS Client

Our sample setup for macOS client and nfs server:

        nas01                                   Laptop/Desktop
+--------------+ +--------+
| UNIX/Linux | | Mac |
| NFS +---------------------------+ OS X |
| SERVER | mount nas01:/mp3 /nfs | Client |
+--------------+ +--------+
| (192.168.3.100)
(shared dirs)
/
--/Sales
--/Mp3
--/Data
--/wwwroot
(192.168.3.1)

nas01 allows your users or client compute to access files over a network. Mac OS can mount file system over a network and work as they are mounted locally. This is perfect for sharing files or centralized home directories. See how to setup an NFS server under RHEL / CentOS Linuxand Ubuntu Linux here.

How Do I Find Out Shared Directories?

To mount an NFS file system, the resource must be made available on the NAS or NFS server. To verify that resource available open the terminal and type the following command:
$ showmount -e nas01
$ showmount -e nfs-server-ip-address-here
$ showmount -e nas01.lan.nixcraft.net.in

Sample outputs:

Fig.01: UNIX showmount command lists all clients that have remotely mounted a filesystem from NFS server

The showmount command show remote NFS mounts (resources).

Mac OS X Nfs mount Command

First, create a directory to mount an nfs share, enter:
$ sudo mkdir /private/nfs
$ sudo mkdir /private/mp3

To mount an NFS file system, enter:
$ sudo mount -t nfs nas01:/mp3 /private/nfs
OR
$ sudo mount -t nfs 192.168.3.1:/mp3 /private/nfs
To mount an NFS file system in read/write mode, enter:
$ sudo mount -o rw -t nfs nas01:/mp3 /private/nfs

Tip: Operation not permitted Error

If you get an error which read as follows:

 192.168.3.1:/mp3 Operation not permitted

Try to mount it as follows with -o resvport command:
$ sudo mount -t nfs -o resvport 192.168.3.1:/mp3 /private/nfs
OR mount an NFS in read/write mode, enter:
$ sudo mount -t nfs -o resvport,rw 192.168.3.1:/mp3 /private/nfs
From the man page:

resvport
Use a reserved socket port number. This is useful for mounting
servers that require clients to use a reserved port number on the
mistaken belief that this makes NFS more secure. (For the rare
case where the client has a trusted root account but untrustwor-
thy users and the network cables are in secure areas this does
help, but for normal desktop clients this does not apply.)

Verify: NFS Is Working or Not

Type the following commands:
df -H
$ cd /private/nfs
$ ls -l

Sample outputs (note I’ve mounted it at /private/mp3/ dir):

Fig.02: UNIX df command which displays information about total space and available space for NFS

How Do I Copy Files?

Use the cp command:
cp /path/to/file.doc /private/nfs/
$ cp -a /path/to/*pl /private/nfs/
$ cp /private/nfs/mp3/*.mp3 ~/mp3

Using the Finder

Note: The following entry “NFS mounts” in the Disk Utility does NOT exist in MAC OS X v10.8+. The following discussion only applies to the older Mac OS X version <= 10.7.x and eariler.

The Finder is the default file manager used on the Mac OS and Mac OS X operating systems that is responsible for the overall user-management of files, disks, network volumes and the launching of other applications. Open Finder > Shared (select from the left sidebar) > NFS server (nas01 or 192.168.3.1):

Fig.03: The Finder in action (browse an NFS share)
Now, you can copy and paste files as usual.

Recommend mount Command Options

I suggest that you run the mount command it as follows to get better a performance:
$ sudo mount -t nfs -o soft,intr,rsize=8192,wsize=8192,timeo=900,retrans=3,proto=tcp nas01:/sales /private/sales
OR
sudo mount -t nfs nfs -o soft,timeo=900,retrans=3,vers=3, proto=tcp nas01:/sales /private/sales
See mont_nfs(8) for more information.

GUI Method: HowTo Set Mac OS X As an NFS Client

To mount an NFS share from OS X using GUI tools, follow these steps:

[1] Start Finder, and go to Applications / Utilities / Disk Utility:

Fig.04: Starting Disk Utility
You will see the disk utility as follows:

Fig.05: Click the 'Mounts' icon at the top of the Directory Utility panel

[2] Alternatively, you can select “Disk utility” > click on File > Mount NFS as follows:

You will see an “NFS mounts” window as follows:

Fig.07: OS X NFS Mounts to set it as an NFS Client
[3] Click on “+” icon:
Fig.08: Setting up an NFS mount options in the dialog box
You need to enter your remote NFS server URL (IP address or dns name) in the following format:
nfs://192.168.3.1/mp3
nfs://nas01/mp3

Where,

  1. 192.168.3.1: NFS server IP address.
  2. nas01: NFS server dns name.
  3. mp3: Shared nfs directory name.

You need to set mount location as follows:
/Volumes/mp3
/Volumes/mp3 is nothing but the mount location. This is a convenient place. In this example, you entered the URL as nfs://192.168.3.1/mp3, enter /Volumes/mp3 as the mount location. Please note that don’t create the subdirectory (mp3); it will be created dynamically when the share is mounted.

Optional

Click the arrow in front of “Advanced Mount Parameters”. A new text entry box is displayed. Enter: resvport (this is only required if you get some sort of error [see above for more info or read mount_nfs man page]).
[4] Finally, click “Verify” button at the bottom right:

Fig.09: Verify NFS mount configuration which only checks that your NFS server is enabled and working correctly.
[5] You will see a popup window, stating that “The NFS server appears to be functional” > Click “OK” button to continue. Finally, Click “Save” button. You may be prompted for the password to make changes. Your NFS share should appear at the mount location you entered above i.e. /Volumes/mp3.
Fig.10: NFS Share mounted

You can access /Volumes/mp3 using the Finder:

Fig.11: The finder in action
You can also use command line options:
$ ls /Volumes/mp3
$ cd /Volumes/mp3
cp /path/to/something.file.in file.out
rsync -av user@server3.nixcraft.com:/var/www/html/ server.backups/

SEE ALSO:

This entry is 3 of 15 in the Linux / UNIX NFS File Server Tutorial series. Keep reading the rest of the series:
  1. CentOS / Redhat: Setup NFS v4.0 File Server
  2. Debian / Ubuntu Linux: Setup NFSv4 File Server
  3. Mac Os X: Mount NFS Share / Set an NFS Client
  4. RHEL: How Do I Start and Stop NFS Service?
  5. How To Restart Linux NFS Server Properly When Network Become Unavailable
  6. Linux Iptables Allow NFS Clients to Access the NFS Server
  7. Debian / Ubuntu Linux Disable / Remove All NFS Services
  8. Linux: Tune NFS Performance
  9. Mount NFS file system over a slow and busy network
  10. Linux Track NFS Directory / Disk I/O Stats
  11. Linux Disable / Remove All NFS Services
  12. Linux: NFS4 mount Error reason given by server: No such file or directory
  13. Linux NFS Mount: wrong fs type, bad option, bad superblock on fs2:/data3 Error And Solution
  14. CentOS / RHEL CacheFS: Speed Up Network File System (NFS) File Access
  15. Increase NFS Client Mount Point Security

macOS X Mount NFS Share / Set an NFS Client的更多相关文章

  1. How to mount a NFS share?

    Assume you have a NFS share /data/shares/music, at server: 192.168.1.5 You can mount the NFS share f ...

  2. Windows Mount NFS Share from e.g. Linux

    Note: Not Stable, so steps below are for reference only ************ Linux Configuration NFS Share 1 ...

  3. Mounting the NFS share on a Windows server

    今天遇到一个相当奇怪的问题,在windows 上mount LINUX NFS, powershell 脚本可以成功, 用图形界面也可以成功,但BATCH就是不行.提示53网络错误. 不过公司已经有人 ...

  4. NFS文件系统及搭建NFS共享服务

    一.什么是文件系统? 文件系统是对一个存储设备上的数据和元数据进行组织的一种机制.文件系统是在一个磁盘(包括光盘.软盘.闪盘及其它存储设备)或分区上组织文件方式方法,常见文件系统如ext2.ext3. ...

  5. 如何在CentOS 7.2上创建NFS的Share,然后让Client可以访问

    讲得详细清楚明白的好文. Setting Up an NFS Server and Client on CentOS 7.2 https://www.howtoforge.com/tutorial/s ...

  6. NFS指定端口,NFS缓存

    nfs服务端: #编辑/etc/nfsmount.conf,在末尾添加: #RQUOTAD_PORT=30001#LOCKD_TCPPORT=30002#LOCKD_UDPPORT=30002#MOU ...

  7. NFS指定端口,NFS缓存(转载)

    nfs服务端: #编辑/etc/nfsmount.conf,在末尾添加: #RQUOTAD_PORT=30001#LOCKD_TCPPORT=30002#LOCKD_UDPPORT=30002#MOU ...

  8. Linux centosVMware NFS exportfs命令、NFS客户端问题、FTP介绍、使用vsftpd搭建ftp

    一.exportfs命令 常用选项 -a 全部挂载或者全部卸载 -r 重新挂载 -u 卸载某一个目录 -v 显示共享目录 以下操作在服务端上 vim /etc/exports //增加 /tmp/ 1 ...

  9. nfs nobody,nobody 需要在nfs客户端修改从nfs服务器端共享过来的目录怎么办?

    1,加入我们使用nfs共享安装oracle, 安装oracle需要修改base,data,orainventory等等目录及自目录的属主及权限,一般会继承nfs客户端目录的权限及属主 groupadd ...

随机推荐

  1. ServiceWork的五种状态

    [ServiceWork的五种状态] installing.installed.activating.activated.redundant 参考:https://developer.mozilla. ...

  2. View可以设置tag携带数据

    View可以设置tag携带数据.       例子             初始化:ImageView  iv_brand2              设置:iv_brand2.setTag(strB ...

  3. 调试JS代码的神器

    1.火狐浏览器的 “Web开发者” 可以打断点,实时查看当前值 2.谷歌浏览器的“开发者工具” 可以打断点,实时查看当前值

  4. STL:unordered_set/unordered_multiset(c++11)

    unordered_set:容器内的元素无序排列,基于值进行获取单个元素速度非常快.内部根据它们的 hash value 被组织成 buckets(slot). unordered_multiset: ...

  5. eclipse中没有tomcat小猫

    安装了tomcat,按网上的说明也使用了tomcatPluginV331 配置文件,还是没有小猫,后来我发现,网上的tomcatPluginV331 针对eclipse 4.4版本,所以应该是插件的版 ...

  6. Android 集成高德地图

    先上一张图片看看实现的效果啦!!! 首先登陆高德的开发者平台进行创建自己的应用程序,填写对应的包名,填写sHA1值(这个我这博客中写了获取的代码,可以直接复制粘贴),说了这么多其实都是废话,来我们看重 ...

  7. Mastering Unity 2D Game Development

    Mastering Unity 2D Game Development will give your game development skills a boost and help you begi ...

  8. javaweb导出excel

    百度找了半天也没找到一个提供有效思路的,全都告诉我此路不通 html表格数据粘贴到txt,然后改后缀为xsl,打开,发现二者无缝对接 @参考文章.@参考前任项目 /** * @todo * @para ...

  9. RabbitMQ 参数们的Power “续”

      参数中的 arguments 之前讲参数的一些作用的时候,忽略了最后一个字典类型的参数,因为这个参数是大有文章的,值得单独进出来说道说道. 这时,就不得不打开我们的 Web UI管理系统了,可以看 ...

  10. netty 之 传统的阻塞io 体系回顾

    io 体系回顾: 流的概念: java 程序 通过流来进行完成输入与输出的.流是生产或者消费信息的抽象,流通过java 的 输入/输出系统与物理设备相连,尽管与他们链接的物理设备不尽相同,所有流的行为 ...