6

In my Macbook Pro, I have two internal drives and I've connected a third drive via USB in enclosure.

I am currently doing a secure wipe of the external drive and I was interested in seeing what the disk I/O was for that particular drive, but when I use Activity Monitor I only see the total disk usage for all drives combined.

Is there any way to monitor a specific drive's total I/O, preferably via a built-in or free method? I don't want to filter by process ID. I just want to filter by mounted disk.

EDIT: It seems like for normal mounted drives, the Terminal program iostat should be sufficient. However, for unmounted drives (like ones which are being secure wiped in Disk Utility) iostat will not show the drive even though Activity Monitor seems to have a way to report the disk I/O for it.

4 Answers 4

3

Check out the 'iostat' command.

You run the command from Terminal. Run 'man iostat' to get the manual page.

Here's a quick overview about using it with Linux.

http://www.cyberciti.biz/tips/linux-disk-performance-monitoring-howto.html

5
  • 1
    I had given this a try before posting my question, but it didn't work for me. I should have mentioned that. I am able to see the external drive when I do diskutil list but because it is not mounted (currently not partitioned, formatted, and is being secure erased), it does not show up under iostat.
    – raffi
    Commented Mar 26, 2012 at 19:29
  • 1
    Ah, I see your trouble. Now I'm just speculating, but I doubt that you can monitor io without the drive mounted, or without exclusive access to the device from the monitoring tool.
    – pjmelling
    Commented Mar 26, 2012 at 22:12
  • I thought so as well, but when I saw that Activity Monitor was reporting the I/O speeds for what looked like the secure erase (I was not doing anything else on my main drives at that time yet the write speeds were doing about 30 MB/s), I thought it might still be possible. But, there's a good possibility that you are correct.
    – raffi
    Commented Mar 27, 2012 at 14:33
  • Doesn't work in High Sierra. Get iostat: could not record 'disk3' for monitoring even when run via sudo.
    – msc
    Commented Feb 2, 2018 at 6:09
  • does work in mojave, without sudo or su Commented Apr 16, 2020 at 21:40
3
sudo fs_usage -f diskio -t 1 

may well give you a -t=1 second's worth of information.

man fs_usage will tell what the data columns are. With -f diskio option, I got these columns out:

  • CALL The name of the network or filesystem related call, page-in, page-out, or physical disk access.
  • BYTE COUNT Of the form B=x, x is the number of bytes requested by the call.
  • DISK BLOCK NUMBER Of the form D=0xnnnnnnnn, where 0xnnnnnnnn is the block number of the physical disk block being read or written.
  • TIME INTERVAL(W) The elapsed time spent in the system call. A ‘W’ after the elapsed time indicates the process was scheduled out during this file activity. In this case, the elapsed time includes the wait time.
  • PROCESS NAME The process that made the system call. Wide mode will append the thread id to the process name (i.e Mail.nnn).

Adding up a few seconds worth of B= values would give you total data for that time range.

1

iotop is a nice tool. Don't have a Mac, but works nice under Linux

0

According to this forum discussion, GeekTool might provide the functionality that you need:

Try GeekTool (tutorials from Lifehacker tutorial and ThemeMyMac, lots of scripts at the MacRumors forums).

I don't have access to my Mac at work, but you should be able to do some monitoring or find/create a script that does what you need with this tool.

2
  • I encountered this solution while researching too, but I searched through the thread and other sites and couldn't find any useful scripts that would be of help. In any case, GeekTool seems to mostly support pre-existing commands that I would otherwise be able to run via the Terminal. I still haven't found a suitable command to do that. But thanks for the suggestion.
    – raffi
    Commented Mar 26, 2012 at 21:44
  • Doesn't work in High Sierra. Get dtrace: invalid probe specifier.
    – msc
    Commented Feb 2, 2018 at 6:09

You must log in to answer this question.

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