• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[MOD]EXT4 optimization UPDATE 8-7-11

Search This thread

dsexton702

Retired Recognized Developer
Apr 14, 2011
2,533
2,257
South Lake Tahoe
here is an init.d script to optimize your ext4 partitions


thanks to crackpot for the original script, all i did was change the values to optimize performance

this has been tested and does improve performance :D

go inside tar and extract s99 file put into init.d folder /system/etc/init.d
 

Attachments

  • S99partition_mounts.tar
    2 KB · Views: 808
Last edited:

RaverX3X

Inactive Recognized Developer
Jun 13, 2011
4,416
5,195
Cali
because im not professional with kernels raver or drhonk will have to install this on the kernel, but for those who have ext4 on all partitions on GB this mod is definitely for you


"Barriers allow usage of delayed allocations without risk. Delayed allocations are the key to performance for modern filesystems," supercurio.

THIS IS FOR EXPERIENCED PEOPLE WITH ADB

plug the phone in
make sure debug is on
and type the following into your command prompt

adb shell
mount -o remount,barrier=0 /system /system
mount -o remount,barrier=0 /cache /cache

for some reason the kernel only has /data with barriers when all 3 should have them

you will notice your quad go up about 2-300 more
and your performance will be much better :D

the barriers were prob removed to the fact of such little actuall memory on the system and cache partition or they may be looking at shortning the sgs4g cache partition size and when they keis the gingerbread forgot to add the barrier back in. Also note when you barrier the cache you also run the risk of locking downloads to a set size hince why some had issues on frayo with download sizes larger then 30 mb in size also why u dont see that in gb or if you adb shell in frayo

/unmount cache

rmdir cache

mdir cache

then ln the 2 caache files back which removes the limit :p
 
  • Like
Reactions: crackpot

Somairotevoli

Senior Member
May 31, 2011
989
255
Wow! Finally broke 3000!

Sent from my SGH-T959V using Tapatalk
 

Attachments

  • ScrtnShot.jpg
    ScrtnShot.jpg
    29.1 KB · Views: 733

shotchacokov

Senior Member
Mar 20, 2011
518
75
Orlando
It will, but you will have to input out each time you reboot. Also...if you do use terminal to do it, you may need to put the commands in a note pad and copy /paste it. (holds down on the screen to get the paste function) it kept changing barriers to barrIers which is not valid :).

Sent from my GS4G using XDA app.
 

Part Four

Senior Member
Feb 10, 2010
1,162
62
It will, but you will have to input out each time you reboot. Also...if you do use terminal to do it, you may need to put the commands in a note pad and copy /paste it. (holds down on the screen to get the paste function) it kept changing barriers to barrIers which is not valid :).

Sent from my GS4G using XDA app.

ADB it is then! :)
 

Somairotevoli

Senior Member
May 31, 2011
989
255
I am using KG6 w/ cwm/voodoo/KG4 kernel with lag fix enabled. I'm [email protected] 1.44ghz.
the battery is from
A UOT theme I am working on.
As for script manager, install from market.
Open app and create new script from menu.
Call it what ever you want. Hit ok.
Menu will open asking what to open file with, choose text editor.
Paste this code
Code:
 mount -o remount,barrier=1 /system /system
mount -o remount,barrier=1 /cache /cache
Hit menu > close > yes to save

Using the programs built in file browser, locate the script, select it.

Check run as root and run at boot. Hit save.
Either run the script after that or reboot.
Run mount command in terminal and check your mounts.
should see barrier=1 on system, cache, and data.
Sent from my SGH-T959V using Tapatalk
 

AntonX

Senior Member
Nov 9, 2006
432
1,054
Just a note. You have to decide yourself what you want to achieve in the end: better performance or better data integrity. Enabling barriers (setting barrier=1) reorders journaling in a way so that all data blocks are guaranteed to be written before committing, but it degrades the performance because the system have to wait until writes are done in certain sequence. Data integrity is better as there is less change for the transaction to complete improperly in case the system crashes (like when journal data is written but actual data is not.) On phones the chance of screwing up transactions is quite low, just don't ever remove the battery without shutting down the phone properly.

Quote from mount docs: "...Write barriers enforce proper on-disk ordering of journal commits, making volatile disk write caches safe to use, at some performance penalty. If your disks are battery-backed in one way or another, disabling barriers may safely improve performance. ..."

Some more readings here for example: lwn.net/Articles/283161/

The way to remount ext4 partitions for best performance should be this:

mount -o remount,noatime,delalloc,noauto_da_alloc,barrier=0

If you want more data safety then enable barriers.
 
  • Like
Reactions: invario

crackpot

Senior Member
Oct 25, 2009
376
342
SC
crackpot.ws
Just a note. You have to decide yourself what you want to achieve in the end: better performance or better data integrity. Enabling barriers (setting barrier=1) reorders journaling in a way so that all data blocks are guaranteed to be written before committing, but it degrades the performance because the system have to wait until writes are done in certain sequence. Data integrity is better as there is less change for the transaction to complete improperly in case the system crashes (like when journal data is written but actual data is not.) On phones the chance of screwing up transactions is quite low, just don't ever remove the battery without shutting down the phone properly.

Quote from mount docs: "...Write barriers enforce proper on-disk ordering of journal commits, making volatile disk write caches safe to use, at some performance penalty. If your disks are battery-backed in one way or another, disabling barriers may safely improve performance. ..."

Some more readings here for example: lwn.net/Articles/283161/

The way to remount ext4 partitions for best performance should be this:

mount -o remount,noatime,delalloc,noauto_da_alloc,barrier=0

If you want more data safety then enable barriers.
I've modified my init.d script to use these settings, for comparative purposes. Anyone is welcome to try it, assuming your ROM has init.d.
 

Attachments

  • S99partition_mounts.zip
    263 bytes · Views: 90

crackpot

Senior Member
Oct 25, 2009
376
342
SC
crackpot.ws
That's odd, it seems to load the mount settings.

Here's output from "mount" via ADB's shell.

Code:
/dev/block/stl9 /system ext4 rw,noatime,barrier=0,data=writeback,noauto_da_alloc
 0 0
/dev/block/stl11 /cache ext4 rw,noatime,barrier=0,data=writeback,noauto_da_alloc
 0 0
/dev/block/stl10 /data ext4 rw,noatime,barrier=0,data=ordered,noauto_da_alloc 0
0
 
Last edited:

dsexton702

Retired Recognized Developer
Apr 14, 2011
2,533
2,257
South Lake Tahoe
That's odd, it seems to load the mount settings.

Here's output from "mount" via ADB's shell.

Code:
/dev/block/stl9 /system ext4 rw,noatime,barrier=0,data=writeback,noauto_da_alloc
 0 0
/dev/block/stl11 /cache ext4 rw,noatime,barrier=0,data=writeback,noauto_da_alloc
 0 0
/dev/block/stl10 /data ext4 rw,noatime,barrier=0,data=ordered,noauto_da_alloc 0
0

it did nothing for me, my mount settings were exactly the same upon every reboot :/
 

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    here is an init.d script to optimize your ext4 partitions


    thanks to crackpot for the original script, all i did was change the values to optimize performance

    this has been tested and does improve performance :D

    go inside tar and extract s99 file put into init.d folder /system/etc/init.d
    2
    I am using KG6 w/ cwm/voodoo/KG4 kernel with lag fix enabled. I'm [email protected] 1.44ghz.
    the battery is from
    A UOT theme I am working on.
    As for script manager, install from market.
    Open app and create new script from menu.
    Call it what ever you want. Hit ok.
    Menu will open asking what to open file with, choose text editor.
    Paste this code
    Code:
     mount -o remount,barrier=1 /system /system
    mount -o remount,barrier=1 /cache /cache
    Hit menu > close > yes to save

    Using the programs built in file browser, locate the script, select it.

    Check run as root and run at boot. Hit save.
    Either run the script after that or reboot.
    Run mount command in terminal and check your mounts.
    should see barrier=1 on system, cache, and data.
    Sent from my SGH-T959V using Tapatalk
    1
    because im not professional with kernels raver or drhonk will have to install this on the kernel, but for those who have ext4 on all partitions on GB this mod is definitely for you


    "Barriers allow usage of delayed allocations without risk. Delayed allocations are the key to performance for modern filesystems," supercurio.

    THIS IS FOR EXPERIENCED PEOPLE WITH ADB

    plug the phone in
    make sure debug is on
    and type the following into your command prompt

    adb shell
    mount -o remount,barrier=0 /system /system
    mount -o remount,barrier=0 /cache /cache

    for some reason the kernel only has /data with barriers when all 3 should have them

    you will notice your quad go up about 2-300 more
    and your performance will be much better :D

    the barriers were prob removed to the fact of such little actuall memory on the system and cache partition or they may be looking at shortning the sgs4g cache partition size and when they keis the gingerbread forgot to add the barrier back in. Also note when you barrier the cache you also run the risk of locking downloads to a set size hince why some had issues on frayo with download sizes larger then 30 mb in size also why u dont see that in gb or if you adb shell in frayo

    /unmount cache

    rmdir cache

    mdir cache

    then ln the 2 caache files back which removes the limit :p
    1
    Just a note. You have to decide yourself what you want to achieve in the end: better performance or better data integrity. Enabling barriers (setting barrier=1) reorders journaling in a way so that all data blocks are guaranteed to be written before committing, but it degrades the performance because the system have to wait until writes are done in certain sequence. Data integrity is better as there is less change for the transaction to complete improperly in case the system crashes (like when journal data is written but actual data is not.) On phones the chance of screwing up transactions is quite low, just don't ever remove the battery without shutting down the phone properly.

    Quote from mount docs: "...Write barriers enforce proper on-disk ordering of journal commits, making volatile disk write caches safe to use, at some performance penalty. If your disks are battery-backed in one way or another, disabling barriers may safely improve performance. ..."

    Some more readings here for example: lwn.net/Articles/283161/

    The way to remount ext4 partitions for best performance should be this:

    mount -o remount,noatime,delalloc,noauto_da_alloc,barrier=0

    If you want more data safety then enable barriers.
    1
    yea i wonder why my init.d scripts arent working, maybe i need change the permissions

    what are your permissions for the scripts inside your init.d folder

    They are rwxrwxrwx, guess thats 0777.