Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP brainmaster

27th March 2011, 09:22 PM   |  #1  
brainmaster's Avatar
OP Recognized Developer
Thanks Meter: 4,518
 
3,938 posts
Join Date:Joined: Dec 2006
Donate to Me
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, 1410 views)
File Type: zip SDCardSpeedFix1024KB.zip - [Click for QR Code] (155.7 KB, 1424 views)
File Type: zip SDCardSpeedFix2048KB.zip - [Click for QR Code] (155.7 KB, 4487 views)
File Type: zip SDCardSpeedFix3072KB.zip - [Click for QR Code] (155.7 KB, 3360 views)
File Type: zip SDCardSpeedFix4096KB.zip - [Click for QR Code] (155.7 KB, 2765 views)
Last edited by brainmaster; 7th April 2011 at 08:23 AM.
The Following 57 Users Say Thank You to brainmaster For This Useful Post: [ View ]
27th March 2011, 09:37 PM   |  #2  
D4rk50ul's Avatar
Senior Member
Flag Honolulu
Thanks Meter: 119
 
565 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Very interesting. I'm going to test this out on HyperDroid GBX.. Any downside to just using the 4mb cache?
27th March 2011, 09:40 PM   |  #3  
brainmaster's Avatar
OP Recognized Developer
Thanks Meter: 4,518
 
3,938 posts
Join Date:Joined: Dec 2006
Donate to Me
Quote:
Originally Posted by D4rk50ul

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.
27th March 2011, 09:43 PM   |  #4  
phuKKah's Avatar
Senior Member
Flag ATL
Thanks Meter: 1
 
333 posts
Join Date:Joined: Jan 2009
More
Instant results on HyperDroidGBX V11 confirmed
27th March 2011, 09:45 PM   |  #5  
matmar's Avatar
Senior Member
Thanks Meter: 66
 
644 posts
Join Date:Joined: Aug 2008
More
Question ram rom
Can it be used on RAM ROM ?
Imilka S vivo for example ?
thanks in advance
27th March 2011, 09:47 PM   |  #6  
brainmaster's Avatar
OP Recognized Developer
Thanks Meter: 4,518
 
3,938 posts
Join Date:Joined: Dec 2006
Donate to Me
Quote:
Originally Posted by matmar

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.
27th March 2011, 09:48 PM   |  #7  
D4rk50ul's Avatar
Senior Member
Flag Honolulu
Thanks Meter: 119
 
565 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Quote:
Originally Posted by phuKKah

Instant results on HyperDroidGBX V11 confirmed

Which cache size did you use?

I'm running the stock 16gb class 2.
27th March 2011, 09:59 PM   |  #8  
Senior Member
Flag Aibonito
Thanks Meter: 342
 
856 posts
Join Date:Joined: Apr 2009
More
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
27th March 2011, 10:22 PM   |  #9  
rikardo1979's Avatar
Senior Member
Flag Poole, UK
Thanks Meter: 242
 
1,686 posts
Join Date:Joined: Jan 2009
More
nice job m8
I can confirm improved speed
27th March 2011, 10:25 PM   |  #10  
Member
Flag Glasgow
Thanks Meter: 12
 
50 posts
Join Date:Joined: Feb 2010
More
Running HyperDroid V11

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

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes