nfs share setup for windows 7 and freenas +
I recently finished building my NAS and I’m very happy with the overall performance results. The idea was to have a central box that allows me to save to a ZFS array all my development work, as well my media files. For added security, I’ve also setup a sync system with a remote server that allows me to instantly backup the development data to a remote server. Better to be safe than sorry. Unfortunately, the Windows NFS implementation was much more tedious compared to Linux one.
I used NFS to mount the NAS on a local network of 4 development servers. As usual, everything worked perfectly… Linux makes your life very easy. I needed to make available all my media files into a Windows box, so I can play them on WMC and Xbox 360. Microsoft provides the NFS client in Windows Enterprise and Ultimate. That determined me right away to use it, mainly because NFS is much faster compared to CIFS when it comes to file transfers.
Enabling the NFS client in Windows Ultimate is a matter of few clicks, all you have to do is enable it into Windows features:

From there, the Micrapsoft tragedy started. The first obstacle I encountered was related to Windows permissions. Even if the NFS service was started properly in Windows, I could not connect to the NAS. Well I could connect but that’s it. If I wanted to create a file and edit its content, I was not allowed.
The only solution I found was to set in FreeNAS the share to root (uid 0):

Back to Windows, I forced the NFS anonymous user and group ID’s to FreeNAS’ root ID. Using the registry editor, I added 2 DWORD values with a 0 (zero) decimal value data. The values are AnonymousGid and AnonymousUid. The registry location is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default

After a reboot, I tried to mount the FreeNAS share using the Windows regular command:
C:\Users\Floren> mount -o nolock 192.168.1.6:/mnt/nas/media Z:
Doing a quick checkup, everything looked normal:

Happy with the overall results, I tested a large file transfer and noticed that I can upload to NAS at approximately 40MB/sec (320MBits/sec).
Rebooting Windows created another nightmare. For some reason, the NFS mount would not hold and the network share was marked as unavailable. That proves how unreliable is Windows compared to Linux… Happy times ahead, thank you Windows.
While rebooting and testing various settings, I noticed that unmounting the share before I restart the computer will solve all issues. Unfortunately, there is no easy way to run a scheduled task in Windows while logging off or rebooting because for some reason the Microsoft engineers thought is not necessary. You reboot the box, why would you need a task performed then?
I remembered that Windows Ultimate has a Local Group Policy editor (gpedit.msc) that allows me to execute scripts at user logon/logoff:

So I tried to run there the mount/unmount commands, hoping that everything will be OK. I was dreaming, obviously. Upon reboot, nothing happened… the commands were totally ignored. Then, I decided to try creating a custom local policy (mmc.exe) for user Floren:

In the window labeled Console1, click on File tab and select Add/Remove Snap-In. Next, select Group Policy Object Editor and click on Add. A wizard window will open, click on Browse button. Click on Users tab and select your user, in my case being Floren. Click on File tab again and save the console to /windows/system32 directory with a name easy to remember. (i.e. floren.msc)
With the custom policy created, all I had to do is add the proper commands at logon/logoff:
mount.exe -o nolock 192.168.1.6:/mnt/nas/media Z:
umount.exe -f Z:

If you think everything went well upon reboot, you are wrong. There is no such thing called “easy”, in Windows. Because the networking is started after you login, the NFS share cannot be mounted. Dang. Since there is no sleep shell command in a Windows prompt environment, I created a VBScript that delays the mount execution for 10 seconds, just enough to let Windows start the networking:
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 10000
WshShell.Run "mount.exe -o nolock 192.168.1.6:/mnt/nas/media Z:", 0
Set WshShell = Nothing
I saved the script as mountnas.vbs and upload it into /windows/system32 directory. Next, I deleted the logon custom policy in floren.msc and created a new task with Windows Task Scheduler:

The task was created into Task Scheduler Library > Microsoft > Windows > Windows Media Sharing:
Next, I’ve set the triggers, actions, conditions and settings for the new task:
Finally, everything worked as expected. Upon logoff, the umount command was executed properly, while at logon, the task was delayed for 10 seconds allowing the mount to execute with the network up. All this took me hours of testing and endless reboots. In Linux, it took me exactly 30 seconds to achieve the same result. Have your pick…
I hope this tutorial helps someone else. If you find it useful, please post a link to your site.





Thanks for this tutorial, however I am still having problems.
I followed your tutorial to the letter, but I am getting the following error message:
Network error – 53
Type ‘NET HELPMSG’ for more information.
If I use showmount -e 192.168.0.100
It does show some stuff about my NAS.
Please advice.
Nevermind, I think I got it!
Not excellent transferspeeds though. ~70 MB/s with 4x 1000 Mbit nics in LACP and my PC 2x 1000 Mbit nics in LACP with a LACP router in between.
I had the same issues, related to transfer speed. I’m currently running CIFS and I get about 110MB/sec on a single 1Gig card. I suggest you go the same direction… What a pain to install everything, then to notice the performance is just not there.
Just curious, what LACP switch you use? I just ordered the Cisco SG300-10, had a very bad experience with the Netgear ProSafe GS108Tv2 switch.
Okay well apparently it’s not working correctly for some reason.
If I start up Windows 7 now, it loads the vbs, however the share is shown as:
0 bytes of 1.12 TB available. This is incorrect cause I have approx 7 TB space of which 5 TB is at least free…
Also the performance is even worse during the transfer +/- 32 MB/s (which is worse than Samba did for me)…
Any advice…
//sidenote maybe it’s smart to remove the gpedit.msc and stuff, I started following that and in the end it wasn’t even needed. So maybe it’s better to remove that part to avoid confusion?
You are supposed to read first the tutorial.
Enable CIFS in FreeNAS, all problems solved… I get mad speeds with it. Let me know what switch you use for LACP.
I am using a D-Link DGS-1210-16 (16-port Gigabit Smart Switch incl. 4 Combo 1000BaseT/SFP).
Well I did follow your tutorial and like stated before:
0 bytes of 1.12 TB available. This is incorrect cause I have approx 7 TB space of which 5 TB is at least free…
This is not good. :S
Is Microsoft, don’t expect miracles. I takes 30secs to setup NFS in a Unix box and 3 days in Windoze.