Have you ever been analysed the SAR(System activity reporter) reports on Solaris server for the disk performance issues ? If you would have done that , you might noticed that all the disks & LUN’s will be shown as “ssdXXX” names instead of cXtXdXs2. If you run “iostat” command without “n” option, you can see that LUNS/Disks will be displaying with sdd names. In this article ,we will see that how to map the controller wise disk names to ssd names on oracle Solaris operating system.
Let’s see that how to map the controller wise disk names to SSD names manually.
1. List the disk device file from the device tree.
root@UA-GBL:~# ls -lrt /dev/rdsk/c0t60060E80166D5F9800016D5F000000B3d0s2 lrwxrwxrwx 1 root root 67 Sep 25 2014 /dev/rdsk/c0t60060E80166D5F9800016D5F000000B3d0s2 -> ../../devices/scsi_vhci/ssd@g60060e80166d5f0008716d5f000000b3:c,raw root@UA-GBL:~#
Here we just need the unique id of the disk . (which start after “@” and ends before “:” ) . Let me use some filters to trim the above output.
root@UA-GBL:~# ls -lrt /dev/rdsk/c0t60060E80166D5F9800016D5F000000B3d0s2 |awk ' { print $11 }' |cut -d "@" -f2 |cut -d ":" -f1 g60060e80166d5f0008716d5f000000b3 root@whts29732:~#
2. Use the “grep” function to find the sdd number from the /etc/path_to_inst file.
root@UA-GBL:~# grep g60060e80166d5f0008716d5f000000b3 /etc/path_to_inst "/scsi_vhci/ssd@g60060e80166d5f0008716d5f000000b3" 285 "ssd" root@UA-GBL:~#
If you just would like to know the ssd number for the disk , use awk command to filter it .
root@UA-GBL:~# grep g60060e80166d5f0008716d5f000000b3 /etc/path_to_inst |awk ' { print $2 } ' 285 root@UA-GBL:~#
From the above analysis , we have found that LUN “c0t60060E80166D5F9800016D5F000000B3d0s2” SSD number is 285. The same way you can map for the all the LUNS.
Let’s see how we can map all the disks/LUN’s SSD number using below script.
Script:
#!/bin/bash echo "===============================" echo "= UnixArena - LUN Name to SSD =" echo "===============================" echo /usr/bin/iostat -E | grep Soft | awk '{ print $1}' > /tmp/a; iostat -En | grep Soft|awk '{ print $1 }' > /tmp/b; paste /tmp/a /tmp/b /usr/bin/rm /tmp/a /tmp/b echo echo "===========" echo "Thank you" echo "==========="
1. Copy the above mentioned script as “lun_to_ssd.sh” and make it as executable.
# chmod +x lun_to_ssd.sh
2. Execute the script like below. Hope you will like the script output.
root@UA-GBL:/export/home/UnixArena# ./lun_to_ssd.sh =============================== = UnixArena - LUN Name to SSD = =============================== sd0 c3t5000CCA01637C7ADd0 sd1 c9t5000CCA01637C795d0 sd5 c2t0d0 ssd97 c0t60060E80177D5F0000016D5F00000063d0 ssd98 c0t60060E80177D5F0000016D5F00000062d0 ssd99 c0t60060E80177D5F0000016D5F00000061d0 ssd100 c0t60060E80177D5F0000016D5F00000060d0 ssd101 c0t60060E80177D5F0000016D5F0000005Fd0 ssd102 c0t60060E80177D5F0000016D5F0000005Ed0 ssd103 c0t60060E80177D5F0000016D5F0000005Dd0 ssd104 c0t60060E80177D5F0000016D5F0000005Cd0 ssd105 c0t60060E80177D5F0000016D5F0000005Bd0 ssd106 c0t60060E80177D5F0000016D5F0000005Ad0 ssd107 c0t60060E80177D5F0000016D5F00000065d0 ssd108 c0t60060E80177D5F0000016D5F00000038d0 ssd109 c0t60060E80177D5F0000016D5F00000037d0 ssd110 c0t60060E80177D5F0000016D5F00000036d0 ssd111 c0t60060E80177D5F0000016D5F00000035d0 ssd112 c0t60060E80177D5F0000016D5F00000034d0 ssd113 c0t60060E80177D5F0000016D5F00000033d0 ssd114 c0t60060E80177D5F0000016D5F00000032d0 ssd115 c0t60060E80177D5F0000016D5F00000031d0 =========== Thank you =========== root@UA-GBL:/export/home/UnixArena#
The above script will shows only for the DISK/LUN’s which are shown in format command. If you would like to know the ssd number for multi-paths , use the below perl script which i found in internet.
#!/usr/bin/env perl use strict; my @path_to_inst = qx#cat /etc/path_to_inst#; map {s/"//g} @path_to_inst; my ($device, $path, @instances); for my $line (qx#ls -l /dev/dsk/*s2#) { ($device, $path) = (split(/\s+/, $line))[-3, -1]; $path =~ s#.*/devices(.*):c#$1#; @instances = map {join("", (split /\s+/)[-1, -2])} grep {/$path/} @path_to_inst; #*emphasized text* for my $instance (@instances) { print "$device $instance\n"; } }
1. Copy the above script as “lun_to_ssd_perl.sh” and make it executable.
2. Execute the script. You will get the output like below.
root@UA-GBL:/export/home/lrangasa# ./lun_to_ssd_perl.sh /dev/dsk/c0t5000CCA01637C794d0s2 sd6 /dev/dsk/c0t5000CCA01637C7ACd0s2 sd4 /dev/dsk/c0t60060E80166D5F0008716D5F00000019d0s2 ssd139 /dev/dsk/c0t60060E80166D5F0000016D5F0000001Ad0s2 ssd138 /dev/dsk/c0t60060E80166D5F0000016D5F0000001Bd0s2 ssd137 /dev/dsk/c0t60060E80166D5F0000016D5F0000001Cd0s2 ssd136 /dev/dsk/c0t60060E80166D5F0000016D5F0000001Dd0s2 ssd135 /dev/dsk/c0t60060E80166D5F0000016D5F000002DEd0s2 ssd331 /dev/dsk/c0t60060E80166D5F0000016D5F000002DFd0s2 ssd330 /dev/dsk/c2t0d0s2 sd5 /dev/dsk/c3t5000CCA01637C7ADd0s2 sd0 /dev/dsk/c5t50060E80166D5F56d79s2 ssd154 /dev/dsk/c5t50060E80166D5F56d7s2 ssd24 /dev/dsk/c5t50060E80166D5F56d80s2 ssd153 /dev/dsk/c5t50060E80166D5F56d81s2 ssd152 /dev/dsk/c5t50060E80166D5F56d82s2 ssd151 /dev/dsk/c5t50060E80166D5F56d96s2 ssd243 /dev/dsk/c5t50060E80166D5F56d97s2 ssd242 /dev/dsk/c5t50060E80166D5F56d98s2 ssd241 /dev/dsk/c5t50060E80166D5F56d99s2 ssd240 /dev/dsk/c5t50060E80166D5F56d9s2 ssd22 /dev/dsk/c7t50060E80166D5F46d0s2 ssd63 /dev/dsk/c7t50060E80166D5F46d100s2 ssd253 /dev/dsk/c7t50060E80166D5F46d101s2 ssd252 /dev/dsk/c7t50060E80166D5F46d102s2 ssd251 /dev/dsk/c7t50060E80166D5F46d103s2 ssd250 /dev/dsk/c7t50060E80166D5F46d104s2 ssd249 /dev/dsk/c7t50060E80166D5F46d105s2 ssd248 /dev/dsk/c7t50060E80166D5F46d106s2 ssd247 /dev/dsk/c7t50060E80166D5F46d107s2 ssd246 /dev/dsk/c7t50060E80166D5F46d10s2 ssd53 /dev/dsk/c7t50060E80166D5F46d11s2 ssd52 /dev/dsk/c7t50060E80166D5F46d94s2 ssd259 /dev/dsk/c7t50060E80166D5F46d95s2 ssd258 /dev/dsk/c7t50060E80166D5F46d96s2 ssd257 /dev/dsk/c7t50060E80166D5F46d97s2 ssd256 /dev/dsk/c7t50060E80166D5F46d98s2 ssd255 /dev/dsk/c7t50060E80166D5F46d99s2 ssd254 /dev/dsk/c7t50060E80166D5F46d9s2 ssd54 /dev/dsk/c9t5000CCA01637C795d0s2 sd1 root@UA-GBL:/export/home/lrangasa#
The above output matches the each device file with it’s sdd names. If you have multiple paths to the LUN’s, the above script can provide the ssd numbers for each path with associated disks.
Hope this article is informative to you .
Murat Gokmen says
Hi,
Thaks for the script. Your script combines the outputs of two different commands.
I wonder if the outputs of the two commands matches correctly.
Inspired by your method, I preferred to use a single command to get a similar result like:
iostat -Ei | nawk ‘/Soft/ {ssd=$1}; /Device Id/ {print ssd,toupper(substr($NF,10))}’
Best regards,
Murat Gokmen