How to mount large SD card partition as "/sdcard"

19 25531
dlanor  
Post Last Edited by dlanor at 2014-7-12 17:04

As most of you know, one big problem with the current Android image is that it doesn't mount anything to "/mnt/sdcard", for use through link as "/sdcard" which many apps require, causing them to fail when that path is non-mounted.

And another big problem is that when we use a large SD card for this Android image, the vast majority of the card space gets locked away in an extra partition accessible only as a cryptic subfolder of the "/mnt/extsd" path. (For me it was found as "/mnt/extsd/179-1/") And this is very wasteful, as no apps will use that space for their normal data, nor can any apps ever be installed in that space.

Today I invested some time into solving both of these problems through one simple change.

During my initial attempts to do this I made a lot of modifications back and forth to see how this would affect the results, but in the end I settled for a VERY small modification, which only zeroes a single bit in a single file. That's all it takes...

My tool for this kind of work is always "ES File Explorer", which is a fully free tool available for download from the Google Play Store.

After installing this tool it's necessary to configure it for 'root' work by folding out the 'Tools' list in its left-hand menu and there scroll down to the parameter entry "Root Explorer" and change its status from "OFF" to "ON". That will permit all content of the root directory to be visible, and will also permit modifications to most of that content.

NB: Such operations are powerful and can damage the system beyond recovery if done unwisely. So if you don't feel sure of your hacking skills, it may be a good idea to disable the "Root Explorer" parameter again, after doing the necessary modification I will describe below. (Necessary for getting proper /sdcard usage in this Android implementation.)

Navigate the file explorer window to the "/" root directory, and from there go into the "/etc" directory. Scroll down a little to find a file named "vold.fstab" and click that file. You will then get a popup window asking which filetype you want to open the file as, and the proper choice is "Text". After making that choice you will be given a choice between different tools to open the file, and the proper choice is "ES Note Editor", unless you've installed a better text editor. But my guide text assumes you are using the "ES Note Editor".

At first the text is opened in read-only mode, so to change that you need to click on the 3-dots icon at the top right (or in taskbar) and choose the "Edit" command, which switches the app into editing mode. Now move cursor down to the line that starts with "dev_mount sdcard" and then move cursor close to the end of that line (10 characters in from its end). There you will see the numeric digit "2", which needs to be changed to "0" (thus zeroing a single bit in the character code ).

That change will cause the previously 'lost partition' to be mounted as /mnt/sdcard and also accessible as /sdcard after the next reboot. As a minor side effect the access through "/mnt/extsd" will be lost, but that hardly matters as the old use of that path is not standard usage anyway.

Once the text has been modified you should try to back out of the note editor, which will give you a prompt for whether to save or not, and here you should of course confirm the saving (unless you somehow messed up the text, in which case you should cancel out).

Now all you need do is to back out of "ES File Explorer" and reboot the BPi, after which you should have a healthy "/sdcard" path to satisfy all apps that need it. In my case the /sdcard area gained had a size of 12.62 GB (of my 16 GB card), so I will be able to handle quite a lot of apps before needing to expand with USB or HDD drives.

I hope you all find this method useful.

Best regards: dlanor
Excellent, this was really annoying not being able to browse the file system and this hack works very good.

Thanks
Col

mattrix  
I have managed to open the android images and edit them and re-build.
I will apply your fix and upload a fixed image that everyone can burn while we wait for official image

dlanor  
Great!
I was hoping the fix would be added to an image, so other newcomers can have it working from the start. But I don't have the means of making images of my own... (as yet ! )

Best regards: dlanor

Hey dlanor,

just wanted to thank you for this simple great solution.

pendlru  
Thank you.
Worked perfect !!

deenbee  
Thank you maybe some day I will try

Roy360  
Thanks. This really helps.

P.s is there any way to give apps access to any usb drives plugged in? I want to use my Pi as a NAS, but right now i only have the 32gb left on my sdcard

dlanor  
Apps can already use a USB drive if connected and mounted. The only problem I see with this is that the USB drive is not always mounted automatically at boot, but it is always recognized if I then disconnect and reconnect it.

I use a USB stick to hold several PS1 and PSP ISOs for emulators, and some other large files that I don't want (or can) waste space for in the SD card. Whether or not apps will look for data in the USB drive area is another matter, but well-behaved apps should allow it.

Btw: You must be using a real 'monster' SDXC card in your BPi, to be complaining about having 'only' 32GB left, since that is the absolute upper limit for all who use SDHC cards.

Best regards: dlanor

Thanks very much for posting this fix!

You have to log in before you can reply Login | Sign Up

Points Rules