Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,772,395 Members 47,250 Now Online
XDA Developers Android and Mobile Development Forum

How can I mount a NFS share?

Tip us?
 
Foyaxe
Old
#1  
Junior Member - OP
Thanks Meter 1
Posts: 1
Join Date: Jul 2010
Default How can I mount a NFS share?

Hi,
Im using Cyanogenmod 5.0.8 on my htc Dream (G1).
I want to mount my NFS share with my music collection just as i do it with my pcs.

Code:
su
mount -t nfs 192.168.1.102:/media/media /sdcard/media
mount: mounting //192.168.1.102/media/media on /sdcard/media failed: No such device
Whats wrong?
Is there no NFS client support in the kernel?

Thanks,
Foyaxe
The Following User Says Thank You to Foyaxe For This Useful Post: [ Click to Expand ]
 
Thailandian
Old
#2  
Member
Thanks Meter 6
Posts: 35
Join Date: Aug 2011
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.
The Following User Says Thank You to Thailandian For This Useful Post: [ Click to Expand ]
 
ArneAC
Old
#3  
Junior Member
Thanks Meter 1
Posts: 9
Join Date: Nov 2011
Quote:
Originally Posted by Thailandian View Post
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.
I am getting 'failed invalid argument' ;(
Trying since quite a while now but won't work. Any more hints?

cheers,
 
Thailandian
Old
#4  
Member
Thanks Meter 6
Posts: 35
Join Date: Aug 2011
Quote:
Originally Posted by ArneAC View Post
I am getting 'failed invalid argument' ;(
Well the good news is that 'failed invalid argument' probably means that it's just a typing mistake or something similar. This should be fairly easy to solve.

One idea to check first - you need to create the directory that you want to mount your NFS share onto before you can mount it. If I remember rightly, failing to do that will give you an 'invalid argument' error.

Also, you will need to give the command root privileges - but I think you must have already done that or you would be getting a 'permissions' error rather than 'invalid argument'.

Failing that, I suggest that you copy and paste the command you are using here - although you should replace your server's ip address with x's as I did for security.

Then I can have a look at it to see if there's anything obvious.

Cheers
 
adyroman
Old
#5  
Junior Member
Thanks Meter 1
Posts: 15
Join Date: Oct 2011
You can also use AndSmb from Market to connect to Windows shares or Samba shares on Linux.
 
MountainX
Old
(Last edited by MountainX; 21st February 2012 at 12:42 AM.) Reason: added link
#6  
MountainX's Avatar
Senior Member
Thanks Meter 18
Posts: 244
Join Date: Oct 2009
Location: A place with no mountains
Quote:
Originally Posted by ArneAC View Post
I am getting 'failed invalid argument' ;(
Trying since quite a while now but won't work. Any more hints?

cheers,
I'm getting the same invalid argument. It is not a typo, but I don't know what the cause of the problem is.

in busybox, my commands are:
Code:
su
mount -t nfs 192.168.1.1:/DataVolume/Public ~/Downloads/temp/
adding or removing the various options such as "-o nolock,ro,hard,intr,vers=3"
does not make a difference.

It is not a problem with the local mount point -- that error is "no such file or directory".

This error is "failed: invalid argument" -- even with no arguments other than "-t nfs".

lsmod shows the modules loaded:
nfs 104232 0 - Live 0xbf036000
lockd 42336 1 nfs, Live 0xbf028000
sunrpc 150792 3 nfs,lockd, Live 0xbf000000

Can anyone help? Thanks.

P.S. I'm testing with NFS v3, but my ultimate goal is to connect to an NFSv4 server. Does busybox support NFSv4 mounts?


EDIT: it looks like this error "invalid argument" may be due to a conflict between versions of busybox and linux.
Found this here
Quote:
This is how I interpret it.
kernel is newer - recompile mount command (i.e. busybox etc)
Make sure that it uses the headers from the kernel it will run with.
My linux is 3.0.8-GLaDOS-V1-15
My busybox is 1.19.3-Stericson

Any idea how to proceed?
 
acertabuser
Old
(Last edited by acertabuser; 25th February 2012 at 02:54 AM.)
#7  
Junior Member
Thanks Meter 1
Posts: 14
Join Date: Feb 2012
I ran into this same issue on my new Acer A200 (busybox 1.19.3-Stericson) and my host server is using NFS V3. I'm wondering if your 3.0 server might be using NFS V4 and support is not enabled? Here is an excerpt from my /proc/config.gz on the Acer. Ideally V3 and V4 would have been set.

CONFIG_LOCKD=y
CONFIG_SUNRPC=y
CONFIG_NFS_FS=y
# CONFIG_NFS_V3 is not set
# CONFIG_NFS_V4 is not set
CONFIG_ROOT_NFS=y
# CONFIG_NFSD is not set
CONFIG_NFS_COMMON=y

Now I suppose in my case that if I really want this to work that I'd have to learn how to create a build environment and compile a nfs.ko myself.

EDIT: I just seen that you specifically stated you are testing w/NFS v3
 
MountainX
Old
#8  
MountainX's Avatar
Senior Member
Thanks Meter 18
Posts: 244
Join Date: Oct 2009
Location: A place with no mountains
Quote:
Originally Posted by acertabuser View Post

Now I suppose in my case that if I really want this to work that I'd have to learn how to create a build environment and compile a nfs.ko myself.
That's what I'm thinking too.

In the mean time the short term solutions I'm considering are either samba (CIFS) or SFTP (i.e., the SSH file system). I've been using SFTP in the other direction (PC to phone) and it works great. I haven't test using it on the phone to mount the share from the PC yet, but I hope to do that this weekend.
 
brian_o'fish
Old
(Last edited by brian_o'fish; 26th February 2012 at 07:56 PM.)
#9  
Member
Thanks Meter 43
Posts: 81
Join Date: Mar 2011
Location: Dormagen
Tried to nfs mount from a CM9 running galaxy nexus, kernel self compiled and surely contains NFS (client and server).

Doesn't work, the same way already described here.

Looking at the source and build intermediates, it appears to me that
1) the CM9 compiled busybox does not contain NFS mounting code.
2) busybox does not support mounting NFS v4 at all

Trying to compile busybox with nfs support builtin, breaks because several header files related to
RPC and portmapper appear to be missing from the android sources. Which is probably the reason why
NFS in not in the standard busybox mount...

Oh, how I wish nfs mounting were handled by the kernel, instead of relying on magic code in the userlevel mount...
 
MountainX
Old
#10  
MountainX's Avatar
Senior Member
Thanks Meter 18
Posts: 244
Join Date: Oct 2009
Location: A place with no mountains
Quote:
Originally Posted by brian_o'fish View Post
Tried to nfs mount from a CM9 running galaxy nexus, kernel self compiled and surely contains NFS (client and server).

Doesn't work, the same way already described here.

Looking at the source and build intermediates, it appears to me that
1) the CM9 compiled busybox does not contain NFS mounting code.
2) busybox does not support mounting NFS v4 at all

Trying to compile busybox with nfs support builtin, breaks because several header files related to
RPC and portmapper appear to be missing from the android sources. Which is probably the reason why
NFS in not in the standard busybox mount...

Oh, how I wish nfs mounting were handled by the kernel, instead of relying on magic code in the userlevel mount...
Thanks for sharing your findings. Very interesting. I guess the next option would be to compile the mount command and use that rather than using the BusyBox mount...

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes