Boost SD Card Speeds On Android

Boost SD Card Speeds On Android

A slow sd card on a fast android device could be the reason your android starts lagging or loads files slowly from your sd card. If any of you know about the term “readahead”  we’re gonna utilize this command in our tweak . For those who do not know what this is here is what wikepidea has to say about it

readahead is the file prefetching technology used in the Linux operating system. It is a system call that loads a file’s contents into the page cache. When a file is subsequently accessed, its contents are read from physical memory rather than from disk, which is much faster.

Many distributions of Linux use readahead on a list of commonly used files to speed up booting. In such a setup, if the kernel is booted with the profile parameter, it will record all file accesses during bootup and write a new list of files to be read before booting. This will make additional installed services start faster, because they are not included in the default readahead list.

So basicaly this command sets the cache of the sdcard in kb/s.
The default value on android devices is “128″, so that’s a cache of 128kb, which quite small..

why is it small :

  • its set as a failsafe default so that even some  cheap or low end cards work decently enough

why you should do this tweak

  • Most sd cards these days are able to handle higher readahead values and are far better than one’s that used to come along with devices earlier

How Do i find optimal readahead value :

 how to find your current read_ahead_kb value manually

  • “adb shell” to enter debug bridge (skip this if you are using any terminal emulator app on phone)
  • enter this in terminal or debug console“cd /sys/devices/virtual/bdi”
  • enter “ls”             now you will see two numbers in the 179 range. for me it’s 179:0 and 179:32
  • enter this“cd 179:xx”
  • now type “ls”,                if you’re in the right directory you should see a list of files including  read_ahead_kb
  • enter this “cat read_ahead_kb”   to see it’s value, in most of the cases it’s 128.

How to raise the read_ahead_kb value

  • there are many ways easiest one of them is install any app that allows you to change read ahead kb values like Rom Tool Box Pro
  • another way is using the terminal but drawback of using terminal is values will not stick after you reboot your device. to do this using terminal  enter
“echo xxxx > /sys/devices/virtual/bdi/179:xx/read_ahead_kb”  or  “echo xxxx > read_ahead_kb” when you’re already in that directory
Example for my phone:   “echo 4096 > /sys/devices/virtual/bdi/179:0/read_ahead_kb”
  • third way is using init.d this way is easiest and is free values will stick even after you reboot all you need for this  is init.d support in your rom . to set values with this method
 Create a new file in /system/etc/init.d, the name doesn’t matter, let’s choose “sdboost
– Open the file and enter:
echo xxxx > /sys/devices/virtual/bdi/179:xx/read_ahead_kb
for eg i used 4096kb so my script was like below
 “echo 4096 > /sys/devices/virtual/bdi/179:0/read_ahead_kb”
Then save it and set it’s permissions to  RWX-RX-RX (755)
thats all to it folks .if you have any queries or suggestions feel free to comment below or if u like this article do give us a like or share :)

You may also like...

Free WordPress Themes