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.

  • Are you attempting to stress test a drive that's failing or are you bench marking something? – Allan Aug 19 '18 at 15:24
  • Neither -- I'm attempting to stress test a new drive to make sure it's operating correctly and trigger any hardware defects that might appear early in its lifetime, before I put any data on it. – GuyGizmo Aug 19 '18 at 15:34
  • 1
    The Terminal command diskutil secureErase has a most rigorous Gutman algorithm 35-pass secure erase. During a secure erase, the disk is in constant use, writing continually to the drive. I would hazard a guess that running the 35-pass erase one or more times would put a decent amount of stress on the drive. NOTE: this is only effective on HDDs, and does not apply to SSDs. You should edit your question to be more specific about which drive type you are concerned about. – IconDaemon Aug 19 '18 at 17:57
  • @IconDaemon I mention specifically that it is a hard drive, which means not a solid state drive. Also I've already ran badblocks on the drive which performs a series of sequential writes as well as reads in various patterns, so there's no need to stress test it with another algorithm that does sequential writes. I'm specifically looking for something that does random reads and writes to make sure the other moving mechanisms in the drive other than the platter are without major defects, especially since those are more likely to be an early point of failure. – GuyGizmo Aug 19 '18 at 19:25
  • My apologies about misreading your post. The only moving parts in a HDD are the actuator (or access) arms which hold the read/write heads, and the spindle motor. Using diskutil and running many passes of a zeroing routine is the only native macOS way I know of, and have used successfully, to stress test a disk. The spindle will be rotating non-stop, and the actuator arms & read/write heads will be in constant motion over the surface of the platters for hours. The Backblaze Hard Drive Stats for 2017 is an enlightening read. – IconDaemon Aug 19 '18 at 20:10

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .