Finding Your Hard Drives in OpenSolaris

If you’re coming from a Linux or Windows system, the first thing you will notice about Solaris systems is that the disk device labeling scheme is rather omgwtf?! when you first see it. Every disk is labeled something like c0t1d0p2. AND, not to mention, there are two places where these huge lists of strange disk IDs appear: /dev/dsk and /dev/rdsk. This can be confusing to someone who doesn’t know their way around a Solaris system.

Fresh and Raw
The first thing to get straight is the difference between disk (/dev/dsk) and raw disk (/dev/rdsk). Devices in the /dev/dsk directory are things that you can mount, unmount, format, and otherwise manipulate with commands. Of course, not all of these devices are used at any given time, which is where a certain program comes in, described below.

The /dev/rdsk directory contains the “raw disks,” the operating system’s abstraction of the raw data. This is used with certain programs that need to access the raw data directly, as we will see below.

Controller What?
The next item on the agenda is to figure out the somewhat funky naming scheme of disk devices in Solaris. On Linux systems, it’s relatively simple. It’s usually something like hda1 or sdb2. The “a” or “b” in the name refers to a physical hard drive, with each number referring to a partition on that hard drive. The “s” and the “h” just seem to be used interchangeably. Maybe it was changed in a kernel upgrade or something.

Solaris uses a significantly different naming scheme. As stated before, the names are things like c0t1d0p2. This website offers a good technical/historical explanation of what the names mean in full. I suggest reading it. Although if you’re using OpenSolaris, you should ignore the part about the “s.” Assuming you only have one hard drive, the main thing of importance to you is the partition number: the number following the “p” in the name. Here’s a summary of what that website says about the names, organized by letter:

C: This refers to the disk’s controller, the internal thing that’s controlling read and write access to the disk. Some disks will appear on different ones depending on what they are. For example, my two internal HDDs appear on c3, while my external USB HDD appears on c1.

T: This is the target. It’s related to the controller. On my system, my two internal hard drives are different targets on the c1 controller: c3t0 and c3t1.

D: This refers to the actual disk. Disk number. Since my targets each refer to an individual hard disk, I have c3t0d0 and c3t1d0.

P: This is the partition number and is what you should be most interested in if you’re running a multi-boot system on a single partitioned hard disk. p0 refers to the entire disk. This is a very important concept. p1 – p4 refers to the primary partitions, with p5 and higher referring to logical partitions.

How I Find Mah Disks?
This is where we introduce the wonderful program of prtpart. It was developed by the BeleniX distribution of OpenSolaris as a partition table viewer. To install this you will need to download the following files:


The first file contains the package file for prtpart while the other contains a package for support for a bunch of miscellaneous file systems that extend the capabilities of prtpart. Install them cding to the directory that you downloaded them to and then put in:

gunzip -c FSWpart.tar.gz | tar xvf -
pkgadd -d . FSWpart
gunzip -c FSWfsmisc.tar.gz | tar xvf -
pkgadd -d . FSWfsmisc

Now you should be ready to use the prtpart program. It must be run with root permissions, so use it with pfexec or start a root shell and execute it. Just executing prtpart without any arguments will produce output like:

Available disk devices:


Use /usr/bin/prtpart  to get partition details
Use /usr/bin/prtpart -help for usage help

This lists all the disk devices the OS currently knows about. Notice that it lists the rdsk devices. If you then execute “prtpart -ldevs”, it will give you the /dev/dsk devices corresponding to that raw disk. Example:

$ pfexec prtpart /dev/rdsk/c3t0d0p0 -ldevs

Fdisk information for device /dev/rdsk/c3t0d0p0

** NOTE **
/dev/dsk/c3t0d0p0      - Physical device referring to entire physical disk
/dev/dsk/c3t0d0p1 - p4 - Physical devices referring to the 4 primary partitions
/dev/dsk/c3t0d0p5 ...  - Virtual devices referring to logical partitions

Virtual device names can be used to access EXT2 and NTFS on logical partitions

/dev/dsk/c3t0d0p1	IFS: NTFS
/dev/dsk/c3t0d0p2	Linux native
/dev/dsk/c3t0d0p3	Linux native

If you’re just trying to find your hard drives, this is one way you can use to find them.