Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
Last active May 12, 2020 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZiTAL/038b27ae0882d915527abd588cb79499 to your computer and use it in GitHub Desktop.
Save ZiTAL/038b27ae0882d915527abd588cb79499 to your computer and use it in GitHub Desktop.
gnu/linux disk speed test
ser=`whoami`
commands="apt-get clean; apt-get update; apt-get upgrade; apt-get dist-upgrade"
if [ $user != "root" ]; then
echo "root needed"
exit 1
fi
dev="/dev/sda"
echo "Write: Cache True 1GB"
hdparm -W1 $dev
dd if=/dev/zero of=/tmp/testfile bs=1G count=1 oflag=direct
echo "##############################################################"
echo ""
echo "Write: Cache False 1GB"
hdparm -W0 $dev
dd if=/dev/zero of=/tmp/testfile bs=1G count=1 oflag=direct
echo "##############################################################"
echo ""
echo "Write: Cache True 1MB"
hdparm -W1 $dev
dd if=/dev/zero of=/tmp/testfile bs=1M count=1000 oflag=direct
echo "##############################################################"
echo ""
echo "Write: Cache False 1MB"
hdparm -W0 $dev
dd if=/dev/zero of=/tmp/testfile bs=1M count=1000 oflag=direct
echo "##############################################################"
echo ""
echo "Read speed:"
dd if=/tmp/testfile of=/dev/zero bs=1M count=1000
echo "##############################################################"
echo ""
exit 0
Write: Cache True 1GB
/dev/sda:
setting drive write-caching to 1 (on)
write-caching = 1 (on)
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 2.80585 s, 383 MB/s
##############################################################
Write: Cache False 1GB
/dev/sda:
setting drive write-caching to 0 (off)
write-caching = 0 (off)
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 5.64957 s, 190 MB/s
##############################################################
Write: Cache True 1MB
/dev/sda:
setting drive write-caching to 1 (on)
write-caching = 1 (on)
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 3.03638 s, 345 MB/s
##############################################################
Write: Cache False 1MB
/dev/sda:
setting drive write-caching to 0 (off)
write-caching = 0 (off)
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 7.81909 s, 134 MB/s
##############################################################
Read speed:
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 2.11962 s, 495 MB/s
##############################################################
@ZiTAL
Copy link
Author

ZiTAL commented May 12, 2020

rasperry pi3:

Write: 1MB
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 5.07658 s, 20.7 MB/s
##############################################################

Read speed:
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 4.46877 s, 23.5 MB/s
##############################################################

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment