FORUMS

[HACK] mount sdcard as ext4

459 posts
Thanks Meter: 76
 
By DebauchedSloth, Senior Member on 27th December 2010, 03:11 PM
Post Reply Email Thread
These patches add ext4 support for your sdcard (in the Nexus S - the internal card.) There are a number of reasons you might want to do this - performance (ext4 is faster, plus mounting ext4 is basically instantaneous, which is very nice on reboots...no more checking sdcard), it's more efficient, you get a bunch of file system security features (if you care...)

You should not apply them if you don't really know what you are doing. The patches are resonably benign. Converting your sdcard partition to ext4 is NOT NOT NOT benign and you can really hose yourself doing it.

I'm not going into great depth with these instructions. If you don't understand them, play around with building cyanogen, installing it, etc until they are crystal clear.

To swap your sdcard to ext4:

* Apply the patches and rebuild cyanogen. Rebuild it. They will change your recovery image and vold.

* Install vold and flash (and/or boot) the recovery image.

* Boot into recovery, mount your sdcard and back it up to your computer (i.e., not nandroid, copy the files.) Nandroid would be a good idea too.

* Format your media partition to ext4 (the one that is vfat, by-name is media, mine is partition 3) mkfs.ext4 can be found by googling, or you can use make_ext4fs from /system/bin. I used mkfs.ext4.

* You should be able to manually mount that.

* Push your files back.

* sync and reboot.

Et Voila, you should have an ext4 sdcard partition.

THIS IS VERY DANGEROUS.

YOU CAN REALLY HOSE YOURSELF DOING IT.

Here are the patches:

http://review.cyanogenmod.com/#change,1705

This one adds ext4 support to vold, thus allowing gingerbread to mount ext4 partitions for the sdcard (which on the Nexus S, is the 'media' partition.)

and:

http://review.cyanogenmod.com/#change,1716

This is a change to recovery, making it seamlessly mount ext4 partitions for /sdcard.

Code:
# mount
/dev/block/platform/s3c-sdhci.0/by-name/system on /system type ext4 (ro,noatime,barrier=1,data=ordered,noauto_da_alloc)
/dev/block/platform/s3c-sdhci.0/by-name/userdata on /data type ext4 (rw,nosuid,nodev,noatime,barrier=0,data=ordered)
/dev/block/vold/179:3 on /mnt/sdcard type ext4 (rw,nosuid,nodev,noexec,noatime,barrier=1,data=ordered,noauto_da_alloc)
/dev/block/vold/179:3 on /mnt/secure/asec type ext4 (rw,nosuid,nodev,noexec,noatime,barrier=1,data=ordered,noauto_da_alloc)
tmpfs on /mnt/sdcard/.android_secure type tmpfs (ro,relatime,size=0k,mode=000)
The Following 4 Users Say Thank You to DebauchedSloth For This Useful Post: [ View ] Gift DebauchedSloth Ad-Free
27th December 2010, 03:15 PM |#2  
OP Senior Member
Thanks Meter: 76
 
More
....and if you turn on USB Storage, the sdcard shows up as an ext4 disk...

As expected, but this is going to be one for the Linux geeks.

Wow, it is VERY nice to have that sdcard mount instantly on boot. VERY nice.
The Following User Says Thank You to DebauchedSloth For This Useful Post: [ View ] Gift DebauchedSloth Ad-Free
27th December 2010, 07:58 PM |#3  
jroid's Avatar
Senior Member
Thanks Meter: 85
 
More
oh the read/write speeds
27th December 2010, 11:55 PM |#4  
OP Senior Member
Thanks Meter: 76
 
More
If anyone is interested in playing with this, I submitted the change to cyanogen:

http://review.cyanogenmod.com/#change,1705

The tricky bit is getting the filesystem created. You can use:

/system/bin/make_ext4fs.

That leaves me with a recovery which will not currently mount sdcard as ext4 unless I fiddle with fstab and mount it myself. On to look at that.
28th December 2010, 12:50 AM |#5  
OP Senior Member
Thanks Meter: 76
 
More
...and, here's a patch to the recovery which will let it mount /sdcard as either ext4 or vfat, making this change reasonably seamless.

http://review.cyanogenmod.com/#change,1716
The Following User Says Thank You to DebauchedSloth For This Useful Post: [ View ] Gift DebauchedSloth Ad-Free
31st December 2010, 05:11 PM |#6  
Senior Member
Flag Lawrenceville, GA
Thanks Meter: 5
 
Donate to Me
More
i would love to see a Quadrant or a benchmark after this
The Following User Says Thank You to andyandrwew For This Useful Post: [ View ] Gift andyandrwew Ad-Free
31st December 2010, 08:02 PM |#7  
AllGamer's Avatar
Retired Forum Moderator
Thanks Meter: 1,665
 
Donate to Me
More
this is and awesome hack to use with App 2 SD

it'll be lag less

the only annoyance, is that if you want to MOUNT USB on a Windows PC, then you'll need a software to read EXT4

for anyone interested this will be handy
http://www.ext2fsd.com/?page_id=16

i'll definitely be doing this MOD, as i'll be running anything i can from the Internal SD
13th January 2011, 05:21 PM |#8  
Anderdroid's Avatar
Senior Member
Flag Palo Alto
Thanks Meter: 106
 
Donate to Me
More
So this will only work on CM7?
13th January 2011, 07:19 PM |#9  
drziddo's Avatar
Senior Member
Thanks Meter: 60
 
More
Please some of the genius here may post a step-by-step tutorial or howto for this one? It will be very apreciated.
13th January 2011, 08:25 PM |#10  
OP Senior Member
Thanks Meter: 76
 
More
No, it will work with any build, but you need to rebuild vold in order to get it to mount. The easiest way to get them outside of the CM tree would be to build cm and then copy the vold out and use that. It should work with any ROM.

The latest versions - which are in CM's gerrit - include modifications to the sdcard utility to use fuse to mount the filesystem using FAT semantics (i.e. - bypass security). Frankly, this is a waste. It slows everything down, noticeably, and app problems are few and easily fixed if you know how to fire off a chmod.

I haven't provided step by step instructions since it can seriously hose your phone if you don't know what you are doing.
13th January 2011, 11:12 PM |#11  
Anderdroid's Avatar
Senior Member
Flag Palo Alto
Thanks Meter: 106
 
Donate to Me
More
Quote:
Originally Posted by DebauchedSloth

No, it will work with any build, but you need to rebuild vold in order to get it to mount. The easiest way to get them outside of the CM tree would be to build cm and then copy the vold out and use that. It should work with any ROM.

The latest versions - which are in CM's gerrit - include modifications to the sdcard utility to use fuse to mount the filesystem using FAT semantics (i.e. - bypass security). Frankly, this is a waste. It slows everything down, noticeably, and app problems are few and easily fixed if you know how to fire off a chmod.

I haven't provided step by step instructions since it can seriously hose your phone if you don't know what you are doing.

Wait so it's a waste? It isn't worth using ?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes