Pages

Monday, September 10, 2012

Solaris disks: ssdX vs cXtXdX

When you work with disks in Solaris then you normally have to deal with disk names like cXtXdX and so on. But sometimes you will see something like ssdX, eg:

# dmesg
...
Sep 08 12:15:56 sol01 scsi: [ID 112529 kern.warning] WARNING: /pci@8,600000/SUNW,qlc@2/fp@0,0/ssd@w2100001862806e43,0 (ssd1):
Sep 08 12:15:56 sol01        offline
...


Obviously the disk ssd1 seems to have an error. Just take a look at iostat -En:

# iostat -En
...
c1t2d0           Soft Errors: 0 Hard Errors: 192 Transport Errors: 0
Vendor: SEAGATE  Product: ST314655FSUN146G Revision: 0691 Serial No:
Size: 0.00GB <0 bytes>
Media Error: 4 Device Not Ready: 187 No Device: 1 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
...


Yup, an disk error. But how to make sure that ssd1 is really c1t2d0? Well then, use iostat again:

# iostat -x
                 extended device statistics
device    r/s    w/s   kr/s   kw/s wait actv  svc_t  %w  %b
...
ssd1      0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
...


The command iostat -x shows the instance name of a disk, while iostat -xn will display the disks in descriptive format:

# iostat -xn
                    extended device statistics
    r/s    w/s   kr/s   kw/s wait actv wsvc_t asvc_t  %w  %b device
...
    0.0    0.0    0.0    0.0  0.0  0.0    0.0    0.0   0   0 c1t2d0
...


The only thing you need to do is to bring both outputs in to one output which can easily be done with paste:

# paste -d "\t" <(iostat -x | tail +3 | awk '{print $1}') <(iostat -xn | tail +3 | awk '{print $NF}')
..
ssd1    c1t2d0
...


I found the original command on http://stackoverflow.com/questions/555427/map-sd-sdd-names-to-solaris-disk-names but it did not work for me so i deceided to copy it and fix it so that it does work for me again.