Solaris Tips

Solaris disk devices for Linux administrators

For a Linux sysadmin that used to static /dev, the layout of Solaris /dev directory can result a little strange. Particularly, disk devices can look weird, being divided in two subdirectories, /dev/dsk and /dev/rdsk and with long names like c2t1d0s4. I will try to explain them and which mistakes to avoid.

Under Construction

The Solaris /dev and /devices filesystems

Solaris uses two directories to store the device files. The first one, /dev is the one we will use normally to refer to the devices. Its contents are symbolic links to the second, /devices which holds character and block special files.

The layout of /dev is logical, that is, devices are grouped according to their type; while the layout of /devices is physical, in the means that the distribution is according to the connection between the different buses and devices.

I will give an example: the following two files reference the same device in a Netra t 1125:

/dev/dsk/c0t0d0s0
This means "the first (0) slice of the first (0) disk inside the device with target 0 in the first (0) disk controller". This is a logical device name.
/devices/pci@1f,4000/scsi@3/sd@0,0:a
This means "the first (a) slice inside the first (0) disk inside the device with SCSI ID 0 connected to the SCSI controller in slot 3 of the PCI Bus accessed at system bus address 1f, offset 4000". This is a physical device name.

Yes, the logical one is easier.

Block and raw access

Unfortunately, what I have just explained is only half the picture. The second main difference between Linux and Solaris disk naming convention is that, in Solaris, you have two device files for each slice. One of them will be located under the /dev/dsk directory and will be the block access one; the other will be located under /dev/rdsk and will be the raw access one.

Why two devices? Well, they are used in different situations. As you could have guessed, block access device files are block special files, while raw access special files are character special files:

# ls -l /dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0
lrwxrwxrwx   1 root     root          41 Jun 17  2002 /dev/dsk/c0t0d0s0 -> ../../devices/pci@1f,4000/scsi@3/sd@0,0:a
lrwxrwxrwx   1 root     root          45 Jun 17  2002 /dev/rdsk/c0t0d0s0 -> ../../devices/pci@1f,4000/scsi@3/sd@0,0:a,raw
# ls -l /devices/pci@1f,4000/scsi@3/sd@0,0:a /devices/pci@1f,4000/scsi@3/sd@0,0:a,raw
brw-r-----   1 root     sys       32,  0 Jun 17  2002 /devices/pci@1f,4000/scsi@3/sd@0,0:a
crw-r-----   1 root     sys       32,  0 Jun 17  2002 /devices/pci@1f,4000/scsi@3/sd@0,0:a,raw

Note that their major and minor device numbers match (32, 0 in this case).

In short, we will use the block device for mounting and umounting and the raw device for low level work, like fsck'ing. We can also use the block device for operations on the mounted filesystem. I am sorry, but I can not explain it better, so I will give a table of examples:

Raw device
/dev/rdsk/...
Block device
/dev/dsk/...
newfs mount
fsck umount
fmthard df
In fact, the second column is the full list of situations where you will use the block device. 1