[TouchWiz] Mount ext4 formatted SD cards on TouchWiz ROMs

Search This thread

Darkshado

Senior Member
Apr 16, 2011
1,028
501
Montréal
Nvidia Shield Tablet
Nexus 6
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.

Required:

  • 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 install-recovery.sh 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 install-recovery.sh 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.

Enjoy,

Darkshado
 

Attachments

  • ext4_SD_mount_TW.zip
    145.7 KB · Views: 3,328
Last edited:

SeaFargo

Senior Member
Feb 24, 2011
324
59
Rome
rvd.it
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.
 

SeaFargo

Senior Member
Feb 24, 2011
324
59
Rome
rvd.it
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. :laugh: :good:
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:

Code:
#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/msd2.sh
#if we don't kill server it will drain power like crazy:
adb kill-server
than
Code:
mount -t ext4 /dev/block/mmcblk1p1 /storage/extSdCard && sleep 5 && /system/bin/vold

Thank you in advance for your kind support.

Regards.
 

wassname

Member
Jun 13, 2007
19
20
45
Dodsland
one change

Great, this work for me with one change.

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

Changed zip attached
 

Attachments

  • ext4_SD_mount_TWv2.zip
    145.2 KB · Views: 811
Last edited:

hydroxymoron

Member
Dec 12, 2011
22
2
Thanks for this.

There seem to be at least 2 problems on sgs4 kk

- the external sdcard is not seen by MTP

- it is no longer possible to encrypt the external sdcard.
I get to "SD card encryption has been enabled. Selected options. Full encryption. The above options will be applied", but it just reverts to the same screen when tapping on "apply".
Something similar happened with an exFat formatted card. It seems that Samsung is stuck with FAT32.. so disappointing.
Is there an alternative to FAT32 for encrypting external sdcards on Samsung devices?
 

impactor

Senior Member
Jan 6, 2011
906
136
Kraków
Great, this work for me with one change.

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

Changed zip attached
Great work. But there is one more problem with it. The card is mounted with no-exec permissions, which makes it impossible to install .apk files from the card. You have to copy them to internal and only then can you install the apk file.

Could you fix it and release as v3?
 
  • Like
Reactions: Neo3D
Great, this work for me with one change.

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

Changed zip attached

Could you please update this? I've been trying to get TW support for ext4.

Thank you in advance! :D
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    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.

    Required:

    • 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 install-recovery.sh 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 install-recovery.sh 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.

    Enjoy,

    Darkshado
    3
    one change

    Great, this work for me with one change.

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

    Changed zip attached
    1
    Great, this work for me with one change.

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

    Changed zip attached
    Great work. But there is one more problem with it. The card is mounted with no-exec permissions, which makes it impossible to install .apk files from the card. You have to copy them to internal and only then can you install the apk file.

    Could you fix it and release as v3?