Monitor Disk Activity in Mac OS X

Jan 20, 2012 - 1 Comment

Monitor Disk Activity in Mac OS X

You can monitor disk activity in Mac OS X by using the Activity Monitor app or several command line tools. Activity Monitor is the easiest and most user friendly, but the Terminal options allow further information to be retrieved.

Watching Disk Activity with Activity Monitor

  • Launch Activity Monitor, located in /Applications/Utilities/, or you can hit Command+Space Bar to bring up Spotlight search and find it that way
  • Click on the Disk Activity tab near the bottom
  • The graph on the right plots Disk Activity
  • Pay special attention to “Data read/sec” and “Data written/sec”

What’s causing the disk usage? Sometimes it correlates with CPU usage, and some apps and processes are heavy on both, like when converting video, audio, or Spotlights mds and mdworker. To know for sure, launch the Terminal from /Applications/Utilities/ and read on.

Monitoring Disk Activity from the Command Line

What is shown in Activity Monitor can be somewhat limited, and if you want information specific to what application or process is causing disk input and output, you can launch the Terminal and use the following commands to get more information.

iotop

First up is iotop, which, unsurprisingly given the name, is like top for I/O

sudo iotop -C 5 10

iotop will report back something like this, showing the overall disk read/write, as well as processes, command (or app) and the byte size being written actively by each process:
iotop output

To easier compare apps and processes that are using the disk, pass the -P flag along with the iotop command, then pay attention to the % I/O column:

sudo iotop -P -C 5 10

iotop can also be narrowed down by disk drive by pointing at the path and using the -m flag. In the example below, the root filesystem only will be watched for activity:

sudo iotop -Pm /

iotop isn’t the only option though…

fs_usage

The fs_usage app is another choice to see what’s going on with disk activity and the file system. By default, fs_usage can be bit of a firehose, displaying a ton of data that may be overboard for some basic needs:

sudo fs_usage -f filesys

fs_usage output

fs_usage also shows disk reads and writes and the application or process causing them.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: William Pearson in Command Line, Mac OS X, Tips & Tricks

One Comment

» Comments RSS Feed

  1. David Rees says:

    Thanks for the very useful tips. On 10.7.4 I get the error “dtrace: error on enabled probe ID 5 ” which I had work around by using “2> /dev/null”. Any idea what the issue is?

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates