Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,811,035 Members 40,778 Now Online
XDA Developers Android and Mobile Development Forum

[FIX][CWM] SD Card fix for reading speed

Tip us?
 
brainmaster
Old
(Last edited by brainmaster; 7th April 2011 at 07:23 AM.)
#1  
brainmaster's Avatar
Recognized Developer - OP
Thanks Meter 4,512
Posts: 3,921
Join Date: Dec 2006

 
DONATE TO ME
Default [FIX][CWM] SD Card fix for reading speed

Many of us are disappointed about the reading speed of the SD Cards on our HD2. It doesn't matter if you have fast 10 Class SD Card, it performs very poorly on HD2 comparing how it performs on the PC.

The clue is the Cache size for reading from SD Card. It's set to 128 KB, on some ROM's it's even set to 4 KB!



You can check for yourself your Cache size by looking into this file:


/sys/devices/virtual/bdi/179:0/read_ahead_kb



You can change it manually but it will be reverted to default on the reboot. The changes need to be done permanently by loading the script on the startup through the init.d.



Or you can flash the CWM zip files that I made for you.


For RA 1.7 Recovery zip look into this post. Many thanx to user laie1472 for making them.



You must find which Cache size fits best for your SD Card. In my case its the 3072 KB Cache size.
At best, use the Root Explorer to change the value, then run SD Tools Benchmark - finally flash the CWM zip file that fits your SD Card.

Here are two screenshots - the first one shows the reading speeds with the default Cache 128 KB and the second one is with the 3072 KB Cache with my Class 4 SD Card on CM7 RC2 by Charnsingh.



The Benchmark is made with the
SD Tools program.


If you want to convince yourself of the speed improvement after applying the fix, just open your Gallery and see how fast it loads the photos!

Suggestion: 2048 KB Cache size performs at best for most of the SD Cards!




If you don't have CWM then you can do following:

Make a file with this content:

Version 1:
Quote:
#!/system/bin/sh
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]
then
/system/xbin/echo "128" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
fi;
Version 2 (If the Version 1 is not working for your ROM - credit goes to rafpigna!):
Quote:
# Tweak mmc read-ahead - rafpigna -
mmcfolder="/sys/devices/platform/msm_sdcc.2/mmc_host/mmc1"
cd $mmcfolder
folderlist=`ls -1`
mmcresult=`echo $folderlist | grep -o '\bmmc1:\w*' | sed 's/mmc1://'`
echo 128 > /sys/devices/platform/msm_sdcc.2/mmc_host/mmc1/mmc1:$mmcresult/block/mmcblk0/queue/read_ahead_kb
cd /
Change the red marked number from 128 to what you need (example 2048) and save it as "99sdcardreadfix", copy it with the Root explorer or push it with ADB into /system/etc/init.d and set permissions to 777. Reboot.




Some of the ROM chiefs have hardcoded this values in the init, that can't be changed - only by the chief himself.

Some of the ROM's already contain this tweak in another script that is saved in the init.d folder. Probably it's tagged with the number 99 in the filename to be sure that it's executed at last. You have to change it there.


Rafpigna - the HD2 Android chief - pointed that out over here.





For ROM Cookers - add this line into init.rc file:

Quote:
# sd card read speed fix
write /sys/block/mmcblk0/bdi/read_ahead_kb 2048

Quote:
How to install the CWM zip files:

In the MAGLdr menu or in CWM menu you navigate with the Volume rocker buttons "Up" and "Down", Call button is for "O.K." or "Confirm", the EndCall button is for "Back".

If you have a CWM zip file (open the zip file, if it contains the METAInf folder then its a CWM zip file), copy it to your SD Card (I use a folder called Android Files on my SD Card).

Then power-off your Phone and start the MAGLdr menu by Holding the Power button until the MAGLdr menu comes.

Go down to AD Recovery and press the Call button to start the CWM.

In the CWM menu go to "Install zip from sdcard", then "choose zip from sdcard". Navigate to the folder where you copied your zip file and choose the zip file.

After the zip file is installed, restart your Phone.
UPDATE: There is now free app on the market that do this for you.


