Stress testing a hard drive with lots of random reads and writes
-
22-04-2021 - |
Question
I would like to stress test a hard drive with a long series of random reads and writes for a specified length of time, but I'm not sure how I can do it on macOS. I'm specifically interested in random reads and writes (as opposed to sequential reads and writes) as I want to make sure all of the physical components in the drive are stress tested.
One utility I've seen recommended for doing this is fio
. However, I'm not sure what the correct way to use it is, particularly since most of the tutorials I've found assume you are running Linux.
How can I do this? I'm open answers for how to use fio
or answers that recommend using another utility that can accomplish the same task.
Solution
This seems to do the trick:
sudo fio --name=randrw --time_based --runtime=86400 --ioengine=posixaio --iodepth=64 --rw=randrw --bs=64k --direct=1 --numjobs=8 --size=[size of disk] --filename=/dev/rdisk#
That should do a random read/write test for 24 The #
can be obtained with diskutil list
and [size of disk]
is obtained with diskutil info /dev/disk#
. I'm not sure if the --size
argument is actually necessary but I included it anyway.