Startseite > android, oss > Formatting your SD card as EXT4 in Android

Formatting your SD card as EXT4 in Android

I was thinking about formatting my SD card as ext4 for my android phone, as fat32 sucks in several ways. Android does not support this out of the box, with the most problematic limitation being the file permissions on ext4. fat32 has no fancy ACL, while ext4 actually supports file permissions. Given that every app on android runs as its own uid/gid, this is of course problematic, especially for shared directories.

But first things first: we need patches for vold to make Android accept the ext4 fs on the file system. Current Android 2.3 based distributions such as CyanogenMod 7 already come with the necessary file system drivers, so it’s just a matter of telling vold everything is going to be OK. Additionally, we need a patch for the recovery system to make it mount the sdcard properly. You can probably do without this patch if you manually remount /sdcard in the recovery, e.g. using adb. In any case, a working recovery is not necessary for day-to-day operation but it will come in handy if fecal matter starts hitting the ventilation device. The patches can be found on xda, thanks to user DebauchedSloth. A pre-compiled vold is provided by user Xziped.

This will make Android mount the ext4 formatted SD card properly. There’s still the permission problem, however. Several solutions are proposed.

  • Run chmod 777 every once in a while to fix permissions
  • Monitor the sdcard for changed/new files and run chmod accordingly
  • Use yet another patch provided by DebauchedSloth which uses a FUSE-based utility to transparently ignore file permissions, mimicking fat32 behavior on any file system. (ticket 1928, ticket 1929)

These options, in my not so humble opinion, all suck. I’m not going to fuck around with a terminal regularly just to have an usable phone. I also don’t believe that constantly monitoring the file system for changes will improve battery life or performance. The third approach with FUSE apparently kills performance.

I propose a fourth workaround, as fixing Android core itself is obviously not going to happen – people need to read their SD cards on windows and only neckbeards like me care about ext4 at all. My workaround would consist in adding a mount option to ext4 to essentially ignore file permissions, or rather report 777 for everything back to the VM layer. It looks like fs/ext4/acl.c might be relevant here.

Frankly, I do not care enough right now to make this happen. And yes, I am aware that my proposal still seems indicative of crystal meth consumption.

As an additional caveat: Android saves some app data on the sdcard in /sdcard/.android-secure – until I understand what exactly is going on there, I’d probably be wary of just mocking around with permissions. On the other hand, it’s unlikely to result in problems, because what will be more insecure than fat32?

Kategorien:android, oss
  1. Donald Duck
    25. Juni 2012 um 12:04 am

    I have a good old HTC Desire. Internal memory is sparse. I’m trying to move what I can to the SD. Particularly the apps loading /data/data with stuff are an annoyance. Today I tried moving the /data/data/ contents to the SD card using symlinks. While this works for maps and other apps, it doesn’t for skype. It seems that skype is angry about not finding the app’s ownership. That’s why I thought using ext4. Reading about all the fuck-ups I may rather buy a new phone with more internal memory instead…

  2. Kevin Chadwick
    8. Februar 2013 um 8:15 pm

    It should only require the umasks changing, sacrificing filesystem permissions is like throwing a lot of security out that may be useful and even more reliable than androids current IPC model.

  1. No trackbacks yet.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )


Verbinde mit %s

%d Bloggern gefällt das: