Skip to content

Instantly share code, notes, and snippets.

@iddm
Last active March 27, 2022 06:28
Show Gist options
  • Save iddm/bdd79e63a576d77c2f2919df377ac9cc to your computer and use it in GitHub Desktop.
Save iddm/bdd79e63a576d77c2f2919df377ac9cc to your computer and use it in GitHub Desktop.
Universal Linux SSD Write speed test
#!/bin/sh
# This will read 4GB+ data from /dev/zero and write to a test file in current directory.
# If you need to test the speed of your SSD drive, go to any partition with it with a filesystem
# with write support, make sure you have rights to do this and then run the command below (or just this script).
# As a sort of customisation, the block size ideally should be identical to the block size of your device:
# https://unix.stackexchange.com/questions/52215/determine-the-size-of-a-block-device
# However, the `64k` value worked absolutely fine for my setup.
dd if=/dev/zero of=test_$$ bs=64k count=64k conv=fdatasync && rm -f test_$$
# The example outputs are:
# 1. My PCIE Gen. 3 NVME SSD (Samsung 970 EVO Plus 2TB):
# dd if=/dev/zero of=test_$$ bs=64k count=512k conv=fdatasync && rm -f test_$$
# 524288+0 records in
# 524288+0 records out
# 34359738368 bytes (34 GB, 32 GiB) copied, 14.2328 s, 2.4 GB/s
# But when inserted into PCIE Gen. 2 using an NVMe to PCIe-3 adapter, the speeds are:
# dd if=/dev/zero of=test_$$ bs=64k count=64k conv=fdatasync && rm -f test_$$
# 65536+0 records in
# 65536+0 records out
# 4294967296 bytes (4.3 GB, 4.0 GiB) copied, 3.66606 s, 1.2 GB/s
# 2. Sata SSD - OCZ Vertex-4 (256GB):
# dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync && rm -f test_$$
# 16384+0 records in
# 16384+0 records out
# 1073741824 bytes (1.1 GB, 1.0 GiB) copied, 5.10459 s, 210 MB/s
# 3. Not much old SATA HDD - WDC WD2004FBYZ-0
# dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync && rm -f test_$$
# 16384+0 records in
# 16384+0 records out
# 1073741824 bytes (1.1 GB, 1.0 GiB) copied, 6.05194 s, 177 MB/s
# 4. Really old SATA HDD - SAMSUNG HD160JJ:
# dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync && rm -f test_$$
# 16384+0 records in
# 16384+0 records out
# 1073741824 bytes (1.1 GB, 1.0 GiB) copied, 21.2671 s, 50.5 MB/s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment