About: The purpose of this document is to record a method by which a NFS share can be mounted in a persistent-like fashion on a Windows Server 2008R2/2012R2 system, considering that this bevahiour is, apparently, not supported officially by the vendor.
The why: As mentioned previously, mounting NFS shares on a Windows 2008R2/2012R2 system in a persistent fashion is not something that is supposed to be possible at this time, not to mention that the mountpoints are associated with the individual uses and cannot be provided in a system-wide manner. One could map the NFS export using the Explorer's Map Network Drive function, but that drive would show up as disconnected at boot-up (which is esthetically unpleasant, suggests to the users that there is a problem and possibly slows down the boot process if the NFS server is unreachable) and each individual user does have to map the share on his own initially, which denies the practicality of having a system administrator doing the necessary changes for the concerned users.
The how: Given the listed limitations (mountpoints being tied to an user's login identity, need for persistence and the need to implement the same mountpoint for multiple users, without their interaction/assistance), the workaround solution found was to mount the NFS export via each user's Profile-specific Logon Script. The steps below list the actions taken in order to achieve the desired outcome:
-
install the
Client for NFS
feature on Server 2012R2 and install the Services for Network File System service of theFile Services
role on Server 2008R2 -
verify that the needed NFS share is exported towards the system, by running the below cmd.exe shell command and verifying that the required export is part of the output list:
showmount -e IP_address_ofNFS_server
note: if the share shows in the exports list, you are good to continue; otherwise, ensure that the NFS server has an export rule targeting the Windows system (or its subnet), or that the rule is otherwise correct, should it exist
-
if it does not already exists, create the C:\Windows\System32\Repl\Import\Scripts folder on the Windows system, then create within it a meaningfully named subfolder, such as "nfsMount" (the subfolder creation is optional)
-
create a "script" called
logon.cmd
(the name does not matter, the extension does) and add the below line to it:mount IP_address_ofNFS_server:/NFS_share_name *
notes:
1. make sure to check that the file has a .cmd, and not a .txt, extension
2. the above command mounts the provided NFS export to the first available drive letter, starting with Z (this is the simplest form of the "script")
-
open the
lusrmgr.msc
console and navigate to theProfile
tab of the concerned user account(s) -
select the
Logon script
text box and enter the path to the defined login script, relative to theC:\Windows\System32\Repl\Import\Scripts
folder (sonfsMount\logon.cmd
in this example) -
save the modification and have the user(s) test the outcome; note that this can be done by the administrator as well