Difference between revisions of "drive speed tests"
Line 29: | Line 29: | ||
== trivial benchmark tool == | == trivial benchmark tool == | ||
+ | You can use `dd` to measure sustained drive throughput if you do it right. You want to bypass any cache and buffering in the I/O path. This is not hard, but it is uncommon enough that it can be difficult to find documentation on the correct options to use. | ||
+ | |||
+ | It is unclear if this will also bypass RAID controller cache. It almost certainly will not bypass the cache on the drive itself. You would need to activate additional option via `hdparm` if your drive offers them. I considered this a little too invasive and I wasn't sure if the options would be the same for every drive. Plus I figured that the drive controller cache is not really an optional component of the drive, so there is no reason to take it out of the equation; although, it does make it more difficult to interpret read-speed tests. | ||
+ | |||
+ | === the most trivial drive benchmark tool === | ||
<pre> | <pre> | ||
alias test-drive-speed='dd if=/dev/zero of=test_data.bin oflag=dsync conv=fdatasync bs=8388608 count=16 2>&1 | grep "bytes" | cut -f1,6 -d" " | awk '\''{printf ("write-speed: %7.2f MB/s, ", $1 / $2 / (1024*1024))}'\'' && dd if=test_data.bin iflag=direct conv=fdatasync of=/dev/null bs=8388608 count=16 2>&1 | grep "copied" | cut -f1,6 -d" " | awk '\''{printf ("read-speed: %7.2f MB/s\n", $1 / $2 / (1024*1024))}'\''' | alias test-drive-speed='dd if=/dev/zero of=test_data.bin oflag=dsync conv=fdatasync bs=8388608 count=16 2>&1 | grep "bytes" | cut -f1,6 -d" " | awk '\''{printf ("write-speed: %7.2f MB/s, ", $1 / $2 / (1024*1024))}'\'' && dd if=test_data.bin iflag=direct conv=fdatasync of=/dev/null bs=8388608 count=16 2>&1 | grep "copied" | cut -f1,6 -d" " | awk '\''{printf ("read-speed: %7.2f MB/s\n", $1 / $2 / (1024*1024))}'\''' | ||
+ | </pre> | ||
+ | |||
+ | === slightly less trivial benchmark tool === | ||
+ | |||
+ | <pre> | ||
+ | #!/bin/bash | ||
+ | # | ||
+ | # test-drive-speed | ||
+ | # | ||
+ | # DESCRIPTION | ||
+ | # | ||
+ | # This performs a very simple drive speed test. It measures sustained | ||
+ | # write and read speed to a 128 MB file. | ||
+ | # | ||
+ | # AUTHOR | ||
+ | # | ||
+ | # Noah Spurrier <noah@noah.org> | ||
+ | # | ||
+ | # LICENSE | ||
+ | # | ||
+ | # This license is OSI and FSF approved as GPL-compatible. | ||
+ | # This license identical to the ISC License and is registered with and | ||
+ | # approved by the Open Source Initiative. For more information vist: | ||
+ | # http://opensource.org/licenses/isc-license.txt | ||
+ | # | ||
+ | # Copyright (c) 2010, Noah Spurrier <noah@noah.org> | ||
+ | # | ||
+ | # Permission to use, copy, modify, and/or distribute this software for any | ||
+ | # purpose with or without fee is hereby granted, provided that the above | ||
+ | # copyright notice and this permission notice appear in all copies. | ||
+ | # | ||
+ | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
+ | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
+ | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
+ | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
+ | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
+ | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
+ | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
+ | # | ||
+ | # VERSION | ||
+ | # | ||
+ | # Version 1 | ||
+ | # | ||
+ | |||
+ | echo "Uptime: $(uptime)" | ||
+ | PWD=$(pwd) | ||
+ | echo "The current directory is ${PWD}." | ||
+ | CURRENT_DEV=$(df -hT $(pwd) \ | ||
+ | | sed -n -e 's/^\(\/dev\/[a-zA-Z]\+[0-9]\+\).*/\1/p') | ||
+ | if [ "${CURRENT_DEV}" = "" ]; then | ||
+ | echo "Cannot find device associated with this directory." | ||
+ | else | ||
+ | echo "The current directory is stored on ${CURRENT_DEV}" | ||
+ | if echo ${CURRENT_DEV} | grep -q /dev/md; then | ||
+ | echo "This device is part of a sofware RAID." | ||
+ | echo "The software RAID is configured as follows:" | ||
+ | echo -en "\t" | ||
+ | egrep 'md[0-9]+' /proc/mdstat | ||
+ | CURRENT_DEV=$(egrep 'md[0-9]+' /proc/mdstat \ | ||
+ | |sed -n -e 's/.*[[:space:]]\([a-z]*[0-9]*\)\[.\]$/\1/p') | ||
+ | CURRENT_DEV="/dev/${CURRENT_DEV}" | ||
+ | echo -n "The last drive in the array is " | ||
+ | fi | ||
+ | hdparm -I ${CURRENT_DEV} | sed -n -e '/^$/d' \ | ||
+ | -e '0,/Standards:/p' | sed -n -e '$!p' | ||
+ | fi | ||
+ | echo "Running test three times..." | ||
+ | for n in 1 2 3; do | ||
+ | sync | ||
+ | dd if=/dev/zero of=junk.bin oflag=dsync conv=fdatasync \ | ||
+ | bs=8388608 count=16 2>&1|grep "copied"|cut -f1,6 -d" " \ | ||
+ | |awk '{printf("write: %7.2f MB/s, ",$1/$2/(1024*1024))}' | ||
+ | sync | ||
+ | dd if=junk.bin iflag=direct conv=fdatasync of=/dev/null \ | ||
+ | bs=8388608 count=16 2>&1|grep "copied"|cut -f1,6 -d" " \ | ||
+ | |awk '{printf("read: %7.2f MB/s\n",$1/$2/(1024*1024))}' | ||
+ | rm junk.bin | ||
+ | done | ||
+ | # vim:set sr et ts=4 sw=4 ft=sh: // See Vim, :help 'modeline' | ||
</pre> | </pre> | ||
Revision as of 14:30, 13 August 2010
Contents
drives test results
write speed in MB/s | read speed in MB/s | drive name | model number | USB ID | Notes |
---|---|---|---|---|---|
3.73 | 18.91 | SanDisk Cruzer 16GB | SDCZ36-016G | 0781:5530 | |
3.51 | 23.76 | Transcend Information OCZ Diesel 4GB | 1307:0165 | ||
10.27 | 17.50 | OEM 2GB | 13fe:1f00 | ||
6.64 | 15.58 | Cisco Linksys Connect Easy Setup Key 1GB | NK2 | 13b1:002e | |
44.83 | 78.78 | Seagate Momentus 7200.3 | ST9160411ASG | Serial Number: 5TG0K2CB Firmware Revision: DE17 | |
70.98 | 125.97 | OCZ VERTEX-LE | Serial Number: f0409001b, Firmware Revision: 1.05 | ||
trivial benchmark tool
You can use `dd` to measure sustained drive throughput if you do it right. You want to bypass any cache and buffering in the I/O path. This is not hard, but it is uncommon enough that it can be difficult to find documentation on the correct options to use.
It is unclear if this will also bypass RAID controller cache. It almost certainly will not bypass the cache on the drive itself. You would need to activate additional option via `hdparm` if your drive offers them. I considered this a little too invasive and I wasn't sure if the options would be the same for every drive. Plus I figured that the drive controller cache is not really an optional component of the drive, so there is no reason to take it out of the equation; although, it does make it more difficult to interpret read-speed tests.
the most trivial drive benchmark tool
alias test-drive-speed='dd if=/dev/zero of=test_data.bin oflag=dsync conv=fdatasync bs=8388608 count=16 2>&1 | grep "bytes" | cut -f1,6 -d" " | awk '\''{printf ("write-speed: %7.2f MB/s, ", $1 / $2 / (1024*1024))}'\'' && dd if=test_data.bin iflag=direct conv=fdatasync of=/dev/null bs=8388608 count=16 2>&1 | grep "copied" | cut -f1,6 -d" " | awk '\''{printf ("read-speed: %7.2f MB/s\n", $1 / $2 / (1024*1024))}'\'''
slightly less trivial benchmark tool
#!/bin/bash # # test-drive-speed # # DESCRIPTION # # This performs a very simple drive speed test. It measures sustained # write and read speed to a 128 MB file. # # AUTHOR # # Noah Spurrier <noah@noah.org> # # LICENSE # # This license is OSI and FSF approved as GPL-compatible. # This license identical to the ISC License and is registered with and # approved by the Open Source Initiative. For more information vist: # http://opensource.org/licenses/isc-license.txt # # Copyright (c) 2010, Noah Spurrier <noah@noah.org> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # VERSION # # Version 1 # echo "Uptime: $(uptime)" PWD=$(pwd) echo "The current directory is ${PWD}." CURRENT_DEV=$(df -hT $(pwd) \ | sed -n -e 's/^\(\/dev\/[a-zA-Z]\+[0-9]\+\).*/\1/p') if [ "${CURRENT_DEV}" = "" ]; then echo "Cannot find device associated with this directory." else echo "The current directory is stored on ${CURRENT_DEV}" if echo ${CURRENT_DEV} | grep -q /dev/md; then echo "This device is part of a sofware RAID." echo "The software RAID is configured as follows:" echo -en "\t" egrep 'md[0-9]+' /proc/mdstat CURRENT_DEV=$(egrep 'md[0-9]+' /proc/mdstat \ |sed -n -e 's/.*[[:space:]]\([a-z]*[0-9]*\)\[.\]$/\1/p') CURRENT_DEV="/dev/${CURRENT_DEV}" echo -n "The last drive in the array is " fi hdparm -I ${CURRENT_DEV} | sed -n -e '/^$/d' \ -e '0,/Standards:/p' | sed -n -e '$!p' fi echo "Running test three times..." for n in 1 2 3; do sync dd if=/dev/zero of=junk.bin oflag=dsync conv=fdatasync \ bs=8388608 count=16 2>&1|grep "copied"|cut -f1,6 -d" " \ |awk '{printf("write: %7.2f MB/s, ",$1/$2/(1024*1024))}' sync dd if=junk.bin iflag=direct conv=fdatasync of=/dev/null \ bs=8388608 count=16 2>&1|grep "copied"|cut -f1,6 -d" " \ |awk '{printf("read: %7.2f MB/s\n",$1/$2/(1024*1024))}' rm junk.bin done # vim:set sr et ts=4 sw=4 ft=sh: // See Vim, :help 'modeline'