Linux: Testing Disk Speed

Below is an exercise in comparing 2 different media: external USB drive vs a SD card

# Perform the WRITE test on USB Disk
outputFile=/media/data/test.img
blocksize=1G
numberOfBlocks=1
dd if=/dev/zero of=$outputFile bs=$blocksize count=$numberOfBlocks oflag=dsync
rm $outputFile

# Perform the WRITE test on SD Card
outputFile=/media/kim/2849-2EAD/test.img
blocksize=1G
numberOfBlocks=1
dd if=/dev/zero of=$outputFile bs=$blocksize count=$numberOfBlocks oflag=dsync
rm $outputFile

# Read test must be performed subsequent to clearing the data being stored in RAM by switching the disk1 vs disk2 test files...

# Perform READ test on USB Disk
outputFile=/media/data/test.img
blocksize=1G
numberOfBlocks=1
echo 3 | sudo tee /proc/sys/vm/drop_caches
dd if=$outputFile of=/dev/null bs=$blocksize count=$numberOfBlocks

# Perform the READ test on SD Card
outputFile=/media/kim/2849-2EAD/test.img
blocksize=1G
numberOfBlocks=1
echo 3 | sudo tee /proc/sys/vm/drop_caches
dd if=$outputFile of=/dev/null bs=$blocksize count=$numberOfBlocks

Results:

# USB External Drive Write Speed
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 30.8095 s, 34.9 MB/s

# USB External Drive Read Speed
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 26.5893 s, 40.4 MB/s

# SD Card Write Speed
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 167.147 s, 6.4 MB/s

# SD Card Read Speed
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 68.2176 s, 15.7 MB/s
Posted on Categories Linux

Leave a Reply

Your email address will not be published. Required fields are marked *