NFS on Pogo and Windows

Guides written by the community, for the community, and only guides!

NFS on Pogo and Windows

Postby sambul13 » Sat Sep 08, 2012 10:57 pm

Do you want to exchange files between your ArchLinux ARM reinforced Pogo and Windows 7 PC? One of popular ways to do it is setting up NFS Server on Pogo, and tuning it up to work properly with Windows Client for NFS.

1. In ArchLinux ARM run commands below to install NFS Client and Server on your Pogo. Then create folders for each drive you want to share in NFS root dir /mnt. Run man mount to see allowed in your kernel version mount rules for your file system types, and add them in fstab for your drives and their NFS shares you want to export. For example, bind the shares in /mnt to already mounted with fstab or udev drives in /media dir. Then set relevant client, server, and share export options in NFS config files using nano editor. You may use rc.conf to autostart NFS daemons at boot in older OS versions using initscripts, or systemctl tool to enable and start NFS services in current OS releases using systemd:

Code: Select all
pacman -S nfs-utils                                    # install NFS client and server
rpcbind nfs-common nfs-server      # add to daemons list after network in /etc/rc.conf, OR
systemctl enable nfsd.service rpc-idmapd.service rpc-mountd.service rpcbind.service
Domain = alarm.org                      # add server domain and NFS user in /etc/idmapd.conf
mkdir /mnt/USB_Data                                    # create folders for your NFS exports
blkid -o list -c /dev/null                             # list mounted devices by UUID
mount                                   # check drive automount rules and add in /etc/fstab
UUID=C0C01A65D01A34E0 /media/USB_Data ntfs rw,noatime,uid=0,gid=100,umask=002,nls=utf8 0 0
/media/USB_Data /mnt/USB_Data none  bind  0 0    # add drive share bind rules in /etc/fstab
mount -a                                      # remount all drives with rules in fstab
chmod 777 /mnt/USB_Data                       # set rwx share permissions to NFS user
/mnt 192.168.1.25(rw,fsid=0,no_subtree_check) # add clientIP & share options in /etc/exports
/mnt/USB_Data 192.168.1.25(rw,no_subtree_check,anonuid=0,anongid=100,nohide,async,insecure)
exportfs -arv                                          # reload exported shares
rc.d [start | stop] rpcbind nfs-common nfs-server      # start NFS server or reboot, OR
systemctl start nfsd.service rpc-idmapd.service rpc-mountd.service rpcbind.service


2. In Windows install Client for NFS by opening Control Panel - Programs and Features - Windows features, then selecting Services for NFS (both Administrative Tools and Client for NFS). Open Services for NFS Snap-in in Programs - Administrative Tools, look at Setup Checklist, right click on each service and change if needed Services for NFS and Client for NFS Properties (leave default).

Open Command Prompt as admin and run these commands to complete setup:

Code: Select all
nfsadmin mapping \\mypcname config adlookup=yes addomain=alarm.org     # add NFS server domain
192.168.1.14  alarm.org                       # or add to hosts in windows/system32/drivers/etc
showmount -e alarm.org                        # show exported NFS shares mapping
mount                                         # see mounted shares
mount \\alarm.org\mnt\USB_Data *              # mount as current user to a free drive letter
mount -o anon \\192.168.1.14\mnt\USB_Data Z:  # or mount the share as anonymous user to Z:\
\\alarm.org\mnt\USB_Data                      # or type in Win Explorer to mount under Network
umount [\\alarm.org\mnt\USB_Data | Z:]        # unmount a share when needed
nfsadmin client [stop | start]                # restart NFS Client if needed
net use Z: /delete                            # delete network drive after stopping the client

Don't mount NFS root /mnt to avoid incorrect share sizes reported. If you can't mount a listed with showmount NFS share or restart NFS client, try changing Windows Network Providers priority. If you can't unmount a share or disconnect network drive in Win Explorer-Network, stop Windows NFS Client first, then delete the drive. Restart Win Explorer process in Task Manager if the drive is still there.

3. If you can't write to a NFS share in Win Explorer - try in ArchLinux to chown & chmod its folder owner and permissions in /mnt to your NFS user (default nobody, i.e. anonymous) for read & write ops, OR add anonuid & anongid values as shown in para.1 and/or no_root_squash to the share export options in /etc/exports to identify your Windows NFS user. Look through available NFS export options and troubleshooting tips.

If that doesn't help, add matching user and group ID values in Win7 Registry, i.e. same IDs like UID=0 for root user, GID=100 for users group the exported file systems in ArchLinux were created or binded with in fstab.

Code: Select all
Locate HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default
Create DWORD values AnonymousUid and AnonymousGid in that key
Set them to UID and GID values you want Windows NFS client to use
Restart Windows NFS service via NFS snap-in or Command Prompt

NFS v4 exports v4, 3 and 2 type shares, while Windows 7 NFS Client 3 can support only v3 and 2 type share features. Non-latin file names in UTF8 aren't supported by it, so type mount /? to see encodings choice. For more tips read NFS ArchLinux Wiki and official manuals & docs. Since write ops are Plug CPU drainers, extend its life by choosing the right file system for your Data HD and hooking it first directly to a PC for bulk data copy. Then hook it to your Plug and use NFS for incremental data updates.

4. If you want to accomplish the opposite task - serve files via NFS from Windows to your Plug, install a 3rd party NFS Server to your PC like haneWIN NFS Server or FreeNFS, since MS Windows NFS Server is deprecated. Once your server is configured properly and started as per its Guide, mark folders you want to export as Shared in Win Explorer - Folder Properties, and mount them in ArchLinux /mnt dir on your Plug's drive. You can also define NFS share mount options in fstab and automount them at boot with netfs daemon (unused in systemd). Finally optimize NFS performance:

Code: Select all
pacman -S nfs-utils                                  # install NFS client on the Plug
rpcbind nfs-common @netfs                  # add to client daemons list in /etc/rc.conf, OR
systemctl enable nfsd.service rpc-idmapd.service     # enable services in systemd based OS
showmount -e winserver.org                 # list in Plug shares exported by winserver
mkdir /mnt/Win_Data                        # create folders for your Windows NFS shares
chmod 777 /mnt/Win_Data                    # set rwx share permissions to NFS client's user
rc.d [start | stop] rpcbind nfs-common               # start NFS client manually, OR
systemctl start nfsd.service rpc-idmapd.service      # start services in systemd based OS
mount -t nfs //192.168.1.25:/Data /mnt/Win_Data      # mount a share manually on the Plug
//192.168.1.25:/Data /mnt/Win_Data nfs defaults 0 0  # or automount with rule in /etc/fstab
umount /mnt/Win_Data                       # unmount a share. Kill linked processes if can't
lsof +D /mnt/Win_Data                                # show processes with open share files
dd count=100 bs=1M if=/dev/zero of=/mnt/Win_Data/test oflag=async   # test write speed
dd bs=1M if=/mnt/Win_Data/test of=/dev/null          # check read speed
htop                                       # install htop to check CPU load at writing


You're all set. :D
Last edited by sambul13 on Thu Nov 08, 2012 1:11 pm, edited 64 times in total.
sambul13
 
Posts: 258
Joined: Sat Aug 18, 2012 10:32 pm

Re: NFS on Pogo and Windows

Postby WarheadsSE » Sun Sep 09, 2012 1:51 am

"Popular" is Samba. An alternative to Samba is NFS on Windows, for those that have that capability, which not all do.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6729
Joined: Mon Oct 18, 2010 2:12 pm

Re: NFS on Pogo and Windows

Postby sambul13 » Mon Sep 10, 2012 1:24 pm

Yes, Windows NFS Client is supplied (but not installed by default) with Windows 7 Professional, Ultimate and Enterprise editions only. If one uses a different edition, a 3rd party free NFS Client like this one or a commercial NFS client for Windows with Unicode support can be installed.

One of Samba advantages I found is it automounts the server shares on a Windows PC in Win Explorer - Network once started on a Plug Computer. With NFS one needs to manually mount the shares by entering their address in Win Explorer, or permanently map each share to a network drive. Samba also supports file names in Unicode. On the up side, NFS performance may be easier to optimize, and it doesn't freeze so often Win Explorer when the server is stopped.
Last edited by sambul13 on Sat Sep 22, 2012 4:47 pm, edited 4 times in total.
sambul13
 
Posts: 258
Joined: Sat Aug 18, 2012 10:32 pm

Re: NFS on Pogo and Windows

Postby Hypnosis4U2NV » Mon Sep 10, 2012 10:07 pm

Trying to get this going but when I mount -a, it won't mount the created dir..
Hypnosis4U2NV
 
Posts: 62
Joined: Sat Aug 06, 2011 11:41 pm

Re: NFS on Pogo and Windows

Postby sambul13 » Mon Sep 10, 2012 10:25 pm

Add UUID based fstab rule for each FS in /media dir you want to bind with, i.e. simply match fstab rule options with udev-automount's for that device type saved in /etc/udev/rules.d if any, or use web examples for your FS if none.

Have your FSs mounted in /media with udev-automount or systemd-udev after boot, or at boot or manually based on your fstab rules, create corresponding dirs in /mnt and bind rules in fstab for NFS shares, then they will be remounted in /mnt with mount -a command as new devices.
Last edited by sambul13 on Mon Oct 01, 2012 2:05 pm, edited 1 time in total.
sambul13
 
Posts: 258
Joined: Sat Aug 18, 2012 10:32 pm

Re: NFS on Pogo and Windows

Postby Hypnosis4U2NV » Tue Sep 11, 2012 9:50 pm

sambul13 wrote:Add UUID based fstab rule for each FS in /media dir you want to bind with, i.e. simply match fstab rule options with udev-automount's for that device type saved in /etc/udev/rules.d if any, or use web examples for your FS if none.

Have your FSs mounted in /media with udev-automount after boot, or at boot or manually based on your fstab rules, create corresponding dirs in /mnt and bind rules in fstab for NFS shares, then they will be remounted in /mnt with mount -a command as new devices.


Forgot to mention that I am a Linux noob, so most of that went over my head.. But I am going to try to follow along if I could.. FYI as to why I want to try NFS shares vs Samba: I was able to stream reliably to my WDTV Live Plus using Samba but lately the movies will stop playing at random scenes and when they start again they actually fast forward to catch up to where the movie should be playing.. The WDTV forums have long recommended NFS to stream media, but I seem to be having problems with both Samba and MiniDLNA over hard wired gigabit connections.. Configuring NFS isn't as easy, or at least isn't clicking in my head, as well as the instructions for setting up Samba and MiniDLNA..
Hypnosis4U2NV
 
Posts: 62
Joined: Sat Aug 06, 2011 11:41 pm

Re: NFS on Pogo and Windows

Postby sambul13 » Wed Sep 12, 2012 12:03 am

I updated the above NFS Guide to include fstab rule example. Local guides are great for novices, but they don't cover some stuff one may need down the road. Compare for example MiniDLNA Wiki on Archlinux and ARM sites: I always read both if available.

Is Samba a primary WDTV Live Plus' method to access PC files, or you had to mod its FW to bypass DLNA format restrictions? I used to have WDTV Live Hub, its quite capable contender in codecs support, but very slow in file ops. Defragmenting your movie collection may help in your case.
Last edited by sambul13 on Wed Sep 12, 2012 1:07 am, edited 1 time in total.
sambul13
 
Posts: 258
Joined: Sat Aug 18, 2012 10:32 pm

Re: NFS on Pogo and Windows

Postby Hypnosis4U2NV » Wed Sep 12, 2012 12:36 am

I guess Samba is the primary way to access PC files, the firmware natively handles DLNA files also.. I can pull up the Samba shares and the DLNA files separately.. Funny thing is I have no problems streaming the same files from the PC, so it seems the Pogoplug is choking somewhere..
Hypnosis4U2NV
 
Posts: 62
Joined: Sat Aug 06, 2011 11:41 pm

Re: NFS on Pogo and Windows

Postby bodhi » Wed Sep 12, 2012 3:47 am

Guys,
Samba on the plugs is perfectly fine for serving HD videos over Gigabit wire. I never have problem. I'd suggest you look at other problem you might have. If you can set up NFS to work easily for your network then by all means, but I suspect other factors might be in play.
bodhi
 
Posts: 224
Joined: Sat Aug 13, 2011 10:06 am

Re: NFS on Pogo and Windows

Postby Hypnosis4U2NV » Wed Sep 12, 2012 7:17 pm

I would love to know why I am having these issues all of a sudden as SAMBA did work for me very well in the past.. I think I have to narrow it down to probably the main switch on my home network (TrendNET TEG-S80G) although I can't be too sure..
Hypnosis4U2NV
 
Posts: 62
Joined: Sat Aug 06, 2011 11:41 pm

Next

Return to Community Guides

Who is online

Users browsing this forum: No registered users and 1 guest