Test-Script
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
LANG=C
[[ $EUID != "0" ]] && echo "Run as Root!" && exit
REPEAT=3
MNTPNT='/media/WDElements'
trap rmtestfiles EXIT
rmtestfiles() { sync && rm -fv $MNTPNT/*.testfile && sync;}
dropcache() { sync; echo $1 > /proc/sys/vm/drop_caches; }
rTest() { dd if=$1 of=/dev/null bs=$2 count=$3 iflag=nocache ;}
wTest() { dd if=/dev/urandom of=$1 bs=$2 count=$3 conv=fsync oflag=noatime,nocache;}
rmtestfiles
for size in 100M 10M 1M; do
echo "### Start Testing $size"
for byte in 16384K 8192K 4096K 2048K 1024K 512K 256K 128K 64K 32K 16K 8K 4K 2K 1K; do
count=$(echo "$(numfmt --from=iec $size) / $(numfmt --from=iec $byte)" | bc)
[[ $count -lt 1 ]] && continue
testfile="${size}_${count}x$byte.testfile"
dropcache 3
for nb in $(seq 1 $REPEAT); do
echo -n "$byte:$count ($nb) Write Speed: "
wTest $MNTPNT/$testfile $byte $count 2>&1 | tr '\n' ' ' | cut -d' ' -f14,15,16,17
#dropcache 3
done
dropcache 3
for nb in $(seq 1 $REPEAT); do
echo -n "$byte:$count ($nb) Read Speed: "
rTest $MNTPNT/$testfile $byte $count 2>&1 | tr '\n' ' ' | cut -d' ' -f14,15,16,17
#dropcache 3
done
done
echo "### End Testing $size"
done
If there is something wrong with the script, please tell. I don’t see a problem.
Well I tried to replicate this “USB Flash Benchmark” with bash and got this:
BTRFS and USB3. Meta and Data duplicated on one single HDD. Zstd level 9 and autodefrag enabled. That is my real world setup for personal cold backups right now.
### Start Testing 100M
16384K:6 (1) Write Speed: 1.29287 s, 77.9 MB/s
16384K:6 (2) Write Speed: 1.50744 s, 66.8 MB/s
16384K:6 (3) Write Speed: 1.56608 s, 64.3 MB/s
16384K:6 (1) Read Speed: 0.53011 s, 190 MB/s
16384K:6 (2) Read Speed: 0.507984 s, 198 MB/s
16384K:6 (3) Read Speed: 0.505723 s, 199 MB/s
8192K:12 (1) Write Speed: 0.884262 s, 114 MB/s
8192K:12 (2) Write Speed: 1.36955 s, 73.5 MB/s
8192K:12 (3) Write Speed: 1.19199 s, 84.4 MB/s
8192K:12 (1) Read Speed: 0.556886 s, 181 MB/s
8192K:12 (2) Read Speed: 0.479545 s, 210 MB/s
8192K:12 (3) Read Speed: 0.479772 s, 210 MB/s
4096K:25 (1) Write Speed: 1.29542 s, 80.9 MB/s
4096K:25 (2) Write Speed: 1.30706 s, 80.2 MB/s
4096K:25 (3) Write Speed: 1.70395 s, 61.5 MB/s
4096K:25 (1) Read Speed: 0.488619 s, 215 MB/s
4096K:25 (2) Read Speed: 0.473155 s, 222 MB/s
4096K:25 (3) Read Speed: 0.472469 s, 222 MB/s
2048K:50 (1) Write Speed: 0.876607 s, 120 MB/s
2048K:50 (2) Write Speed: 1.48282 s, 70.7 MB/s
2048K:50 (3) Write Speed: 1.1549 s, 90.8 MB/s
2048K:50 (1) Read Speed: 0.579834 s, 181 MB/s
2048K:50 (2) Read Speed: 0.498794 s, 210 MB/s
2048K:50 (3) Read Speed: 0.49789 s, 211 MB/s
1024K:100 (1) Write Speed: 0.922097 s, 114 MB/s
1024K:100 (2) Write Speed: 1.07112 s, 97.9 MB/s
1024K:100 (3) Write Speed: 1.41727 s, 74.0 MB/s
1024K:100 (1) Read Speed: 0.606878 s, 173 MB/s
1024K:100 (2) Read Speed: 0.486399 s, 216 MB/s
1024K:100 (3) Read Speed: 0.508281 s, 206 MB/s
512K:200 (1) Write Speed: 0.895902 s, 117 MB/s
512K:200 (2) Write Speed: 1.15331 s, 90.9 MB/s
512K:200 (3) Write Speed: 1.68063 s, 62.4 MB/s
512K:200 (1) Read Speed: 0.66513 s, 158 MB/s
512K:200 (2) Read Speed: 0.498464 s, 210 MB/s
512K:200 (3) Read Speed: 0.498793 s, 210 MB/s
256K:400 (1) Write Speed: 0.935493 s, 112 MB/s
256K:400 (2) Write Speed: 1.34326 s, 78.1 MB/s
256K:400 (3) Write Speed: 1.36245 s, 77.0 MB/s
256K:400 (1) Read Speed: 0.814263 s, 129 MB/s
256K:400 (2) Read Speed: 0.516276 s, 203 MB/s
256K:400 (3) Read Speed: 0.523649 s, 200 MB/s
128K:800 (1) Write Speed: 1.35716 s, 77.3 MB/s
128K:800 (2) Write Speed: 1.68334 s, 62.3 MB/s
128K:800 (3) Write Speed: 1.5773 s, 66.5 MB/s
128K:800 (1) Read Speed: 0.902514 s, 116 MB/s
128K:800 (2) Read Speed: 0.473502 s, 221 MB/s
128K:800 (3) Read Speed: 0.473593 s, 221 MB/s
64K:1600 (1) Write Speed: 1.43384 s, 73.1 MB/s
64K:1600 (2) Write Speed: 1.45282 s, 72.2 MB/s
64K:1600 (3) Write Speed: 1.61266 s, 65.0 MB/s
64K:1600 (1) Read Speed: 0.774598 s, 135 MB/s
64K:1600 (2) Read Speed: 0.49754 s, 211 MB/s
64K:1600 (3) Read Speed: 0.482019 s, 218 MB/s
32K:3200 (1) Write Speed: 1.2607 s, 83.2 MB/s
32K:3200 (2) Write Speed: 1.51682 s, 69.1 MB/s
32K:3200 (3) Write Speed: 1.81873 s, 57.7 MB/s
32K:3200 (1) Read Speed: 0.677298 s, 155 MB/s
32K:3200 (2) Read Speed: 0.489835 s, 214 MB/s
32K:3200 (3) Read Speed: 0.490294 s, 214 MB/s
16K:6400 (1) Write Speed: 1.09833 s, 95.5 MB/s
16K:6400 (2) Write Speed: 1.42074 s, 73.8 MB/s
16K:6400 (3) Write Speed: 1.38223 s, 75.9 MB/s
16K:6400 (1) Read Speed: 0.853249 s, 123 MB/s
16K:6400 (2) Read Speed: 0.490273 s, 214 MB/s
16K:6400 (3) Read Speed: 0.48123 s, 218 MB/s
8K:12800 (1) Write Speed: 1.22265 s, 85.8 MB/s
8K:12800 (2) Write Speed: 1.43112 s, 73.3 MB/s
8K:12800 (3) Write Speed: 1.632 s, 64.3 MB/s
8K:12800 (1) Read Speed: 0.653412 s, 160 MB/s
8K:12800 (2) Read Speed: 0.49403 s, 212 MB/s
8K:12800 (3) Read Speed: 0.484151 s, 217 MB/s
4K:25600 (1) Write Speed: 1.46167 s, 71.7 MB/s
4K:25600 (2) Write Speed: 1.58583 s, 66.1 MB/s
4K:25600 (3) Write Speed: 1.70035 s, 61.7 MB/s
4K:25600 (1) Read Speed: 0.761363 s, 138 MB/s
4K:25600 (2) Read Speed: 0.518892 s, 202 MB/s
4K:25600 (3) Read Speed: 0.543795 s, 193 MB/s
2K:51200 (1) Write Speed: 1.08396 s, 96.7 MB/s
2K:51200 (2) Write Speed: 1.30224 s, 80.5 MB/s
2K:51200 (3) Write Speed: 1.91481 s, 54.8 MB/s
2K:51200 (1) Read Speed: 1.66836 s, 62.9 MB/s
2K:51200 (2) Read Speed: 1.35706 s, 77.3 MB/s
2K:51200 (3) Read Speed: 1.72659 s, 60.7 MB/s
1K:102400 (1) Write Speed: 0.978252 s, 107 MB/s
1K:102400 (2) Write Speed: 1.39898 s, 75.0 MB/s
1K:102400 (3) Write Speed: 1.85517 s, 56.5 MB/s
1K:102400 (1) Read Speed: 2.78827 s, 37.6 MB/s
1K:102400 (2) Read Speed: 3.01967 s, 34.7 MB/s
1K:102400 (3) Read Speed: 2.85055 s, 36.8 MB/s
### End Testing 100M
### Start Testing 10M
8192K:1 (1) Write Speed: 0.073653 s, 114 MB/s
8192K:1 (2) Write Speed: 0.140779 s, 59.6 MB/s
8192K:1 (3) Write Speed: 0.153383 s, 54.7 MB/s
8192K:1 (1) Read Speed: 0.0579272 s, 145 MB/s
8192K:1 (2) Read Speed: 0.0563245 s, 149 MB/s
8192K:1 (3) Read Speed: 0.0531636 s, 158 MB/s
4096K:2 (1) Write Speed: 0.0693751 s, 121 MB/s
4096K:2 (2) Write Speed: 0.118055 s, 71.1 MB/s
4096K:2 (3) Write Speed: 0.111455 s, 75.3 MB/s
4096K:2 (1) Read Speed: 0.207045 s, 40.5 MB/s
4096K:2 (2) Read Speed: 0.0484289 s, 173 MB/s
4096K:2 (3) Read Speed: 0.0487514 s, 172 MB/s
2048K:5 (1) Write Speed: 0.0688738 s, 152 MB/s
2048K:5 (2) Write Speed: 0.0679105 s, 154 MB/s
2048K:5 (3) Write Speed: 0.0707048 s, 148 MB/s
2048K:5 (1) Read Speed: 0.0916102 s, 114 MB/s
2048K:5 (2) Read Speed: 0.0514529 s, 204 MB/s
2048K:5 (3) Read Speed: 0.0570046 s, 184 MB/s
1024K:10 (1) Write Speed: 0.0772935 s, 136 MB/s
1024K:10 (2) Write Speed: 0.1185 s, 88.5 MB/s
1024K:10 (3) Write Speed: 0.11514 s, 91.1 MB/s
1024K:10 (1) Read Speed: 0.294325 s, 35.6 MB/s
1024K:10 (2) Read Speed: 0.039932 s, 263 MB/s
1024K:10 (3) Read Speed: 0.0401828 s, 261 MB/s
512K:20 (1) Write Speed: 0.0860447 s, 122 MB/s
512K:20 (2) Write Speed: 0.107296 s, 97.7 MB/s
512K:20 (3) Write Speed: 0.0926687 s, 113 MB/s
512K:20 (1) Read Speed: 0.264115 s, 39.7 MB/s
512K:20 (2) Read Speed: 0.057163 s, 183 MB/s
512K:20 (3) Read Speed: 0.0569137 s, 184 MB/s
256K:40 (1) Write Speed: 0.135967 s, 77.1 MB/s
256K:40 (2) Write Speed: 0.117229 s, 89.4 MB/s
256K:40 (3) Write Speed: 0.0851557 s, 123 MB/s
256K:40 (1) Read Speed: 0.0837775 s, 125 MB/s
256K:40 (2) Read Speed: 0.0529656 s, 198 MB/s
256K:40 (3) Read Speed: 0.0568389 s, 184 MB/s
128K:80 (1) Write Speed: 0.118512 s, 88.5 MB/s
128K:80 (2) Write Speed: 0.128081 s, 81.9 MB/s
128K:80 (3) Write Speed: 0.116963 s, 89.7 MB/s
128K:80 (1) Read Speed: 0.132672 s, 79.0 MB/s
128K:80 (2) Read Speed: 0.0340472 s, 308 MB/s
128K:80 (3) Read Speed: 0.0328481 s, 319 MB/s
64K:160 (1) Write Speed: 0.0775761 s, 135 MB/s
64K:160 (2) Write Speed: 0.260987 s, 40.2 MB/s
64K:160 (3) Write Speed: 0.123599 s, 84.8 MB/s
64K:160 (1) Read Speed: 0.118175 s, 88.7 MB/s
64K:160 (2) Read Speed: 0.0405875 s, 258 MB/s
64K:160 (3) Read Speed: 0.0404779 s, 259 MB/s
32K:320 (1) Write Speed: 0.410012 s, 25.6 MB/s
32K:320 (2) Write Speed: 0.0824715 s, 127 MB/s
32K:320 (3) Write Speed: 0.100414 s, 104 MB/s
32K:320 (1) Read Speed: 0.103047 s, 102 MB/s
32K:320 (2) Read Speed: 0.0459528 s, 228 MB/s
32K:320 (3) Read Speed: 0.0402611 s, 260 MB/s
16K:640 (1) Write Speed: 0.120041 s, 87.4 MB/s
16K:640 (2) Write Speed: 0.125312 s, 83.7 MB/s
16K:640 (3) Write Speed: 0.086437 s, 121 MB/s
16K:640 (1) Read Speed: 0.183308 s, 57.2 MB/s
16K:640 (2) Read Speed: 0.0507393 s, 207 MB/s
16K:640 (3) Read Speed: 0.0568081 s, 185 MB/s
8K:1280 (1) Write Speed: 0.114561 s, 91.5 MB/s
8K:1280 (2) Write Speed: 0.375556 s, 27.9 MB/s
8K:1280 (3) Write Speed: 0.102337 s, 102 MB/s
8K:1280 (1) Read Speed: 0.127409 s, 82.3 MB/s
8K:1280 (2) Read Speed: 0.0582529 s, 180 MB/s
8K:1280 (3) Read Speed: 0.0571089 s, 184 MB/s
4K:2560 (1) Write Speed: 0.093905 s, 112 MB/s
4K:2560 (2) Write Speed: 0.12697 s, 82.6 MB/s
4K:2560 (3) Write Speed: 0.101461 s, 103 MB/s
4K:2560 (1) Read Speed: 0.121436 s, 86.3 MB/s
4K:2560 (2) Read Speed: 0.0598876 s, 175 MB/s
4K:2560 (3) Read Speed: 0.0651012 s, 161 MB/s
2K:5120 (1) Write Speed: 0.0973148 s, 108 MB/s
2K:5120 (2) Write Speed: 0.158308 s, 66.2 MB/s
2K:5120 (3) Write Speed: 0.0837571 s, 125 MB/s
2K:5120 (1) Read Speed: 0.152488 s, 68.8 MB/s
2K:5120 (2) Read Speed: 0.0738526 s, 142 MB/s
2K:5120 (3) Read Speed: 0.0738581 s, 142 MB/s
1K:10240 (1) Write Speed: 0.126738 s, 82.7 MB/s
1K:10240 (2) Write Speed: 0.198501 s, 52.8 MB/s
1K:10240 (3) Write Speed: 0.186592 s, 56.2 MB/s
1K:10240 (1) Read Speed: 0.132547 s, 79.1 MB/s
1K:10240 (2) Read Speed: 0.0910193 s, 115 MB/s
1K:10240 (3) Read Speed: 0.0660314 s, 159 MB/s
### End Testing 10M
### Start Testing 1M
1024K:1 (1) Write Speed: 0.0122246 s, 85.8 MB/s
1024K:1 (2) Write Speed: 0.00987548 s, 106 MB/s
1024K:1 (3) Write Speed: 0.0103183 s, 102 MB/s
1024K:1 (1) Read Speed: 0.0215833 s, 48.6 MB/s
1024K:1 (2) Read Speed: 0.00514755 s, 204 MB/s
1024K:1 (3) Read Speed: 0.0059678 s, 176 MB/s
512K:2 (1) Write Speed: 0.0163474 s, 64.1 MB/s
512K:2 (2) Write Speed: 0.0189675 s, 55.3 MB/s
512K:2 (3) Write Speed: 0.0187888 s, 55.8 MB/s
512K:2 (1) Read Speed: 0.0195013 s, 53.8 MB/s
512K:2 (2) Read Speed: 0.00379879 s, 276 MB/s
512K:2 (3) Read Speed: 0.00388944 s, 270 MB/s
256K:4 (1) Write Speed: 0.00933148 s, 112 MB/s
256K:4 (2) Write Speed: 0.00932906 s, 112 MB/s
256K:4 (3) Write Speed: 0.00925712 s, 113 MB/s
256K:4 (1) Read Speed: 0.0357854 s, 29.3 MB/s
256K:4 (2) Read Speed: 0.0132441 s, 79.2 MB/s
256K:4 (3) Read Speed: 0.0130606 s, 80.3 MB/s
128K:8 (1) Write Speed: 0.00976928 s, 107 MB/s
128K:8 (2) Write Speed: 0.0109926 s, 95.4 MB/s
128K:8 (3) Write Speed: 0.010884 s, 96.3 MB/s
128K:8 (1) Read Speed: 0.0558117 s, 18.8 MB/s
128K:8 (2) Read Speed: 0.00449468 s, 233 MB/s
128K:8 (3) Read Speed: 0.0041435 s, 253 MB/s
64K:16 (1) Write Speed: 0.0100318 s, 105 MB/s
64K:16 (2) Write Speed: 0.0815589 s, 12.9 MB/s
64K:16 (3) Write Speed: 0.0165261 s, 63.4 MB/s
64K:16 (1) Read Speed: 0.0545618 s, 19.2 MB/s
64K:16 (2) Read Speed: 0.00477978 s, 219 MB/s
64K:16 (3) Read Speed: 0.0044795 s, 234 MB/s
32K:32 (1) Write Speed: 0.011762 s, 89.1 MB/s
32K:32 (2) Write Speed: 0.0168813 s, 62.1 MB/s
32K:32 (3) Write Speed: 0.017198 s, 61.0 MB/s
32K:32 (1) Read Speed: 0.0363938 s, 28.8 MB/s
32K:32 (2) Read Speed: 0.0139402 s, 75.2 MB/s
32K:32 (3) Read Speed: 0.0136268 s, 76.9 MB/s
16K:64 (1) Write Speed: 0.0101102 s, 104 MB/s
16K:64 (2) Write Speed: 0.0135958 s, 77.1 MB/s
16K:64 (3) Write Speed: 0.0169257 s, 62.0 MB/s
16K:64 (1) Read Speed: 0.0295203 s, 35.5 MB/s
16K:64 (2) Read Speed: 0.0123436 s, 84.9 MB/s
16K:64 (3) Read Speed: 0.00809175 s, 130 MB/s
8K:128 (1) Write Speed: 0.0109601 s, 95.7 MB/s
8K:128 (2) Write Speed: 0.0103475 s, 101 MB/s
8K:128 (3) Write Speed: 0.0101721 s, 103 MB/s
8K:128 (1) Read Speed: 0.0312201 s, 33.6 MB/s
8K:128 (2) Read Speed: 0.0146523 s, 71.6 MB/s
8K:128 (3) Read Speed: 0.0154254 s, 68.0 MB/s
4K:256 (1) Write Speed: 0.0142551 s, 73.6 MB/s
4K:256 (2) Write Speed: 0.00996405 s, 105 MB/s
4K:256 (3) Write Speed: 0.0101978 s, 103 MB/s
4K:256 (1) Read Speed: 0.0338269 s, 31.0 MB/s
4K:256 (2) Read Speed: 0.0153038 s, 68.5 MB/s
4K:256 (3) Read Speed: 0.00647492 s, 162 MB/s
2K:512 (1) Write Speed: 0.0104947 s, 99.9 MB/s
2K:512 (2) Write Speed: 0.0105306 s, 99.6 MB/s
2K:512 (3) Write Speed: 0.0105412 s, 99.5 MB/s
2K:512 (1) Read Speed: 0.0357558 s, 29.3 MB/s
2K:512 (2) Read Speed: 0.015758 s, 66.5 MB/s
2K:512 (3) Read Speed: 0.0131153 s, 80.0 MB/s
1K:1024 (1) Write Speed: 0.0183438 s, 57.2 MB/s
1K:1024 (2) Write Speed: 0.0157563 s, 66.5 MB/s
1K:1024 (3) Write Speed: 0.0157651 s, 66.5 MB/s
1K:1024 (1) Read Speed: 0.0264294 s, 39.7 MB/s
1K:1024 (2) Read Speed: 0.0135319 s, 77.5 MB/s
1K:1024 (3) Read Speed: 0.0141164 s, 74.3 MB/s
### End Testing 1M
PS: @zippydippy please use code blocks instead of block quotes for logs and terminal outputs. Thanks.