Tuesday, June 21, 2011

Solaris dskinfo utility

Solaris and it's derivatives are perhaps the best general OS for storage thanks to ZFS, COMSTAR and the native CIFS implementation. It lacks however a single tool for managing disks before they are part of a ZFS pool, disk group or filesystem. With a few disks it's somewhat manageable but when you have tens or hundreds of disks on a system it's hard to get a good overview. This becomes even harder if MPxIO is used or the disks are LUNs from a SAN so that you want to see the logical unit numbers.

You can manually map the MPxIO names against logical unit numbers with luxadm, see the size with format or iostat and find used disks with zpool status, mount or some other. This does require many different commands and you will not get all the information listed in once place.

A while ago I wrote a utility to collect and present disk information in Solaris that I called dskinfo. It relies heavily on existing commands in Solaris and parses their output but have worked very well for me in many different environments.

This initial version is best suited for systems using ZFS since it can only show the usage of disks part of a zpool (exported or imported). It can still be used to get a summary of all disks on the system and later version might add additional filesystems and volume managers as well. I have labeled this version 0.9 and I will use feedback to create a 1.0 version before I look into adding more functionality.

dskinfo displays disk information with four subcommands: list, list-long, list-full or list-parsable. The two first commands will output data on a single line with different number of fields, list-full will display all data on two lines per disk and list-parsable will display all data on one line with fields separated by a colon.

I have tested dskinfo on Solaris 10, Solaris 11, OpenIndiana and Nexenta with both local, iSCSI and fiber channel attached disks.

Example, I have only included the shortest type of list since the formatting here makes the other look terrible, they all look good in 80 columns:
$ dskinfo list                          
disk size use type
c5t0d0 149G rpool disk
c5t2d0 37G - disk
c6t0d0 1.4T zpool01 disk
c6t1d0 1.4T zpool01 disk
c6t2d0 1.4T zpool01 disk

A better formatted text file with additional listing options can be viewed here: dskinfo-example.txt

Please let me know if you find dskinfo useful or have any problems, I will try to fix them when I have time.

Version 1.0 is available for download here: dskinfo

Update: Version 1.0 is now available, it contains bug fixes, warning if SVM is used or VxVM is installed. It can also output driver and instance names and tries harder to acquire the serial number from disks. A quiet options is also available to remove warnings.


Kevin said...

Great tool - thanks! I have a suggestion: On my system (SuperMicro SC847 - 36 drive bays connected to an LSI 9211-8i HBA, running OpenIndiana b148) The serial numbers don't show up in the 'list-full' output.

I can get them by running 'prtconf -v (device)' and looking for the 'inquiry-serial-no' line.

How about incorporating this method for determining drive serial numbers?

Henkis said...

Thank you. Good suggestion, I was focusing on getting the serial from FC disks, but this is something I will add as soon as I update the tool.

Henkis said...

Kevin, can you try the latest unreleased version in the repository and tell me if it does what you want?


Kevin said...

Sorry for the delayed response, I got sidetracked. I tried the version posted in your comment as well as the version from July 9th, but I'm still not getting serial numbers. I'll try looking at the code to see if I figure out why. I don't know python, so I'll be fumbling around a fair bit..

Henkis said...

Kevin, try the real link in the post, it has been updated with some other features also. If it does not work, send me an email with iostat -En and prtconf -v output.

dskinfo 1.0

Kevin said...

The latest version is showing serial numbers for my SAS-attached drives - Thanks! I also like the inclusion of the "instance" column, that'll be helpful as well...

Just in case you're curious, 'iostat -En' doesn't show drive serial numbers on this system - I'm not sure why...

Thanks again for a great tool - I'll be putting it on all my systems...

Denis Cheong said...

I have used this tool frequently since it was released (thanks!)

It would be really good to integrate the reporting from 'cfgadm -la' into this as well (to simplify hotswapping).