Verify SD card, mounted via USB, can be exported via NFS
|Status:||Closed||Start date:||07 Jul 2013|
|Category:||04 - Root File System|
|Severity:||02 - High|
Make sure NFS is enabled in kernel.
Make sure NFS client is available in rootfs.
For the version of nfs-utils in Buildroot, see the old NFS howto:
#1 Updated by Hammel over 7 years ago
- % Done changed from 0 to 20
kernel support nfs client/server. Rootfs needs nfs-utils enabled.
Buildroot 2013.02's nfs-utils version is 1.2.6. Latest sourceforge release is 1.2.8. Bump that and push upstream if latest is not 1.2.8 (which it doesn't appear to be).
#5 Updated by Hammel over 7 years ago
- % Done changed from 30 to 50
nfs support tested on target by exporting /root. This was mounted to my build host cleanly and unmounted cleanly. So nfs is working in PiBox.
Now I need to try it by mounting a USB SD card and then exporting that SD card to see if I can play a movie that way. I'll need a new 10-port hub to replace the 4 port powered hub I'm currently using.
#6 Updated by Hammel over 7 years ago
sdcard is mounted on target under /sdcard/a. Permissions are:
# ls -lR /sdcard /sdcard: drwxr-xr-x 3 root root 4096 Aug 18 20:51 a /sdcard/a: -rw-rw-r-- 1 3123 3123 1005108923 Aug 15 2012 Incredibles.mp4 drwx------ 2 root root 16384 Aug 18 20:33 lost+found
Mounting on build host works, but permissions are not mapped correctly:
mjhammel(tty5)$ sudo ls -lR /mnt/sdcard /mnt/sdcard: total 4 drwx------ 2 root root 4096 Jan 1 1970 a /mnt/sdcard/a: total 0 mjhammel(tty5)$ df -m | grep sdcard pibox:/sdcard 1783 784 909 47% /mnt/sdcard
This may be a problem with the exports file on the target:
# cat /etc/exports /root *(sync,rw,no_root_squash,insecure) /sdcard *(sync,rw,no_root_squash,insecure)
These very open settings are what I use at home and they work between major distributions. So I'm not sure what might be missing on the target. The only log message is:
Aug 20 14:45:55 (none) user.warn kernel: [ 1621.844911] nfsd: nfsv4 idmapping failing: has idmapd not been started?
idmapd is not included in the rootfs but is available (for example) in Fedora 16. So maybe that's the problem.
#7 Updated by Hammel over 7 years ago
Take a look at this: https://wiki.archlinux.org/index.php/NFS
It assumes use of NFS4, and the Buildroot build seems to disable this. But maybe that's the problem. However, since I can mount /root from the target to the build host I think the real problem may have something to do with the way I mount the USB SD card. Maybe implementing autofs will help with this (see RM #195).
#8 Updated by Hammel over 7 years ago
- % Done changed from 50 to 60
Okay, the trick seems to be that you can't just export the top level directory anymore. Given this mount on the target:
mount -t ext3 -o rw /dev/sda1 /sdcard/a
has this content:
/sdcard/a: -rw-rw-r-- 1 3123 3123 1005108923 Aug 15 2012 Incredibles.mp4 drwx------ 2 root root 16384 Aug 18 20:33 lost+found
You have to export the directory you want the client to mount. So the following /etc/exports file on the target:
/root *(sync,rw,no_root_squash,insecure,no_subtree_check) /sdcard *(sync,rw,no_root_squash,insecure,no_subtree_check) /sdcard/a *(sync,rw,no_root_squash,insecure,no_subtree_check)
Allows the following mount:
mount -t nfs pibox:/sdcard/a /mnt/sdcard
To show what's under /sdcard/a on the target. If you remove the "/a" from the mount, you only see what's in /sdcard. There must be some kind of exports configuration to allow walking the tree. I hope so because if not then every automount of the USB stick has to mount to the correct directory that is either already listed in /etc/exports or is added to it and S60nfs restarted.
#10 Updated by Hammel over 7 years ago
- % Done changed from 60 to 80
- Severity changed from 01 - Critical to 05 - Very Low
Assuming NFS is working properly, streaming from the NFS mount of the USB attached SD card works fine. I was able to play the video on my desktop, with the video streaming wirelessly. It should be noted that PiBox was configured as an ordinary wireless client, not as an AP.
At this point I just need to get autofs working and then return to this one to make sure the mount points are properly setup for NFS.
#13 Updated by Hammel about 7 years ago
- Status changed from In Progress to Closed
- % Done changed from 80 to 100
NFS isn't really necessary. SMB is installed and working. There are SMB clients for Android and I've verified these can pick up the guest export and stream video from the /media mount point on the PiBox. So I don't really need nfs.
Closing this issue. I'll open another about removing NFS from the default core platform.