Attached Files
File Type: zip SDCardSpeedFixDefault128KB.zip - [Click for QR Code] (155.7 KB, 1391 views)
File Type: zip SDCardSpeedFix1024KB.zip - [Click for QR Code] (155.7 KB, 1417 views)
File Type: zip SDCardSpeedFix2048KB.zip - [Click for QR Code] (155.7 KB, 4442 views)
File Type: zip SDCardSpeedFix3072KB.zip - [Click for QR Code] (155.7 KB, 3341 views)
File Type: zip SDCardSpeedFix4096KB.zip - [Click for QR Code] (155.7 KB, 2737 views)


Buy me a Coffee - here for US and here for EU.
The Following 57 Users Say Thank You to brainmaster For This Useful Post: [ Click to Expand ]
 
D4rk50ul
Old
#2  
D4rk50ul's Avatar
Senior Member
Thanks Meter 119
Posts: 565
Join Date: Sep 2010
Location: Honolulu

 
DONATE TO ME
Very interesting. I'm going to test this out on HyperDroid GBX.. Any downside to just using the 4mb cache?
 
brainmaster
Old
#3  
brainmaster's Avatar
Recognized Developer - OP
Thanks Meter 4,512
Posts: 3,921
Join Date: Dec 2006

 
DONATE TO ME
Quote:
Originally Posted by D4rk50ul View Post
Very interesting. I'm going to test this out on HyperDroid GBX.. Any downside to just using the 4mb cache?
No, by default is 128 KB. So I think that it is better to have anything beyond that.


Buy me a Coffee - here for US and here for EU.
 
phuKKah
Old
#4  
phuKKah's Avatar
Senior Member
Thanks Meter 1
Posts: 333
Join Date: Jan 2009
Location: ATL
Instant results on HyperDroidGBX V11 confirmed
 
matmar
Old
#5  
matmar's Avatar
Senior Member
Thanks Meter 66
Posts: 641
Join Date: Aug 2008
Question ram rom

Can it be used on RAM ROM ?
Imilka S vivo for example ?
thanks in advance
 
brainmaster
Old
#6  
brainmaster's Avatar
Recognized Developer - OP
Thanks Meter 4,512
Posts: 3,921
Join Date: Dec 2006

 
DONATE TO ME
Quote:
Originally Posted by matmar View Post
Can it be used on RAM ROM ?
Imilka S vivo for example ?
thanks in advance
Try to change the values manually and see if there is any diference. If that ROM uses the CWM then you can flash the file, if not then you have to find another way of adding the values to the file.


Buy me a Coffee - here for US and here for EU.
 
D4rk50ul
Old
#7  
D4rk50ul's Avatar
Senior Member
Thanks Meter 119
Posts: 565
Join Date: Sep 2010
Location: Honolulu

 
DONATE TO ME
Quote:
Originally Posted by phuKKah View Post
Instant results on HyperDroidGBX V11 confirmed
Which cache size did you use?

I'm running the stock 16gb class 2.
 
Derek0228
Old
#8  
Senior Member
Thanks Meter 342
Posts: 854
Join Date: Apr 2009
Location: Aibonito
It's true, this is awesome. Reading speed was vastly improved! I'm using a c2 sandisk 32gb with hyperdroid gbx.

Sent from my HTC HD2 using XDA Premium App
Proud owner of a Sprint HTC One.
Boomsound, Zoe, 1080P Screen, LTE... :sweetjesus:

History:
Samsung Galaxy S3 i9300
Samsung Galaxy Note GT N7000
Samsung Galaxy Nexus
HTC Sensation 4G
HTC HD2
HTC Touch P3450 Elf[

 
rikardo1979
Old
#9  
rikardo1979's Avatar
Senior Member
Thanks Meter 205
Posts: 1,600
Join Date: Jan 2009
Location: Poole, UK
nice job m8
I can confirm improved speed

Keep our threads clean so hit the THANKS instead of posting it
XDA Developers

 
mcrummy
Old
#10  
Member
Thanks Meter 12
Posts: 50
Join Date: Feb 2010
Location: Glasgow
Running HyperDroid V11

Write speed went from 5.5 - 5.6
Read speed went from 18.7 - 51.2 !!!!

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes