SD Card read_ahead_kb tweak
Many users have been reporting slow SD card read speeds regardless of the fact that they've a crazy-fast Class 10 card or something of a similar calibre. The issue lies within how large the read cache is, which the Android system defines at boot time. Luckily for us, we can change that with relative ease.
PRE-REQUISITES
You'll need the following:
- Root access
- blay0's ROM installed (duh)
- ADB installed and functioning on a PC of your choice
- System overlay enabled to be safe ("aufs --enable" using ADB shell or in a Terminal Emulator on your phone then reboot)
- USB debugging enabled on your phone
You may also want to install the application
SD Tools from the Android market in order to benchmark your results to see if you actually get improvements. Before you actually do all this, it's probably worth checking what your read_ahead_kb is actually set to. Using an ADB shell, plug in the following command and hit enter:
Code:
cat /sys/devices/virtual/bdi/179:0/read_ahead_kb
If the value returned is 128, then you're all set to proceed with the tweak. If it's anything else, keep reading if you want to change it.
Use your command line (cmd on Windows, terminal on Ubuntu etc etc) to enter the following command:
Code:
chmod 755 /data/local/init.d/01init
chmod 755 /sys/devices/virtual/bdi/179:0/read_ahead_kb
This will give you the correct permissions you need in order to permanently modify the file.
After you've done that, do this:
Code:
adb pull /data/local/init.d/01init
You should now have a file called "01init" in the same directory that your ADB session was initiated from. Open this file in a text editor and find the number which was printed earlier when you cat'd "/sys/devices/virtual/bdi/179:0/read_ahead_kb". This is the number you'll need to edit.
Change that number to
2048 for now and save the file in
exactly the same format and location as it was before you started editing. After you've done that, you'll need to push the file back to your phone using the following command:
Code:
adb push 01init /data/local/init.d/01init
After that's done, you'll need to reboot. If you're
not using data2ext, you can issue the following command and your phone will reboot automatically:
If you are
using data2ext,
you MUST turn off the phone using
the power button and
reboot manually.
Mind also that /data/local/init.d is wiped and repopulated from /system/etc/init.d on ROM upgrade/flash.
...in which case you'll need to do all of the above again every time you upgrade or flash.
Try different numbers using the guide above then benchmark with
SD Tools and see what results you get. A general rule of thumb is to use numbers which are divisable by 4 I.E. 128, 1024, 2048, 3072, 4096 etc etc etc. If you find that a certain number gives better results, stick with it!
-EOF-