How can I mount a NFS share?

Search This thread

xywin

Member
Mar 3, 2010
12
4
I have no working NFSv4 setup here so I couldn't test it. I just added the modules in case I'd find the time to set one up.
 

brian_o'fish

Senior Member
Mar 2, 2011
82
49
Dormagen
nfs v3 mounting merged in cyanogenmod 9

My change to make "busybox mount -t nfs" work for nfs v3, has been merged this morning into the cyanogenmod 9 base source, and should be in the next nightly.

The neccessary (nonmodular) kernel code is also in there, for Galaxy Nexus devices. Talk to your cyanogenmod kernel maintainer regarding other devices.
 

MountainX

Senior Member
My change to make "busybox mount -t nfs" work for nfs v3, has been merged this morning into the cyanogenmod 9 base source, and should be in the next nightly.

The neccessary (nonmodular) kernel code is also in there, for Galaxy Nexus devices. Talk to your cyanogenmod kernel maintainer regarding other devices.

Congratulations! That's great news. I'm sure you are happy to have your code incorporated into CM9. That's a nice achievement.

It sounds like I'll be loading the next nightly build onto my Galaxy Nexus. Thank you!
 

jfluckey

Member
Dec 14, 2011
18
0
Noob here. I think I am following along o.k., but want to know if this is persistent or if I will need to do this every time I reboot. I will be trying this tomorrow on my HP Touchpad running the nightlies of CM9. Thanks!
 

brian_o'fish

Senior Member
Mar 2, 2011
82
49
Dormagen
Noob here. I think I am following along o.k., but want to know if this is persistent or if I will need to do this every time I reboot. I will be trying this tomorrow on my HP Touchpad running the nightlies of CM9. Thanks!

There is no attempt made at persistence, no settings app, nothing user friendly, just plain old infrastructure.

Right now, I have no intention to work on such.

Any proper kind of persistence would need to hook into connectivity up/down notifications, unmounting and mounting on demand when certain configured WLANs become active or inactive.

It would also need a rational approach at where mount points should be, and possibly creating mount point directories again after system upgrades or reboots.

----------------------------

Other topic: being a happy owner of a Transformer Prime, since yesterday afternoon, and promptly converted to CM9 without much hassle, I am glad to see that nfs mounting works on that platform, too :)
 

geva

Member
Feb 17, 2009
11
1
Unfortunately, this post probably comes way too late for the original poster, but it may be useful for anyone else, like me, who stumbles across this thread looking for a way to mount nfs on Android devices.

The answer is to use busybox.

There is support for nfs version 3 in the kernel, but the standard mount command seems to have been hobbled. The busybox mount command seems to work exactly the same as the standard linux mount command (except that it actually works on Android :))

After downloading busybox from the Android Market, this is the command I use:

Code:
busybox mount -o nolock,ro,hard,intr,vers=3 -t nfs 192.xxx.xxx.x.x:/your/nfs/share /mnt/sdcard/YourLocalFolder

I'm not sure how important all the options are, but I suspect that vers=3 is important at least. nolock, hard and intr are also useful when having problems mounting according to the mount man page.
Another answer is simply to use the CIFS Manager app. It seems to be doing the same thing in the background, but provides a bit simpler means to do it.
 

jfluckey

Member
Dec 14, 2011
18
0
Thanks for the reply. I will try to go the route of the CIFSManager after I verify that I can get it to mount via the busybox mount command.

On my server, I have the following in my /etc/exports file:
Code:
/media/sdc1     192.168.1.0/24(rw,sync,no_subtree_check)

Again, I am running the nightly CM9 for the touchpad (latest release 3/30) so I am assuming the kernel change by brian_o'fish is included.

I then ran:
Code:
su
busybox mount -t nfs 192.168.1.149:/media/sdc1 /sdcard/mounts/shows/
but I get the response: No such device

I was able to mount on my server for a test just fine. So, what did I miss along the way?

I forgot to mention, the permissions for my mount point are d---rwxr-x. I apologize for my ignorance. Like others, I would like to access media on my tablet.
 
Last edited:

brian_o'fish

Senior Member
Mar 2, 2011
82
49
Dormagen
Code:
su
busybox mount -t nfs 192.168.1.149:/media/sdc1 /sdcard/mounts/shows/
but I get the response: No such device

Things to check:

Have a look at /proc/filesystems - do you see nfs in there? If not, maybe you need to load a kernel module on your device for nfs client support. My contribution was just to the busybox mount code; I have no idea about the state of the kernel for devices I don't own.

After
Code:
-t nfs
add
Code:
-o nolock
. When I leave that out I get a "connection refused", but maybe that's different in your situation.

First run
Code:
su
alone to get a root shell, then the busybox command. Any change? There might be a difference in PATH and you run the wrong busybox. The one that works should be in /system/xbin/busybox, afaik.

If that still does not help, get a root shell, run
Code:
type busybox
to see the full path of the busybox that would get called, then run
Code:
strings /path/of/that/busybox | grep nfs
- that should show you some lines from the executable that won't be there if you have a busybox without nfs mount support. Mine shows:

Code:
unknown nfs status return value: %d
unknown nfs mount parameter: %s=%d
unknown nfs mount option: %s%s
nfs socket
nfs bindresvport
nfsprog
nfsvers
 
Last edited:

jfluckey

Member
Dec 14, 2011
18
0
All the busybox stuff was there as you assumed with the same executables as you have. However, I did not have nfs in /proc/filesystems. I saw ntfs if that is similar or helpful. Do I need to drop some files on my system or does this require messing with the kernel? AS always, your help is greatly appreciated.
 

MountainX

Senior Member
All the busybox stuff was there as you assumed with the same executables as you have. However, I did not have nfs in /proc/filesystems. I saw ntfs if that is similar or helpful. Do I need to drop some files on my system or does this require messing with the kernel? AS always, your help is greatly appreciated.

ntfs is a microsoft file system (I think it stands for new technology file system and it came out with Windows NT). obviously, that's unrelated

nfs is a Sun/unix/linux protocol - it stands for network file system. See https://en.wikipedia.org/wiki/Network_File_System
 

brian_o'fish

Senior Member
Mar 2, 2011
82
49
Dormagen
I did not have nfs in /proc/filesystems. I saw ntfs if that is similar or helpful. Do I need to drop some files on my system or does this require messing with the kernel?

NTFS has nothing to do with it.

I just had a look at the tenderloin (touchpad) kernel support in CM9. There is no NFS built into the kernel, or you would see it in /proc/filesystems, and there is no loadable NFS client module either.

So, right now, you would have to set up a kernel build environment, locate the right kernel tree for your device, and set about compiling the module yourself. As I don't own the device, I cannot help you any further, sorry.

However, I dropped an E-Mail to the person who last updated the tenderloin kernel, asking whether he could include the NFS client. We'll see how this goes.
 
  • Like
Reactions: jfluckey

jfluckey

Member
Dec 14, 2011
18
0
ntfs is a microsoft file system (I think it stands for new technology file system and it came out with Windows NT). obviously, that's unrelated

nfs is a Sun/unix/linux protocol - it stands for network file system.

Thanks. I should have edited my post as I did a google search for it after I asked the question. I knew nfs, but it was the first time seeing ntfs. :eek:

---------- Post added at 08:22 AM ---------- Previous post was at 08:15 AM ----------

NTFS has nothing to do with it.

I just had a look at the tenderloin (touchpad) kernel support in CM9. There is no NFS built into the kernel, or you would see it in /proc/filesystems, and there is no loadable NFS client module either.

So, right now, you would have to set up a kernel build environment, locate the right kernel tree for your device, and set about compiling the module yourself. As I don't own the device, I cannot help you any further, sorry.

However, I dropped an E-Mail to the person who last updated the tenderloin kernel, asking whether he could include the NFS client. We'll see how this goes.

I really appreciate this. You went out of your way to send the e-mail. I would have posted in the rootzwiki forums last night, but I couldn't get an account set up on my touchpad (browser was having problems with key captcha puzzle), and I was too lazy to go downstairs. :)
 

jfluckey

Member
Dec 14, 2011
18
0

guano30

Senior Member
Aug 28, 2007
184
19
Hi!

Found that amazing Post and tried your files.
Installing and modprobe is OK.
But get several error messages from Terminal when I try to mount my NFS Share.

How must a NFS Mount look like for the HP Touchpad?

Code:
mount -t nfs IP-Adresse:/var/mnt/hdd /sdcard/mnt/nfs -o rw,intr,soft,udp,nolock,rsize=8192,wsize=8192

wont work.

Thanks for your amazing work also with the MIC on the Touchpad!
 

jfluckey

Member
Dec 14, 2011
18
0
Hi!

Found that amazing Post and tried your files.
Installing and modprobe is OK.
But get several error messages from Terminal when I try to mount my NFS Share.

How must a NFS Mount look like for the HP Touchpad?

Code:
mount -t nfs IP-Adresse:/var/mnt/hdd /sdcard/mnt/nfs -o rw,intr,soft,udp,nolock,rsize=8192,wsize=8192

wont work.

Thanks for your amazing work also with the MIC on the Touchpad!

You need to use the busybox command found earlier in this thread. Are you sure you are hosting nfs from your server? I will respond later when I have my TP handy for the actual commands I use.

1.) The modprobe needs to be done after reboot.
2.) The busybox mount needs to be done after modprobe.
 

guano30

Senior Member
Aug 28, 2007
184
19
woo woo woo........

Yep with busybox it works!

I have a server 2008 running nfs server from hanewin.....

cifs sucks....... I also had massive Problems using it with my Dreambox....

So i decided to use Hanewin and hey........ it runs like Hell with NFS.....

Many Thanks!!

EDIT:

Wich Parameters you use ?
Are there improvements wich speed up the connection? thinking about rsize and wsize.......notree..........

A chance to load it automaticly when TP starts??

EDIT 2:

damn!
After restarting the TP modprobe nfs dont work anymore :(
there is an error message

modprobe: chdir(/lib/modules): no such file or directory

i flashed the zip again but nothing happens.......
what do i wrong?
 
Last edited:

jfluckey

Member
Dec 14, 2011
18
0
Glad it worked out for you (initially).

You don't need to reflash each time. You just have to run "su" "modprobe nfs". You sure you used "su" to gain super user?

I haven't automated it after reboot. I did write a script, but I haven't found out how to run it at boot. Therefore, I just open the script and copy/paste the commands each time I reboot.

As far as parameters, I don't think I used anything other than what was posted in this thread. I will verify when I get home. However, with parameters I am using, I haven't had any problems playing 720p mkv's.
 

guano30

Senior Member
Aug 28, 2007
184
19
its crazy!

All worked fine......

After Rebooting and going to terminal i got that error message.....

I installed an other Terminal app that gets SU rights...... so thats not the point...

Dont know what went wrong........

I do nothing else than reboot the device.......

any ideas ?

EDIT:

Well I guess somehow and I dont know how I damaged the Filesystem with that Experiment.
On my 2nd Touchpad everything is allright, also after reboot.
maybe it belongs in which order I install both?

first busybox then the nfs.zip ?

like this I do it on my 2nd Touchpad......

well I ll do a backup from 2nd and flash it on the demaged........ lets see if this work!
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    Unfortunately, this post probably comes way too late for the original poster, but it may be useful for anyone else, like me, who stumbles across this thread looking for a way to mount nfs on Android devices.

    The answer is to use busybox.

    There is support for nfs version 3 in the kernel, but the standard mount command seems to have been hobbled. The busybox mount command seems to work exactly the same as the standard linux mount command (except that it actually works on Android :))

    After downloading busybox from the Android Market, this is the command I use:

    Code:
    busybox mount -o nolock,ro,hard,intr,vers=3 -t nfs 192.xxx.xxx.x.x:/your/nfs/share /mnt/sdcard/YourLocalFolder

    I'm not sure how important all the options are, but I suspect that vers=3 is important at least. nolock, hard and intr are also useful when having problems mounting according to the mount man page.
    3
    I did a basic speed test download in the same conditions to test the speed difference between samba and nfs over my 802.11g Wifi and although I expected NFS to be faster, I never expected it to be almost twice as fast as Samba!

    Code:
    root@android:/ # ls -l /mnt/cifs/Kits/250M
    -rw--w---- 503      system   262144000 2014-02-20 20:55 250M
    root@android:/ # time dd if=/mnt/cifs/Kits/250M of=/dev/null
    512000+0 records in
    512000+0 records out
    262144000 bytes transferred in 200.061 secs (1310320 bytes/sec)
       3m20.62s real     0m0.97s user     0m11.37s system
    root@android:/ #
    root@android:/ # time dd if=/mnt/nfs/Kits/250M of=/dev/null
    512000+0 records in
    512000+0 records out
    262144000 bytes transferred in 119.271 secs (2197885 bytes/sec)
       1m59.30s real     0m1.29s user     0m8.70s system
    root@android:/ #
    root@android:/ # mount | grep Kits
    192.168.1.5:/DataVolume/Kits /mnt/nfs/Kits nfs ro,relatime,vers=3,rsize=16384,wsize=16384,namlen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.5,mountvers=3,mountproto=tcp,local_lock=all,addr=192.168.1.5 0 0
    //192.168.1.5/Kits /mnt/cifs/Kits cifs rw,relatime,sec=ntlm,unc=\\192.168.1.5\Kits,username=adrianp,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.1.5,unix,posixpaths,serverino,acl,rsize=16384,wsize=131007,actimeo=1 0 0
    2
    Unfortunately, this post probably comes way too late for the original poster, but it may be useful for anyone else, like me, who stumbles across this thread looking for a way to mount nfs on Android devices.

    The answer is to use busybox.

    There is support for nfs version 3 in the kernel, but the standard mount command seems to have been hobbled. The busybox mount command seems to work exactly the same as the standard linux mount command (except that it actually works on Android :))

    After downloading busybox from the Android Market, this is the command I use:

    Code:
    busybox mount -o nolock,ro,hard,intr,vers=3 -t nfs 192.xxx.xxx.x.x:/your/nfs/share /mnt/sdcard/YourLocalFolder

    I'm not sure how important all the options are, but I suspect that vers=3 is important at least. nolock, hard and intr are also useful when having problems mounting according to the mount man page.

    Very happy to find NFS baked into this kernel (looking at you, Apple!), but running the mount command prefixed with "busybox" would not work for me on the FTV Stick. No output to stdout/stderr, and it's return code was 0, but nothing actually mounted -- not sure what was going on there. Of course, just running "mount -o ..." isn't an option, because that's the wonky /system/bin/mount that doesn't work à la Invalid Argument.

    Instead, I had to give the full FS path of the busybox mount binary in /system/xbin to finally get it working.
    Code:
    [B]/system/xbin/[/B]mount -o nolock,ro,hard,intr,vers=3 -t nfs 192.xxx.xxx.x.x:/your/nfs/share /mnt/sdcard/YourLocalFolder

    Thanks for pointing me in the right direction.
    2
    Here's my recepie for mounting NFS shares on my Galaxy S3, running NeatRom 2.8 (Derived from SlimKat 2.8) and with Boeffla-Kernel:

    Code:
    #remount the root filesystem rw so that we can create the mountpoint
    /sbin/busybox mount -o remount,rw /
    #create the mountpoint
    /sbin/busybox mkdir -p /mnt/nfs/Download
    #make the mountpoint world readable so that all user apps can access it
    /sbin/busybox chmod 777 /mnt/nfs
    /sbin/busybox chmod 777 /mnt/nfs/Download
    #remount / as ro
    /sbin/busybox remount,ro /
    #mount the actual NFS share (on 192.168.1.5:/DataVolume/Download
    su --mount-master -c "/sbin/busybox mount -o nolock,ro,hard,intr,vers=3 -t nfs 192.168.1.5:/DataVolume/Download /mnt/nfs/Download"
    #check that it was mounted
    mount | grep /mnt/nfs/Download

    Using this method (and having world readable permissions on my shared files) I am able to access the files both with a root explorer (ES File Manager) and with non-root apps (MXPlayer, QuickPic). Without running the chmod on the created folders I am only able to access them with a root explorer.

    Let me know if you need additional help, and a million thanks to @brotbuexe for pointing out the mount-master trick (I was actually looking into injecting commands into adb before finding out of this switch).


    Great!
    It did the job!
    thanks you!
    2
    Here's my recepie for mounting NFS shares on my Galaxy S3, running NeatRom 2.8 (Derived from SlimKat 2.8) and with Boeffla-Kernel:

    Code:
    #remount the root filesystem rw so that we can create the mountpoint
    /sbin/busybox mount -o remount,rw /
    #create the mountpoint
    /sbin/busybox mkdir -p /mnt/nfs/Download
    #make the mountpoint world readable so that all user apps can access it
    /sbin/busybox chmod 777 /mnt/nfs
    /sbin/busybox chmod 777 /mnt/nfs/Download
    #remount / as ro
    /sbin/busybox remount,ro /
    #mount the actual NFS share (on 192.168.1.5:/DataVolume/Download
    su --mount-master -c "/sbin/busybox mount -o nolock,ro,hard,intr,vers=3 -t nfs 192.168.1.5:/DataVolume/Download /mnt/nfs/Download"
    #check that it was mounted
    mount | grep /mnt/nfs/Download

    Using this method (and having world readable permissions on my shared files) I am able to access the files both with a root explorer (ES File Manager) and with non-root apps (MXPlayer, QuickPic). Without running the chmod on the created folders I am only able to access them with a root explorer.

    Let me know if you need additional help, and a million thanks to @brotbuexe for pointing out the mount-master trick (I was actually looking into injecting commands into adb before finding out of this switch).