Talking to Solaris About Partitions

 

Solaris partitions are virtual disks and can be used for file systems or for applications. Each partition may occupy an entire disk or some part of the disk and are defined with the format utility. Commands used to access and manage partitions and file systems require the administrator to specify the name of the partition. Solaris names partitions three ways: physical device names, logical device names and instance names.

 

Physical device names for disk partitions may be seen in the outputs of the commands

 

#ls –l /dev/dsk

#ls –l /dev/rdsk

 

Or in the PROM:

 

ok devalias

 

Each physical device name is a list of drivers and locations of chips, separated by forward slashes.  Physical device names are represented as files under the directory /devices. The drivers are for bus translator chips at the specified locations. These are chips that take output from one bus and pass it to another bus, in a format that the bus recognizes.

 

For a workstation, the list always starts with the driver for the translator chip that translates between the CPU and the main onboard bus. The exact configuration of the physical device name thereafter depends on the design of the system, but each listing after the CPU-to-main-bus translator chip represents, in order, the drivers for the translator chips through which data flows on its way from the CPU to the device, and the locations of those chips. For example, on the Sun Ultra 5 and 10 workstations, the physical device name for the first partition on the primary master internal IDE drive looks like this:

 

/pci@1f,0/pci@1,1/ide@3/dad@0,0:a

 

This physical device name consists of the drivers for:

  1. The “psycho chip” – the CPU to PCI bus translator chip (pci@1f,0). Every device on an Ultra 5 or 10 has a physical device name that starts at the psycho chip. The driver that works with this chip is pci. The location is 1f,0.
  2. The chip that translates between the PCI bus and the IDE bus (pci@1,1). This chip also uses the pci driver, but the chip is located at 1,1.
  3. The chip on the disk that translates between the IDE bus and the disk, since Ultra 5s and 10s use internal IDE disks (ide@3). This chip uses the ide driver and its location is 3.
  4. The chip on the disk that passes data to the disk (dad@0,0). This is a DAD disk that uses the driver dad.
  5. The notation :a does not represent a driver. It merely specifies the first partition on the disk. The physical device name for the second partition (partition 1) would end in  b but otherwise would look the same, since the path between the CPU and that partition passes through the same translator chips.

 

These names are complex and hard to type out and to read. In addition, there is absolutely no reason for the administrator to acknowledge the existence of each and every chip through which data flows to the disk from the CPU when typing disk names. It always goes through the CPU-main bus translator chip. Why type it in every time?

 

Logical device names provide an easy and sensible way for the administrator to address a partition. There are two logical device names for every partition on every physical disk: a block device name and a character (or raw) device name. Like everything in Unix, they are files – in fact they are symbolic links to the physical device names, because the computer doesn’t use them or care about them. The computer only knows and uses physical device names. Logical device names exist solely for the use of the system administrator.

 

Logical device names for block devices are held in the directory /dev/dsk. The block logical device name corresponding to the physical device name above is /dev/dsk/c0t0d0s0. Logical device names for character devices are held in the directory /dev/rdsk. The character logical device name corresponding to the physical device name above is /dev/rdsk/c0t0d0s0. Aside from the one character difference in path name, the names are identical and they refer to the same physical devices.

 

The distinction between block and character devices is not really important. They both address the same device and the same drivers. The use of the block device indicates that data should be passed to the disk 8 Kbytes (1 data block) at a time (synchronously). The use of the character device indicates that data should be passed to the disk 512 bits (1 disk block) at a time (asynchronously). Asynchronous disk access is faster because the data is immediately written and followed with more data. Synchronous disk access requires the transfer of a block of data, then a wait for confirmation that the data has been written. As a result, developers generally prefer to write programs that use the character device.

 

Some applications and commands employ the block device and others the character device. There is no easy way to figure out which command uses which type of data transfer. The choice of the device type used by an application is entirely up to the developer of the application. There are no commands where you get to make that choice. If you don’t know which type of device name a command uses, you have two choices: 1) read the man page 2) knowing that developers prefer the character device, try the character device. If that doesn’t work, try the block device. Many commands will take the logical device name for either the block or character device as input. There is no command where you can cause problems by using the wrong device type as input.

 

The logical device name is in one of two formats:

 

Block: /dev/dsk/cX1tX2dX3sX4

Character: /dev/rdsk/ cX1tX2dX3sX4

 

Where Xn represents various different numerical values.

 

There will be a matched set of block and character device names for every possible partition for every disk on the system, even if that partition doesn’t exist and is not being used. These names are set up when the system recognizes the existence of the disk. This happens when you perform a reconfiguration boot:

 

ok boot –r

 

Or when you perform a reconfiguration reboot:

 

# touch /reconfigure

# init 6

 

Or when you force a running system to recognize that hardware has been added:

 

# devfsadm

 

If you have a disk on your system but there are no logical devices names for the disk, something is wrong – the disk is broken or improperly cabled, or the system has not been told to recognize it.

 

The final portion of the logical device name: cX1tX2dX3sX4  represents the last three to four drivers in the physical device name – those that drive the controller and the disks themselves.

 

The controller number

 

