Last Updated on February 3, 2024 by Jan Bachelor
Do you have a home NAS plus an Android TV (box) or a phone connected to a non-smart TV and want to mount the NAS onto the Android device to watch your movies on a TV? Then check out this article!
How to mount an NFS share to an Android box
- On your Android box, install these apps (e.g. from Google Play):
- SSH Droid – used for SSH access. Remember to change the default password for something complex!
- Busybox – contains a list of commands such as to mount the NFS share. Default path for the installation is in /system/xbin).
- Script Manager (SManager) – used later for running the mounting script upon every boot once tested as working.
- Log into your Android device via SSH Droid. Out of interest, compare the default version of busybox with the one you have just installed:
# Stock version of busybox busybox # Newly installed version /system/xbin/busybox
- Get the NFS share visible to all Android users by disabling SELinux:
su --mount-master getenforce setenforce 0 getenforce # result should be 'Permissive'
- Mount your NFS share
# Mount the NFS share with the -option parameter to read only and nolock: /system/xbin/busybox mount -o ro,nolock IP:/path/to/your/share/on/FreeNAS /path/on/android/to/mount # Create a folder where to mount the NFS share mkdir /mnt/FreeNAS # Example below: /system/xbin/busybox mount -o ro,nolock 192.168.1.17:/mnt/Tank/Kodi /mnt/FreeNAS # Now output indicates it went well. Check it with the following: ls -lah /mnt/FreeNAS
- It may be a good idea to test at this point that you can access the data from within the Android device. You can use an app called EZ File Browser (or any other).
- Convert the command into a script:
# Create a new file in a folder that the system can reach after startup vi /storage/emulated/0/mount_freenas.sh # Press the Insert key (or A) to be able add data. Then copy paste/re-enter the mount line that we tested previously # To save exit the vi editor, press the 'Escape' key, followed by letters 'wq' and the 'Enter' key to confirm.
- Schedule the script on every boot:
- Run SManager in Android, find the script file wherever you saved it and set it to run as ‘bash mount_freenas.sh’. Tick the following parameters:
- Run on boot
- Run as root
- Run on network change (in case of network disconnect and re-connect)
Now reboot your Android box and see if the shares come up again. Allow about 2 minutes after the boot as there is typically a slight delay before the folder is mounted. You can use EZ File Explorer or any other Android app to verify that the path is accessible..
- Mount the path in Kodi Once all done, go to Kodi (XBMC) and set up your share as local (not external or network share), e.g. in /mnt/FreeNAS.