@jgreco Great script, thanks! Been using it on several new systems and drives, for quick benchmarking and for longer duration stress testing of new and old drives alike.
Regarding the seek-heavy test, the suggested time estimate is for a single pass of "dd" while the test runs 6 in parallel for each drive. Scaling up this estimate by at least a factor 6 would be prudent. Something simple like having the first argument be the multiplication factor works.
Code:
approximatepasstime() {
# multiplication factor as first argument, followed by one or more disks
disksize=`getdisksize "${2}"`
if [ "${disksize}" -gt 0 ]; then
echo "The disk ${1} appears to be ${disksize} MB. "
speed=`samplediskspeed "${2}"`
echo "${disksize} ${speed} ${1}" | awk '{if ($2 != 0) {speed=$2} else {speed=1}; printf "Disk is reading at about %0.0f MB/sec \nThis suggests that this pass may take around %0.0f minutes\n", speed, $1 / speed / 60 * $3}'
else
echo "Unable to determine disk ${2} size from dmesg file (not fatal but odd!)"
fi
}
# parallel read
approximatepasstime 1 ${disklist}
# seek heavy read
approximatepasstime 6 ${disklist}
Additionally, estimates are disregarding the somewhat unknown of how read speeds typically reduce over the span of a drive. A quick read sampling near the end of the drive could be used to interpolate the average over a full drive. It also only looks at the first drive, while there may be larger and/or slower drives. I understand if you don't feel the need to dump a lot of code in here though, and that many (most?) arrays will be quite homogenous and it's not too difficult extrapolating yourself from the data provided.
(and there's a typo: "thhis")
Code:
This next test attempts to read all devices while forcing seeks.
This is primarily a stress test of your hard disks. It does thhis
by running several simultaneous dd sessions on each disk.
Performing initial parallel seek-stress array read
Wed Jan 3 17:25:52 CET 2024
The disk da0 appears to be 9537536 MB.
Disk is reading at about 217 MB/sec
This suggests that this pass may take around 733 minutes
Serial Parall % of
Disk Disk Size MB/sec MB/sec Serial
------- ---------- ------ ------ ------
da0 9537536MB 243 216 89
da1 15259648MB 211 166 79
da2 15259648MB 218 168 77
da3 9537536MB 244 217 89
Awaiting completion: initial parallel seek-stress array read
If anyone is interested in getting a progress snapshot from at least the one instance of "dd" per drive, the first dd started has stderr captured, and a non-interrupting kill signal can be sent to all "dd" processes to trigger the output below.
kill -INFO on TrueNAS CORE (BSD) or kill -USR1 on TrueNAS SCALE (Linux).
Code:
root@truenas[~]# kill -INFO $(pgrep ^dd$)
root@truenas[~]# cat /tmp/sat.da0.err /tmp/sat.da1.err /tmp/sat.da2.err /tmp/sat.da3.err
5598014+0 records in
5598014+0 records out
5869943128064 bytes transferred in 143745.645171 secs (40835624 bytes/sec)
4842212+0 records in
4842212+0 records out
5077427290112 bytes transferred in 143745.678217 secs (35322295 bytes/sec)
4761574+0 records in
4761574+0 records out
4992872218624 bytes transferred in 143745.704238 secs (34734062 bytes/sec)
5496479+0 records in
5496479+0 records out
5763475963904 bytes transferred in 143745.888619 secs (40094893 bytes/sec)
root@truenas[~]#