External SD card with ext4 under Android (CM10.1)

来源:互联网 发布:linux libx264 编辑:程序博客网 时间:2024/05/21 04:43

https://blog.jplitza.de/2013/07/04/external-sd-card-with-ext4-under-android-cm10-1/

I just bought a new SD card (32 GB) because my old one died with thousands of erroneous blocks. And because this is the single biggest external storage available to me (apart from external hard drives with multiple TB), I want to be able to use this storage to transport large files – like for example HD movies. But with the default FAT32 filesystem, this is impossible: It imposes a 4 GB file size limit, which you easily reach even with DVD quality.

Now googling for nearly an hour for „ext4″ (a much better filesystem, the default one in Linux) and „Android“ didn’t yield anything really useful. The problem: ext4 supports proper permission management as opposed to FAT32, which simply allows anybody to do anything. But this is something that Android has a problem with: Every app runs as its own user and thus a file created by app A can most probably not be read by app B when you store it on ext4.

Note: In Cyanogenmod 11, ext4 formatted SD cards work out of the box.

Now really all you need to make this work is already there – at least in CyanogenMod 10.1. I put the following little script in /data/local/userinit.sh (which is executed by CyanogenMod on startup – if it exists, which it doesn’t by default), which mounts the external SD card to a temporary mountpoint and uses the standard Android binary sdcardto create a world-read-writeable view of this filesystem in /storage/sdcard1 (the place where CyanogenMod 10.1 mounts the external SD card by default):

#!/system/bin/shREALMNT=/mnt/fuse/sdcard1_realif ! [ -d "$REALMNT" ]; then  mkdir "$REALMNT" || exit 1fimount -t ext4 /dev/block/mmcblk1p1 "$REALMNT"sdcard "$REALMNT" /storage/sdcard1 1023 1023 &

So, in contrast to what hundreds of Google results suggested, it is quite simple to use ext4 on an external SD card without the permission hassle – if you know how and have an up-to-date Android. Just wanted to drop these few lines here, hoping someone can use it. Obviously, you need root on you phone to do this, but if you have CM, you already rooted it, so wayne.

Dieser Eintrag wurde veröffentlicht in Computer und verschlagwortet mit Android, CyanogenMod, ext4 vonJan-Philipp Litza. Permanenter Link zum Eintrag.

26 GEDANKEN ZU “EXTERNAL SD CARD WITH EXT4 UNDER ANDROID (CM10.1)

0 0
原创粉丝点击