Sunday, July 11, 2010

What on earth is ssd with .t in sar -d output?

We've been working with a customer on performance tuning some Solaris 10 systems using MPXIO, and I got an email on Friday asking about the device names.

If you don't know, sar -d uses the driver name and instance number for its output. So instead of the /dev/dsk/cXtYdX syntax we all know and love, you get something like ssd123. There are plenty of scripts out there that will translate between the two (see the bottom of this post for yet another) but in this case the customer sent me some output and asked what the ",{letter}" and ".t" at the end of the ssd name meant.

The ",{letter}" syntax is familiar - basically the letter correspond to slices on the disks, with a=0, b=1, and so on. I wasn't familiar with the ".t" syntax though and spent an embarrassing amount of time trying to figure out what was going on.

Turns out that sar limits device names to 8 characters (see here line 662 for a reference). If you dig a little deeper, though, using "kstat -p" you'll see that the full device name is actually ssdX.tY.fpZ. Turns out that the "t" stands for target - which seems obvious in retrospect.

Oh and before there's a dogpile, yes this seems custom built for dTrace - but the sar data is handy.

Here's a script to translate ssd #'s to cXtYdZ #'s if you've got path_to_inst and ls-l_dev_rdsk.out (which are conveniently available in an explorer):

#/usr/bin/perl
#
# sd_to_ctd.pl - takes the path_to_inst and a long directory
# listing on /dev/rdsk and maps sd (and ssd)
# #'s to their corresponding cXtYdZ numbers
#
#
# Expects both the path_to_inst (named path_to_inst)
# and the directory listing (named ls-l_dev_rdsk.out)
# to be in the current directory
#
#
open INPUT, qq{./path_to_inst} || \
die qq{Can't open path_to_inst!\n};
while (<INPUT>) {
chomp;
if (!($_ =~ /^#/)) {
$_=~s/"//g;
($devicepath, $instance, $driver) = split;
$deviceinstance=qq{$driver$instance};
$driver_to_path{$devicepath}=$deviceinstance;
}
}
close INPUT;
#
open INPUT, qq{./ls-l_dev_rdsk.out} || \
die qq{Can't open ls-l_dev_rdsk.out!\n};
while (<INPUT>) {
chomp;
if (($_ =~ /^lrwxrwxrwx/) && ($_ =~ /:a,raw/)){
($perms, $size, $owner, $group, $linkcount, $month, \
$day, $year, $ctd, $arrow, $devicepath)=split;
$devicepath=~s/^\.\.\/\.\.\/devices//g;
@dev=split(/:/, $devicepath);
pop @dev;
$devicepath=join('/',@dev);
$ctd_to_path{$devicepath}=$ctd;
}
}
#
foreach $devicepath (sort {$first=$driver_to_path{$a};
$second=$driver_to_path{$b};
$first=~s/[a-z]//g;
$second=~s/[a-z]//g;
return $first <=> $second;} \
(keys(%ctd_to_path))) {
print qq{$driver_to_path{$devicepath}, \
$ctd_to_path{$devicepath}, $devicepath\n};
}


Share/Save/Bookmark

1 comment: