Skip to content

Instantly share code, notes, and snippets.

@aldur
Last active December 3, 2023 10:08
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save aldur/4a3f90a111b71662f056 to your computer and use it in GitHub Desktop.
Save aldur/4a3f90a111b71662f056 to your computer and use it in GitHub Desktop.
Mount an NFS share on Android
#!/bin/sh
# Mount an NFS share on Android
# Requirements:
# - Busybox
# - A kernel supporting nfs (either built-in or as a module)
# On my Nexus 7 2012 I use the following kernel:
# http://forum.xda-developers.com/showthread.php?t=2107224
# Remember: if you have problems of system space, simply delete some of the default stuff.
LOCAL_DIRECTORY="/data/media/0/2TB"
REMOTE_URI="192.168.1.101:/srv/nfs/2TB"
# Yes, we need to set permissive SeLinux in order for this to work
# At least on Android 5.0, obviously
setenforce Permissive
# Create the mount directory, if needed
mkdir -p $LOCAL_DIRECTORY
# And actually mount what you need
# You can't mount to /sdcard/ but you CAN mount to /data/media/0
# Better mount ro, BTW
busybox mount -t nfs -o nolock,ro $REMOTE_URI $LOCAL_DIRECTORY
@JohnDoe44526949
Copy link

I mounted a nfs share, but files are only visible with root account. I can't change owner, and android file explorer don't see anything in shared folder.
How do I assign proper permissions to the shared folder so my apps can access it?
Thank you.

@JohnDoe44526949
Copy link

Sorry for the bothering, I spent entire morning to get it working but no luck at all.

@neocanable
Copy link

@JohnDoe44526949 hi man, i got same problem as yours, have your find the solution?

@JohnDoe44526949
Copy link

Nope, sorry.

@neocanable
Copy link

neocanable commented Aug 22, 2019

hi, john, i got it

  1. flash supersu to your device
  2. then use su -mm -c "mount command " execute mount command, your app would access it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment