Sharing USB drives with NFS

MontysEvilTwin

Well-Known Member
I set up a Raspberry Pi as a network media player and was sharing content from my HDR-FOX units as NFS shares. On one unit, as well as the expected '/mnt/hd2' mount, there were additional folders listed ('/media/drive1' to '/media/drive4') but there was no content in any of these locations. I traced these entries to '/mod/etc/exports' and as I had an NTFS-formatted, USB hard drive connected to this HDR-FOX, I changed one of the entries in 'exports' to 'media/usb-drive1'. I then tried to mount this location on another HDR-FOX as an NFS share and it worked. I have not tested what gets mounted if you have more than one USB drive attached on boot. Presumably if you have two NTFS drives connected it could mount either. I doubt it would mount a non-NTFS drive based on this entry as other formats are mounted as 'driveX' rather than 'usb-driveX'. You could, of course, add more entries to the 'exports' file if you wanted. On the plus side, a USB drive mounted in this way does not interfere with the drive space calculation on the HDR-FOX (a known problem when mounting '/mnt/hd2' as an NFS share). The one issue I have encountered is that if you want to unmount the drive using the Web-If eject function, you have to stop the NFS service first: this is trivial, there is a toggle switch in Web-If>Service Management. However, if you then rescan the local USB ports (Web-If eject button) while it mounts OK on the local machine, it is not remounted as an NFS share on the remote machine: the local machine has to be rebooted for this to happen. I would wager that this could be fixed though. If anyone is interested, the error messages encountered when I tried to re-establish the NFS share are presented below:
Code:
One# service start nfs                                                        
Starting nfs...                                                               
mount: mounting nfsd on /proc/fs/nfsd failed: Device or resource busy         
Done.                                                                         
One# umount /proc/fs/nfsd                                                     
One# service start nfs                                                        
Starting nfs...                                                               
exportfs: /mnt/hd2/My Video does not support NFS export                       
rpc.nfsd: Setting version failed: errno 16 (Device or resource busy)          
Done.
I also added the entry '/media/My Video' to the exports file. If you set up an NFS share pointing to '/media/My Video' on a remote HDR-FOX this works too (though it does cause the warning '/mnt/hd2/My Video does not support NFS export' to pop up when you start the NFS service) and, as with the USB drive mount, the drive space calculation on the HDR-FOX is unaffected.

FYI the contents of my 'exports' file are shown below:
Code:
"/mnt/hd2"          0.0.0.0/0.0.0.0(rw,insecure,no_root_squash,all_squash,no_subtree_check,anonuid=0,anongid=0)
"/media/My Video"      0.0.0.0/0.0.0.0(rw,insecure,no_root_squash,all_squash,no_subtree_check,anonuid=0,anongid=0)
"/media/usb-drive1"      0.0.0.0/0.0.0.0(rw,insecure,no_root_squash,all_squash,no_subtree_check,anonuid=0,anongid=0)
 
I'm a bit confused. Sharing via Samba includes the USB drives, and with external mounts mapped as USB drives this can lead to infinite regression. I didn't think sharing with NFS included USB drives.
 
I'm a bit confused. Sharing via Samba includes the USB drives, and with external mounts mapped as USB drives this can lead to infinite regression. I didn't think sharing with NFS included USB drives.
The tweaks I mentioned above make no difference to the default mount: if you mount '/mnt/hd2' the contents of this location (My Video, My Music, My Photo, folders etc.) become available as a simulated USB drive on the remote machine. If you mount '/media/My Video' just the contents of the My Video folder are mounted and if you mount '/media/usb-drive1' just the contents of the USB drive are mounted. None of the above lead to infinite regression. Neither of these mounts cause problems with the drive space calculation on the HDR-FOX, unlike mounting '/mnt/hd2', and I have found that streaming high def. recordings is much more reliable with NFS compared to SMB shares: over WiFi the difference is significant.
 
Back
Top