How To Mount and Access NFS Exports on Windows Server 2012 R2
Introduction
Let’s face it, we support mixed environments and sometimes we need to access information on Linux systems on our Windows systems. With that said say you have a Windows server that needs to get to NFS exports on a Linux systems. Well that is completely doable on Windows Server 2012 R2 using Client for NFS. Note: You can also mount NFS if you are running Windows 7 Enterprise or Ultimate versions.
Using Client for NFS
First we will need to install the Client for NFS feature on our systems needing to access the FS exports. Using Server Manager click on Manage > Add Roles and Features. Click Next until you reach the features selection and then select Client for NFS. Click Next then install. Now the client is installed. There are a few new commands installed with the client that we will cover in this post.
nfsadmin.exe
nfsclnt.exe
mount.exe
umount.exe
showmount.exe
To start Client for NFS from the Windows interface
After installation this service should start by default, if not. Open Services for Network File System: click Start, point to Programs or All Programs, point to Administrative Tools, and then click Services.
Right-click Client for NFS, and then click Start Service.
To start Client for NFS from the command line
Open an elevated privilege command prompt.
At the command prompt, type:
nfsadmin client [ComputerName] start
Mounting and NFS Share
To mount an NFS shared resource to a drive letter using the command line
Open a command prompt (this does not need to be an elevated command prompt).
At the command prompt, type the following:
mount [-o options] [-u:username] [-p:<password | *>] <\\computername\sharename> <devicename | *>
Here are a few of the options when mounting and NFS share on Windows.
Option | Description |
-0 rsize= n | The read buffer size, in kilobytes. Acceptable values are 1, 2, 4, 8, 16, and 32. The default is 32 KB. |
-o wsize= n | The write buffer size, in kilobytes. Acceptable values are 1, 2, 4, 8, 16, and 32. The default is 32 KB. |
-o timeout= n | The time-out for a remote procedure call (RPC), in seconds. Acceptable values are 0.8, 0.9, and any integer in the range 1-60. The default is 0.8. |
-o retry= n | The number of retries for a soft mount. Acceptable values are integers in the range 1-10. The default is 1. |
–o mtype={soft | hard} | Soft or hard mount. Regardless of the mount type, the mount will return if it cannot immediately mount the shared resource. However, once the shared resource has been successfully mounted, if the mount type is a hard mount and the Network File System (NFS) server becomes unavailable, Client for NFS will retry accessing the shared resource until the NFS server is once again available. As a result, Windows applications that are trying to access the shared resource will appear to stop responding. |
-0 anon | Mounts as anonymous user. |
-o nolock | Disables locking. This option might improve performance if you only need to read files. |
-o lang= n | To specify the encoding used for file and directory names. euc-jp|euc-tw|euc-kr|shift-jis|big5|ksc5601|gb2312-80|ansi |
-o fileaccess= mode | Specifies the default permission mode of new files that are created on the NFS shared resource. The permission mode is written as a three-digit number in the form ogw, where o, g, and w represent the access granted to the file (o)wner, (g)roup, and the (w)orld. Each digit must be in the range 0–7, with the values corresponding to the following access levels:
|
-o casesensitive | Forces case-sensitive file lookup (similar to that of UNIX-based NFS clients). |
-o sec= sys | |krb5|krb5i|krb5p (Kerberos Security) |
ComputerName | The name of the server with the shared resource to mount.The name of the shared directory to mount. |
ShareName | The name of the shared directory to mount. |
DeviceName | * | The drive letter to assign to the mounted shared resource. The asterisk (*) means to use the next available letter. |
Notes:
To view the complete syntax for this command, at a command prompt, type: mount /?
When mounting an NFS shared resource to a drive letter, we recommend the format ComputerName:/ ShareName.
You can also use the net use command to mount an NFS shared resource to a drive letter.
Examples:
To mount and NFS Export to drive no user credentials G:
mount \\192.168.1.110\export G:
Mount an NFS export in read write mode with username and password
mount -o fileaccess= 7 -u: homey -p: homestead 192.168.1.110/export g:
To view NFS exports on a server
showmount -e 192.168.1.110
To unmount an NFS shared resource from a drive letter using the command line
Open a command prompt (this does not need to be an elevated command prompt).
At the command prompt, type:
umount [–f] {–a | Drive}
umount options:
-f = Force unmount
-a = Unmount all NFS drives
umount -f G:
Conclusion
As you can see, we can now access NFS exports from our Windows Server 2012 R2 systems using the Client for NFS feature. At this point we can start exploring PowerShell NFS cmdlets and their usage https://technet.microsoft.com/en-us/library/jj603081(v=wps.630).aspx.
2 Responses to “How To Mount and Access NFS Exports on Windows Server 2012 R2”
Trackbacks/Pingbacks
- Making Game: How to resolve NFS Mount 'Error 1222' under Windows 10 Pro - TECHPRPR - […] Solved. I needed to start the Client for NFS Service first. Until I found: How to mount and access…
- Linux HowTo: How to resolve NFS Mount 'Error 1222' under Windows 10 Pro - TECHPRPR - […] Solved. I needed to start the Client for NFS Service first. Until I found: How to mount and access…
- How to resolve NFS Mount 'Error 1222' under Windows 10 Pro - Boot Panic - […] Solved. I needed to start the Client for NFS Service first. Until I found: How to mount and access…
PS C:\Users\Administrator> showmount -e
Exports list on WIN-LTV509FN572:
PS C:\Users\Administrator> showmount -e 10.10.10.10
Exports list on 10.10.10.10:
/Q/shares/nfs_share *
PS C:\Users\Administrator> mount \\10.10.10.10\Q\shares\nfs_share g:
cmdlet New-PSDrive at command pipeline position 1
Supply values for the following parameters:
Root:
Please help why can’t mount nfs share ? thanks
I think your mount command is incorrect. Have you tried mount \\10.10.10.10\nfs_share g: