How can I log my SSD's read performance over time?
I'd like to keep a log over time, perhaps weekly, of my solid state drive's read rate as determined by a tool like System -> Administration -> Disk Utility -> Benchmark:
Is there a way to archive the test data from Disk Utility, or can you think of any other tools that would allow me to accumulate this kind of data semi-automatically?
I would like to be able to perform the benchmark using read-only methods so as not to unnecessarily wear the drive.
Take a look at bonnie++
.
You'll need to awk
and grep
the hell out of it to get the numbers you want to log over time, but it should be possible to echo what you want in a comma-separated-value format to a new line of a log file.
Cron that up and in six months time, import that into a spreadsheet and plot a nice graph. Or use R.
Edit: Bonnie++ actually writes a CSV as its last line of output, so that would be somewhat easier to pull into long time logs (if you can work out what the column titles are).
But Bonnie++ relies on being able to write a file (or multiple) to the filesystem and then it runs read tests against those files. People make a lot of fuss about SSD wear so this might not be optimum.
hdparm
can also do tests. These are somewhat simple compared to bonnie++
but they'll run fast (bonnie++
can be a resource hog when it runs) and don't need to write to the disk. That also means it's not testing the efficiency of the filesystem that will (hopefully) improve over time with kernel upgrades.
You can run a test like this:
sudo hdparm -t /dev/sda
And it'll respond with something like this:
/dev/sdf:
Timing buffered disk reads: 432 MB in 3.01 seconds = 143.53 MB/sec
Now, this doesn't cover latency. If that bothers you, there is a script called seeker that you can download and compile which does some seeks and measures the time. You'd need to learn a bit of C but you could customise the output to something you could log easier.
Or you could trust that the response time on a SSD just isn't going to get much worse than ~0.3ms
If you do want to capture the detailed data from Disk Utility (aka the "palimpsest" program), you can make a copy of the cached data in the ~/.cache/gnome-disk-utility/drive-benchmark
directory. It seems that you'll find the latest results for each disk there, in a format that is odd but not too hard to parse (data rows separated by colons....). You could just copy those files to an archive, giving them a unique name each time. Unfortunately they are overwritten in the cache each time, and the summary data is not recorded, so you'd need to recalculate that.
See 'Bug #794929 in gnome-disk-utility (Ubuntu): “Disk Utility benchmark, x-axis undefined”' for a request and response on providing more clarity on what the data actually mean.