Notices


Reply
Thread Tools
Posts: 8 | Thanked: 16 times | Joined on May 2010
#1
I am create a MicroSD read/write speed benchmark script.
  • Simple shell script
  • No require additional software (busybox command only)
  • Create 1GB file on MicroSD

sdbench.sh
Code:
#!/bin/sh

MMC="/media/mmc1"
DAT="$MMC/test.dat"
CNT=1024
SDREAD=""
SDWRITE=""

grep -q "$MMC" /etc/mtab
if [ $? == 0 ];
then
  echo "testing SD Card read/write speed. Please wait a few minutes."
  # Write test
  SDWRITE=`time -p dd if=/dev/zero of=$DAT bs=1M count=$CNT 2>&1|head -3|tail -1`
  # Read test
  SDREAD=`time -p cp $DAT /dev/null 2>&1|head -1`
  # Delete data file
  rm $DAT

  echo
  echo "Result"
  echo $SDREAD | awk '{print "Read:", 1024/$2, "MB/s"}'
  echo $SDWRITE | awk '{print "Write:", 1024/$2, "MB/s"}'
else
  echo "SD Card not found."
fi
usage:
    1. Copy sdbench.sh to home directory
    2. Open X-Terminal
    3. Run script (eg. sh sdbench.sh)
    4. wait a few minute

My result
SanDisc Class2 16GB
Read: 14.5952 MB/s
Write: 8.53831 MB/s

Buffalo Class4 8GB
Read: 13.4031 MB/s
Write: 4.84413 MB/s
Attached Files
File Type: gz sdbench.sh.gz (372 Bytes, 152 views)

Last edited by akih; 2010-11-03 at 16:04.
 

The Following 14 Users Say Thank You to akih For This Useful Post:
bigears5000's Avatar
Posts: 468 | Thanked: 775 times | Joined on May 2010 @ Hereford, England
#2
I have been looking for something like this this for a while and this would be ideal for what I want. But when I run the script, it just says: testing sd card read/write speed. please wait a few minutes.
But I get no result. I have waited for 10 minutes and nothing apart from full cpu usage. Any ideas?

Edit: I have just tried three different sd cards and I know they all work, but I don't get a result for any of them.

Last edited by bigears5000; 2010-11-03 at 08:25. Reason: More testing.
 
Posts: 8 | Thanked: 16 times | Joined on May 2010
#3
Originally Posted by bigears5000 View Post
but I don't get a result for any of them.
Error messages are displayed?

This is my result:
Code:
$ sh sdbench.sh
testing SD Card read/write speed. Please wait a few minutes.

Result
Read: 14.9293 MB/s
Write: 8.10511 MB/s
 
Posts: 2,802 | Thanked: 4,491 times | Joined on Nov 2007
#4
For slightly (if you're writing/reading 1GB it doesn't matter that much) more accurate results you may want to clear the kernel caches before each test ("echo 3 > /proc/sys/vm/drop_caches").
 
Posts: 309 | Thanked: 115 times | Joined on May 2010 @ Malaysia
#5
i got

:not found line 2:
:not found line 8:
:no such file or directory
sdbench.sh : line 26: syntax error: "fi" unexpected (expecting "then")
i just copy pasted the script and save as sdbench.sh...what am i doing wrong?

EDITED : got it to work copying from my ubuntu machine..however, i got the same prob as bigears5000..

i didnt get any result as well..

Originally Posted by bigears5000 View Post
I have been looking for something like this this for a while and this would be ideal for what I want. But when I run the script, it just says: testing sd card read/write speed. please wait a few minutes.
But I get no result. I have waited for 10 minutes and nothing apart from full cpu usage. Any ideas?

Edit: I have just tried three different sd cards and I know they all work, but I don't get a result for any of them.

EDITED : IT WORKED!TOOK 3 MINUTES TO DISPLAY THE RESULT..THX!

Last edited by one1002; 2010-11-03 at 12:09.
 
bigears5000's Avatar
Posts: 468 | Thanked: 775 times | Joined on May 2010 @ Hereford, England
#6
Okay. I must be doing something wrong. This is what I have done on my n900.
Copied the script from above using the copy function.
Opened xterm
Pasted the script
Pressed enter to run it.
Then xterm says testing sd card read write/speed. Please wait a few minutes.
Then nothing happens. No error message, just high cpu usage. I have left for 10 minutes and still nothing. It should work doing it this way shouldn't it?
If not, how do I save the script to n900 as an .sh file?
Thanks in advance.

Last edited by bigears5000; 2010-11-03 at 12:52.
 
Posts: 8 | Thanked: 16 times | Joined on May 2010
#7
Originally Posted by one1002 View Post
i just copy pasted the script and save as sdbench.sh...what am i doing wrong?
Your scripts line code was wrong.

I attach a file to the first message.
Please use that file.
 
Posts: 8 | Thanked: 16 times | Joined on May 2010
#8
Originally Posted by bigears5000 View Post
Then nothing happens. No error message, just high cpu usage. I have left for 10 minutes and still nothing. It should work doing it this way shouldn't it?
Ok, i create a test script.
This is short execute time version. (about 30 to 60 seconds)
Please test attachment file.
Attached Files
File Type: gz sdbench_s.sh.gz (373 Bytes, 162 views)
 
bigears5000's Avatar
Posts: 468 | Thanked: 775 times | Joined on May 2010 @ Hereford, England
#9
Originally Posted by akih View Post
Ok, i create a test script.
This is short execute time version. (about 30 to 60 seconds)
Please test attachment file.
Sorry to seem stupid, but you are going to have to explain to me what to do and how to open this file. Thanks
 
Posts: 8 | Thanked: 16 times | Joined on May 2010
#10
Originally Posted by bigears5000 View Post
Sorry to seem stupid, but you are going to have to explain to me what to do and how to open this file. Thanks
Copy sdbench_s.sh.gz to N900
Execute following command on X-Terminal
Code:
gzip -d sdbench_s.sh.gz
Run sdbench_s.sh
Code:
sh sdbench_s.sh
 

The Following User Says Thank You to akih For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 02:48.