Post Reply

[TouchWiz] Mount ext4 formatted SD cards on TouchWiz ROMs

OP Darkshado

2nd October 2013, 06:11 PM   |  #1  
Darkshado's Avatar
OP Senior Member
Thanks Meter: 464
993 posts
Join Date:Joined: Apr 2011
Donate to Me
Hello everyone,

Background: Last January I wanted to mount an ext4 formated SD card, and it turned out to be a bit more difficult than just inserting it in my Note II. Back then, there was no exFAT support whatsoever in AOSP ROMs and I wanted to be able to run either TouchWiz or AOSP without having to reformat my card. FAT32 wasn't an option because of the 4GB limit.

I've since automated the methods that were devised in my previous thread (with due credit to @ttabbal), and since they should work on a variety of devices running TouchWiz ROMs, I thought it would be best to create a new thread in a more general location.

The usual caveats apply.

  • TouchWiz ROM
  • init.d support
  • a custom recovery that mounts ext4 SD cards properly, or a mounting updater-script. TWRP works out-of-the-box on my Note II.
You can get init.d support with the stock kernel on many devices by having the run-parts command launch from a custom script. See the following thread for files and a how-to:

[MOD]Term-init & Zip-init: Enable Init.d for Any Phones w/o Need of Custom Kernels!!!

SD card removal:

Should you need to remove the card it can be unmounted and safely removed from the storage settings as usual. Mounting it again requires either a reboot or manually executing the init.d script and then activating the card in the storage settings.

Technical considerations:

The mounting occurs early enough during the boot process that the media scanner and MTP services have no issues with this.

If your init.d support comes from the trick, CWM will prompt to delete the script before reboot. Don't.

If the mounting script doesn't run for some reason, or you try to activate the card before having mounted it manually, the phone will give an error and ask if you want to format the card. Don't.


Attached Files
File Type: zip - [Click for QR Code] (145.7 KB, 702 views)
Last edited by Darkshado; 2nd October 2013 at 09:14 PM. Reason: Forgot to upload the file the first time around...
The Following 4 Users Say Thank You to Darkshado For This Useful Post: [ View ]
25th February 2014, 02:25 PM   |  #2  
SeaFargo's Avatar
Senior Member
Flag Rome
Thanks Meter: 32
252 posts
Join Date:Joined: Feb 2011
Hello Darkshado, and thanks for your thread.

I have an S4 i9505 and I actually have a AOSP based MIUI operating system.
I have an external 16GB MicroSD EXT4 formatted with standard linux command.
I've to say that it works great, and the operating system just auto-mount that ext4 SD by itself..

Now I'm starting migrating from that very good but a little obsolete AOSP MIUI to a much more recent Samsung based version, wich is very complete and affrodable.

But ... this MIUI do not auto-mount my ext4 formatted external-sd.

It's strange because other OS, and other recovery also, do completely support external-sd ext4 filesystem.

MIUI says, from the notification bar, that the sd is not formatted and asks me if I want to procede with formatting.
I've obviously refuse that.

Do you have any suggests?

This MIUI is obviously a custom OS, and it sports 3.4.63-AbyssS4-1.6.1F Kernel.

Since this new MIUI is TW based I've tryed to run your script but without results.. Is there some other way to permanently auto-mount my ext4 external SD?

Kind regards.
27th February 2014, 09:35 AM   |  #3  
SeaFargo's Avatar
Senior Member
Flag Rome
Thanks Meter: 32
252 posts
Join Date:Joined: Feb 2011
Originally Posted by Darkshado

... it turned out to be a bit more difficult than just inserting it in my Note II.

I still find no way to auto-mount the ext4 sd to my Samsung based MIUI, and your scripts does not work on it ...

Can you or anybody help me?

Tnahk you in advance.

Kind regards.
26th March 2014, 02:32 PM   |  #4  
SeaFargo's Avatar
Senior Member
Flag Rome
Thanks Meter: 32
252 posts
Join Date:Joined: Feb 2011
Prompt How to solve the permission issue on MicroSD EXT4 filesystem?
I've find a way to partition and format MicroSD with EXT4 filesystem, and also to mount it properly under this MIUI, wich is a TW based environment.
Just to let you know, AOSP based MIUI is MicroSD EXT4 compatibile out-of-the-box.

Unfortunately, after mounting my ext4 MicroSD, I have permission issue (that I do not have on AOSP):
default chmod is 077, which means that files created by apps on the ext4 formatted SD card will only be readable by the same apps, unless you manually update permissions.

Do you have any suggestion to solve definitively this issue, different than change permission manually or in a batch mode?
I mean, I can not run a script (for batch update chmod) every time I just take a picture ...

My mounting script are:

#making sure adbd is on port 5555:
setprop service.adb.tcp.port 5555
adb kill-server
stop adbd
start adbd
#starting server in a way where proper private key is used:
HOME=/sdcard adb start-server
# connecting server to localhost
adb connect localhost
sleep 2
#actually mounting sdcard and re-running vold :
adb -s localhost:5555 shell su -c /system/xbin/
#if we don't kill server it will drain power like crazy:
adb kill-server
mount -t ext4 /dev/block/mmcblk1p1 /storage/extSdCard && sleep 5 && /system/bin/vold
Thank you in advance for your kind support.

24th April 2014, 11:23 PM   |  #5  
wassname's Avatar
Junior Member
Flag Dodsland
Thanks Meter: 1
9 posts
Join Date:Joined: Jun 2007
one change
Great, this work for me with one change.

In /etc/init.d/10mountext4sd the line:
/system/bin/sdcard1 "$REALMNT" 1023 1023 &
Does not work, unless we change it to
/system/bin/sdcard1 "$REALMNT" /storage/sdcard1 1023 1023 &
Now it works and mounts the sdcard to /storage/sdcard1 nad /stroage/extSdCard

Changed zip attached
Attached Files
File Type: zip - [Click for QR Code] (145.2 KB, 117 views)
Last edited by wassname; 24th April 2014 at 11:27 PM.
The Following User Says Thank You to wassname For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools
Display Modes

Top Threads in Android Software and Hacking General [Developers Only] by ThreadRank