FORUMS

Analysis & Opinion

Top Forum Discussions

How can I mount a NFS share?

1 posts
Thanks Meter: 1
 
By Foyaxe, Junior Member on 5th July 2010, 10:17 PM
Post Reply Subscribe to Thread Email Thread
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: [ View ]
 
 
2nd August 2011, 06:18 PM |#2  
Member
Thanks Meter: 6
 
More
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: [ View ]
18th November 2011, 12:21 PM |#3  
Junior Member
Thanks Meter: 1
 
More
Quote:
Originally Posted by Thailandian

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,
18th November 2011, 03:50 PM |#4  
Member
Thanks Meter: 6
 
More
Quote:
Originally Posted by ArneAC

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
21st November 2011, 10:25 AM |#5  
Junior Member
Thanks Meter: 1
 
More
You can also use AndSmb from Market to connect to Windows shares or Samba shares on Linux.
21st February 2012, 12:03 AM |#6  
MountainX's Avatar
Senior Member
Flag A place with no mountains
Thanks Meter: 24
 
More
Quote:
Originally Posted by ArneAC

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?
Last edited by MountainX; 21st February 2012 at 12:42 AM. Reason: added link
25th February 2012, 02:50 AM |#7  
Junior Member
Thanks Meter: 1
 
More
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
Last edited by acertabuser; 25th February 2012 at 02:54 AM.
25th February 2012, 03:37 AM |#8  
MountainX's Avatar
Senior Member
Flag A place with no mountains
Thanks Meter: 24
 
More
Quote:
Originally Posted by acertabuser


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.
26th February 2012, 07:33 PM |#9  
Member
Flag Dormagen
Thanks Meter: 48
 
More
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...
Last edited by brian_o'fish; 26th February 2012 at 07:56 PM.
26th February 2012, 08:54 PM |#10  
MountainX's Avatar
Senior Member
Flag A place with no mountains
Thanks Meter: 24
 
More
Quote:
Originally Posted by brian_o'fish

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...
27th February 2012, 10:00 PM |#11  
Member
Flag Dormagen
Thanks Meter: 48
 
More
Smile works for me
Quote:
Originally Posted by MountainX

I guess the next option would be to compile the mount command and use that rather than using the BusyBox mount...

Well, there already _is_ nfs mount code in busybox, but it was configured away, because it needs the SUN RPC library, which is missing from Android / Bionic. That issue would probably also exist for mount.nfs from other sources, which would most likely also need additional porting work.

Thus, I snatched the librpc code from uClibc today, and meddled with it until it compiled in my copy of the CM9 sources. Got it to work! I can now NFS mount on my GNex, and the freshly built and installed update.zip was copied onto the device via NFS

I sent the changes to the cyanogen review system. That was my first contribution ever - I have no idea whether they will like it or not.

If you would like to try it out - and have a KERNEL with NFS support compiled in - send me an E-Mail, and I'll send you a statically compiled busybox (approx. 800k) back that you can play with.
The Following User Says Thank You to brian_o'fish For This Useful Post: [ View ]

Read More
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes