Tiny Deathstars of Foulness

In the past I’ve discussed a number of other solutions for monitoring disk capacity and looking into where that capacity is being utilized.  But if you want to look into raw performance, then few tools are as useful as iostat.  iostat is a command line tool that looks at the input and output statistics (thus iostat) for various disks.  simply running the iostat command with no switches will show you a fair number of statistics about your system including per disk performance metrics, CPU utilization of those disks and average loads.

Running iostat with simply a -d option will only show information relevant to disks.  You can also follow the -d option with the specific disks to see information about only specified disks as follows:

iostat -d disk0 disk1

To see those same values in sectors per seconds instead of calculated based on block sizes you can also use the -o option as follows (assuming we were just looking at disk2):

iostat -od disk2

In the above command we could also have used the -K for kilobytes rather than block sizes, which can make math a bit easier according to what you’re trying to compare iostat output to.  You can also repeat the process on specified intervals using the -w option for historical analysis of disk io:

iostat -odw 1 disk2

Or look at totals instead of averages (which can also be ascertained by calculating all of the values of your columns from the previous command) using the -I option.  In the above command we had specified a wait time but we specified a number one.  We could also have specified a total number of times that command would output using the -c option.  -c assumes a 1 second wait, which is what we indicated above, so the command would have the same effect but the integer specified would be the number of repetitions rather than the amount of time between said repetitions.

iostat often comes in very handy for troubleshooting storage networks.  For example, if you have an iSCSI LUN and you are trying to determine where a bottleneck is, or even with an actual Xsan according to how you structure your commands.  Overall, any server administrator with complicated storage environments or even just a simple Drobo can benefit from using iostat!

August 6th, 2009

Posted In: Mac OS X, Mac OS X Server

Tags: , ,