In the logical device name cX1 represents the controller, which is the chip that translates between an internal bus and a device. On the physical device listed above, the controller chip for the onboard IDE bus is named ide@3. Solaris always configures that controller as controller 0.  Therefore the logical device name for any disk attached to this controller begins with c0. If I add a scsi card to that workstation the controller on that disk will be written c1. If I add another scsi card, the controller will be written c2, and so on.

 

The controller numbers for workstations are assigned as cards are added to the system. The onboard controller on the motherboard is always c0, but it is not always obvious which scsi card is associated with a particular controller number. If you are given a configured system without any information about the controller numbers, you will have to attach one disk in sequence to each of the scsi cards and run

 

ok probe-scsi-all

 

at the PROM prompt to see which controller is attached to your disk. Once you become familiar with the hardware on your system, you will also be able to figure this out without so much work using output from the “format” command. No matter how you figure out what controller number is assigned to which card, put a label on the slot so you know!

 

On a server, slots for I/O cards are assigned controller numbers and these never vary. On the newer Sun servers, that number is etched right on the server case, so to figure out the controller number of a disk attached to a server, just look at the slot for the I/O card that disk is attached to. For older servers, you will need to look up the field manual for that server on sunsolve.sun.com. Once you’ve done that, label the slots!

 

The target number

 

In the logical device name tX2 represents the SCSI target number. This corresponds to a chip on the disk that controls the disk. In the physical device name above, that chip is dad@0,0. The first 0 is the actual target number assigned to the device. For external drives, it is very easy to figure out which target corresponds to which disk on a particular controller: you look in the little window on the back of the drive enclosure. You can set this target yourself.

 

For internal drives on a workstation, the target number is set with jumpers on the drive enclosure. The only time you will need to make a correspondence between a physical drive and a target number is if a drive fails and you have to replace it. You know the disk c0t1 failed…but which of your two internal disks is c0t1?

 

You will have to check with the disk manufacturer for the pinning assignments for jumpers to figure this out. Most manufacturers have this information on their websites. Again, once you know, label the replacement disk!

 

The disk number or “logical unit number (LUN)”

 

In the logical device name, dX3 represents the chip that directs data to a particular disk within the SCSI target enclosure. This value is irrelevant to many disks. An disk enclosure, whether internal or external, will have only one disk, and there will be no chip to direct traffic in the case. For internal disks of all kinds and for external enclosures, the disk number is meaningless: the value is always d0.

 

Arrays, which are very large boxes containing multiple disks, will normally have many disks, and each disk will be assigned a disk or "Logical Unit" number (LUN) by the array, based on its location in the box. These assignments do not change, and usually the array will show disk numbers on its display, so if disk c1t1d23 fails, you should have no problem figuring out from the array’s display which that is.Usually the array will already have identified the failure and you will see a flashing light or some other indicator on the disk that there is a problem.

 

The slice number

 

In the logical device name sX4 represents the partition or “slice” you want to format, fsck, newfs or otherwise manage. The slices are assigned by the administrator using the format command, and you will chose the value for the slice depending on administrative needs and on the choices you made when you formatted the disk.

 

 

Examples:

 

A few logical device names and what they might be:

 

/dev/dsk/c0t0d0s0 – Slice 0 on the first internal disk of a workstation. Usually assigned the root partition.

 

/dev/dsk/c1t3d0s4 – Slice 4 on an external disk attached to the only scsi card on your system. Using a pen, you assigned it the SCSI target 3. You want to use slice 4.

 

/dev/rdsk/c5t1d14s0 – A disk in an array attached to a server. The array is attached to an I/O card in the slot assigned to controller 5, and the array has been given SCSI target 1. The disk is in slot 14 of the array. You are using slice 0.

 

An example of how to use a logical device name:

 

To get the VTOC on a disk:

 

# prtvtoc /dev/rdsk/c0t0d0s0

 

To mount a file system:

 

#mount /dev/dsk/c1t0d0s0  /software

 

To run the file system checker command (fsck)

 

#fsck /dev/rdsk/c0t1d0s3

 

 

Instance names

 

We have seen that the only usable device names on the system are the physical device names. Those represent physical reality. Logical device names are conveniences, but without the link to the physical device, they have no meaning. The Solaris software is written to work on any system, including those not yet designed or built, so its developers must be able to refer to devices without any knowledge of the physical device names leading to those devices, and somehow connect these references to the actual devices.

 

In the Solaris software, devices are referred to using the name of their driver and the instance of the device. For example, the first instance of a scsi disk is sd0. The second instance is sd1. The first instance of a scsi tape is st0. The third instance of an IDE disk is dad2. These are instance names, and the instance numbers are not related to the values in the logical device name in any way. The target number on the first scsi disk may be 3, but it will still be sd0.

 

The instance names, like the logical device names, have no real meaning. Only the physical device names have meaning. Instance names are connected to the physical device names in a file called /etc/path_to_inst, which is configured along with the logical device names when the operating system is installed, when a reconfiguration reboot is performed or when the command devfsadm is run. This file contains both instance names and the physical device names associated with the instances.

 

 

 

 

 

 

Hosted by www.Geocities.ws

1