Map sd?/sdd? names to Solaris disk names?

Some commands in Solaris (such as iostat) report disk related information using disk names such as sd0 or sdd2. Is there a consistent way to map these names back to the standard /dev/dsk/c?t?d?s? disk names in Solaris?

Edit: As Amit points out, iostat -n produces device names such as eg c0t0d0s0 instead of sd0. But how do I found out that sd0 actually is c0t0d0s0? I'm looking for something that produces a list like this:

sd0=/dev/dsk/c0t0d0s0
...
sdd2=/dev/dsk/c1t0d0s4
...
Maybe I could run iostat twice (with and without -n) and then join up the results and hope that the number of lines and device sorting produced by iostat is identical between the two runs?

Following Amit's idea to answer my own question, this is what I have come up with:

iostat -x|tail -n +3|awk '{print $1}'>/tmp/f0.txt.$$
iostat -nx|tail -n +3|awk '{print "/dev/dsk/"$11}'>/tmp/f1.txt.$$
paste -d= /tmp/f[01].txt.$$
rm /tmp/f[01].txt.$$

Running this on a Solaris 10 server gives the following output:

sd0=/dev/dsk/c0t0d0
sd1=/dev/dsk/c0t1d0
sd4=/dev/dsk/c0t4d0
sd6=/dev/dsk/c0t6d0
sd15=/dev/dsk/c1t0d0
sd16=/dev/dsk/c1t1d0
sd21=/dev/dsk/c1t6d0
ssd0=/dev/dsk/c2t1d0
ssd1=/dev/dsk/c3t5d0
ssd3=/dev/dsk/c3t6d0
ssd4=/dev/dsk/c3t22d0
ssd5=/dev/dsk/c3t20d0
ssd7=/dev/dsk/c3t21d0
ssd8=/dev/dsk/c3t2d0
ssd18=/dev/dsk/c3t3d0
ssd19=/dev/dsk/c3t4d0
ssd28=/dev/dsk/c3t0d0
ssd29=/dev/dsk/c3t18d0
ssd30=/dev/dsk/c3t17d0
ssd32=/dev/dsk/c3t16d0
ssd33=/dev/dsk/c3t19d0
ssd34=/dev/dsk/c3t1d0

The solution is not very elegant (it's not a one-liner), but it seems to work.

Solaris 10 System Administration Exam Prep: Exam CX-310-202 Part II, The latest name-lookup service (directory service) to be added to Solaris. live the general device class, such as disk, tape, or serial line. makefile NIS maps. 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.

One liner version of the accepted answer (I only have 1 reputation so I can't post a comment):

  paste -d= <(iostat -x | awk '{print $1}') <(iostat -xn | awk '{print $NF}') | tail -n +3

Inside Solaris 9, For example, you can determine the mapping of an instance name to a with an SBus and SCSI disk drives, here's similar output for a SCSI disk drive: sd3 at esp0: rearranged when new devices are added, even if new devices are added to  Map sd?/sdd? names to Solaris disk names? 1. Using File Event notification in Solaris 9 , 10 and 11 when a directory/file is changed. 2. Coding pmap in Solaris. 2.

Try using the '-n' switch. For eg. 'iostat -n'

How to convert controller disk naming to SSD on Solaris ?, 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  Hi, This question is for SF on Solaris, I'd like to know how to map the drive name as given by vxdisk list to the actual drive in cxtxdx format? For instance, my output of vxdisk list is: bash-3.2# vxdisk list DEVICE TYPE DISK GROUP STATUS c0t0d0s2 auto:ZFS

As pointed out in other answers, you can map the device name back to the instance name via the device path and information contained in /etc/path_to_inst. Here is a Perl script that will accomplish the task:

#!/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";
    }
}

Map sd?/sdd? names to Solaris disk names? - solaris, Edit: As Amit points out, iostat -n produces device names such as eg c0t0d0s0 we are allowing for adding and deleting devices, which will skew the instance  x86-based Oracle Solaris systems have a different disk-naming convention, but before describing the logical device name for a disk on an x86-based system, it’s worth pointing out a fundamental difference between disk slicing on a SPARC system and disk slicing on an x86-based system.

I found the following in the Solaris Transistion Guide:

"Instance Names

Instance names refer to the nth device in the system (for example, sd20).

Instance names are occasionally reported in driver error messages. You can determine the binding of an instance name to a physical name by looking at dmesg(1M) output, as in the following example.

sd9 at esp2: target 1 lun 1
sd9 is /sbus@1,f8000000/esp@0,800000/sd@1,0
     <SUN0424 cyl 1151 alt 2 hd 9 sec 80>

Once the instance name has been assigned to a device, it remains bound to that device.

Instance numbers are encoded in a device's minor number. To keep instance numbers consistent across reboots, the system records them in the /etc/path_to_inst file. This file is read only at boot time, and is currently updated by the add_drv(1M) and drvconf"

So based upon that, I wrote the following script:

for device in /dev/dsk/*s2

do

dpath="$(ls -l $device | nawk '{print $11}')"

dpath="${dpath#*devices/}"

dpath="${dpath%:*}"

iname="$(nawk -v dpath=$dpath '{

    if ($0 ~ dpath) {

        gsub("\"", "", $3)

        print $3 $2

    }

}' /etc/path_to_inst)"

echo "$(basename ${device}) = ${iname}"

done

By reading the information directly out of the path_to_inst file, we are allowing for adding and deleting devices, which will skew the instance numbers if you simply count the instances in the /devices directory tree.

How to Add a Group Mapping Rule (Solaris CIFS Administration , Determine the group names that you want to map. Determine the domain and name of the Windows group that you want to map to a Solaris group. The Windows  With an argument that looks like 'cNtNdNsN', 'rmt/N' or 'host:/nfs/share' it will print the corresponding sd, sdd, mt or nfs instance name. If the standard input is a pipe, it will convert any instance names to the corresponding device names, preserving column alignment as far as possible.

Map sd names to Solaris disk names, Solaris (SmartOS, Openindiana) disk names. paste -d= <(iostat -x | awk 'NR>2{​print $1}') <(iostat -nx | awk 'NR>2{print "/dev/dsk/"$11}') # fmadm add-alias chassis-name.chassis-serial alias-id. You can set a naming standard so that the alias name maps to a specific disk's chassis name and chassis serial number. The following example maps the disk with chassis name SUN-Storage-J4200 and serial number 0905QAJ00E to an alias.

What is this dm-0 device?, You can map them using: # sudo lvdisplay|awk '/LV Name/{n=$3} /Block device/{​d=$3; sub(".*:","dm-",d); print d,n;}' dm-0 /dev/SysVolGroup/LogVolRoot dm-1  With the pool name, you can display the file system info: # zfs list -r cpool. NAME USED AVAIL REFER MOUNTPOINT. cpool 431K 274G 32K /cpool. cpool/cindyshadow 312K 274G 312K /cpool/cindyshadow This means I have one file system called cindyshadow in the pool cpool.

Oracle Configuring and Managing ASM Disks, parameter. You can then add disk groups to your ASM instance. Platform Name, Default ASM_DISKSTRING value Solaris, /dev/rdsk/*. where device-name is the raw disk device in the patch that you want to examine. Note - To use this command, you must have the appropriate administrative rights. Refer to Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.2 .

Comments
  • The above script is missing a ending " for the last awk. It should be ($9,1,index($9,"s0")-1)}'
  • You can collapse this all into one (bash) command and avoid any temporary files: paste -d= <(iostat -x | tail -n +3 | awk '{print $1}') <(iostat -nx | tail -n +3 | awk '{print "/dev/dsk/"$11}')
  • @Tekne Nice one! You can be even briefer; you don't need tail because you have awk: paste -d= <(iostat -x | awk 'NR>2{print $1}') <(iostat -nx | awk 'NR>2{print "/dev/dsk/"$11}')
  • i get a tail [+/-[n][l][r|f]] [file] if i run any of the iostat commands with tail
  • Use | tail +3 without the -n option with Solaris standard tail command. The -n option will work with GNU tail or the POSIX /usr/xpg4/bin/tail.
  • you can also add -p to get down to the disk partition/slice.