How do I know when my HD is under maintenance?

I work with several large movie files, almost all with 150+ GB. And sometimes I experience a harsh slow down on my iMac's speed which is accompanied by a writing/reading HD noise. So I'm pretty sure the disc is defragging or doing some kind of maintenance. According to this article:

https://www.macworld.co.uk/how-to/mac/how-defrag-mac-why-you-dont-need-3600241/

"That's not to say that a manual defrag is never needed; it's just rare. People (usually creatives) that have hundreds of films/audio/multimedia files larger than 1GB may need to defrag a Mac."

So I wonder if:

is there a method to find out if my HD is under maintenance?

Can I took control over this process? Like changing the schedule of the task, maybe using one of the listed tps of the article?


Further info

enter image description here

enter image description here


The problems you're experiencing are not due to this "automatic defragmention".

You question seem to indicate that you think of this defragmentation similar to for example the Windows defragmentation program, where you start a lengthy process and wait for minutes or hours where the disk is fully utilized, and then finally your disk is defragmented. This is simply not how it works here, so your questions do not make sense in that regard.

"Automatic defragmentation" on HFS+ happens in two ways: On-the-fly and Hot File Clustering.

  • On-the-fly means that whenever the system opens a file, it checks if the file is sufficiently small (<20 MB), is not busy, is not read-only, it has not been changed in the past minute and is sufficiently fragmented (>8 extents). If all those conditions are true, and the computer has been running for more than 3 minutes, then the file (and only that file) is defragmented on-the-fly.

  • Hot File Clustering means that the operating system keeps track of the most used files on your system - up to 5000 files. When such a new file is added to the top list, and the file is sufficiently small (<10 MB), then the file is moved to a specific hot zone on the disk. This implicitly defragments the file.

Therefore:

  1. The hard drive is never "under maintenance". Automatic defragmentation is not something that is done for a full drive, and it is not something that hinders other accesses to the disk. Thus it doesn't make sense to try to figure out if your disk is "under maintenance".

  2. You cannot take control of the processs. There's no lengthy process happening that is defragmentation your entire disk at once. Thus there's really not much to control in the process. The actual automatic defragmentation occurs over the course of a single second or less.

  3. You cannot change the schedule of the process - because there isn't a schedule. This is not like for example Windows Defragmentation where some in the Windows 95-era would set up a scheduled task to defragment their hard disk every Monday evening. Automatic defragmentation here does not happen on a time based schedule. Instead it is simply based on which files you open - which cannot be predicted in advance.

  4. Both types of "automatic defragmentation" only works on small files (<20 MB or <10 MB) - so they could never have been invoked for your 150+ GB large files.

The macOS system does not by default perform any other type of automatic, periodic "maintenance" of a hard drive without being requested specifically by the user.

Therefore you'll need to look for something "out of the ordinary", such as a hardware error, software bug or configuration issue. You can do this for example by:

  1. Examining system Console logs and dmesg outputs for indications of I/O errors from the RAID-drive.

  2. Examining administrative software for your OWC RAID-system to see if it has logs or indicators of errors or problems.

  3. Use disk latency testing tools (such as for example fio) to check if your RAID-drive has latency issues in general, for example with high number of IOPS.

  4. Use system monitoring tools such as Activity Monitor, top, filesys, etc. to check for resource exhaustion and/or programs hogging the disk bandwidth.


There is no maintenance - there is just how the IO subsystem chooses to write new blocks.

* (Sorry to refute the whole premise of your question, but based on the comments - I wanted to reinforce this answer plainly and clearly for everyone.)

An abnormally slow HD is the #1 sign that it's about to fail, so please make a backup before anything else. Put another way, thinking your hard drive is doing extra clean up work actually is the failure mode where it re-maps bad blocks and takes a lot of reads / writes to verify data was saved correctly. It's potentially dealing with reliability and accuracy that has nothing to do with the OS.


To solve the slowness, you'll have to look into the performance or run hardware tests to see why you're not getting the bandwidth or iOPS you expect from your hardware. (as the excellent answer here already details)

Before you do that, I'd probably make a full backup and wipe the Mac and erase / install a clean OS.

You'll know right away if the performance is back or if you have hardware issues. From there, you can restore your accounts and apps and data and then see if it was user level corruption. The work above requires pretty technical skills and lots of time. An erase can happen while you're out for a hike or eating and the testing takes just a short time. If you need to restore from a backup, do that before bed and it usually is done before you wake.