Managing Local Disk Devices

Introduction

 

Upon completion of this module, you should be able to:

Introduction

A disk device has physical components and logical components. The physical components include disk platters and read/write heads. The logical components include disk slices, cylinders, tracks, and sectors.

A disk is physically composed of a series of flat, magnetically coated platters that are stacked on a spindle. The spindle turns while the read/write heads move as a single unit radially, reading and writing data on the platters.

A disk platter is divided into sectors, tracks, and cylinders. The number of sectors per track varies with the radius of a track on the platter. The outermost tracks are larger and can hold more sectors than the inner tracks. Note – Disks present a fixed number of sectors per track to the Solaris OE even though, physically, the number of sectors per track varies by track location. Because a disk spins continuously and the read/write heads move as a single unit, the most efficient seeking occurs when the sectors to be read from or written to are located in a single cylinder.

Disk Slices == Partitions

Disks are logically divided into individual partitions known as disk slices. Disk slices are groupings of cylinders that are commonly used to organize data by function. For example, one slice can store critical system files and programs while another slice on the same disk can store user-created files.

Note – Grouping cylinders into slices is done to organize data, facilitate backups, and provide swap space.

By convention, Slice 2 represents the entire disk. Slice 2 maintains important data about the entire disk, such as the size of the actual disk and the total number of cylinders available for the storage of files and directories.

A starting cylinder and an ending cylinder define each slice. These cylinder boundaries determine the size of a slice.

Slice Name Function

Disk Slice Naming Convention

An eight-character string typically represents the full name of a slice. The string includes the controller number, the target number, the disk number, and the slice number.

The embedded SCSI configuration and the integrated device electronics (IDE) configuration represent the disk slice naming conventions across two different architectures. The disk number is always set to d0 with SCSI disks.

c#t#d#s#

Controller number
Disk number
Target number
Slice number

A slice name is an eight-character string:

Introducing Solaris OE Device Naming Conventions

In the Solaris OE, all devices are represented by three different types of names, depending on how the device is being referenced:

Note – The Berkeley Software Distribution (BSD) device names exist in the Solaris OE if the BSD compatibility packages are installed with the Solaris Developer, Entire Distribution, or Entire Distribution Plus the original equipment manufacturer (OEM) Solaris software group. The BSD device names, for example /dev/sd0a, are typically used for backward compatibility with old scripts.

Logical Device Names

Logical disk device names are symbolic links to the physical device names kept in the /devices directory. Logical device names are used primarily to refer to a device when you are entering commands on the command line. All logical device names are kept in the /dev directory. The logical device names contain the controller number, target number, disk number, and slice number.

Every disk device has an entry in both the /dev/dsk and /dev/rdsk directories for the block and character disk devices, respectively.

To display the entries in the /dev/dsk directory, perform the command: # ls /dev/dsk

c0t0d0s0 c0t0d0s4 c0t3d0s0 c0t3d0s4 c0t6d0s0 c0t6d0s4

c0t0d0s1 c0t0d0s5 c0t3d0s1 c0t3d0s5 c0t6d0s1 c0t6d0s5

c0t0d0s2 c0t0d0s6 c0t3d0s2 c0t3d0s6 c0t6d0s2 c0t6d0s6

c0t0d0s3 c0t0d0s7 c0t3d0s3 c0t3d0s7 c0t6d0s3 c0t6d0s7

Physical Device Names

Physical device names uniquely identify the physical location of the hardware devices on the system and are maintained in the /devices directory.

A physical device name contains the hardware information, represented as a series of node names, separated by slashes, that indicate the path to the device. To display a physical device name, perform the command:

# ls -l /dev/dsk/c0t0d0s0

lrwxrwxrwx 1 root root 46 Jun 16 19:07 /dev/dsk/c0t0d0s0 ->

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

Note – Various hardware platforms have different device trees. The top-most directory in the hierarchy is called the root node of the device tree. The bus nexus nodes and the leaf nodes below the root object have device drivers associated with them.

A device driver is the software that communicates with the device. This software must be available to the kernel so that the system can use the device.

During system initialization, the kernel identifies the physical location of a device. The kernel associates a node with an address, nodename@address, which is the physical device name.

For example, dad@0 is the direct access disk device at address 0.

Instance Names

Instance names are abbreviated names (aliases) assigned by the kernel for each device on the system. An instance name is a shortened name for the physical device name.

For SCSI disk devices they have the format sdn, for example sd0 is the first SCSI disk device.

for IDE devices they have format  dadn,where dad (direct access device) is the disk name and nis the number, such as dad0 for the first IDE drive.

Listing a System’s Devices

In the Solaris OE, there are several ways to list a system’s devices, including:

The /etc/path_to_inst File

For each device, the system records its physical name and instance name in the /etc/path_to_inst file. These names are used by the kernel to identify every possible device. This file is read only at boot time. The /etc/path_to_inst file is maintained by the kernel, and it is generally not necessary, nor is it advisable, for the system administrator to change this file.

The following example shows entries in the /etc/path_to_inst file. The text within the parentheses indicates what device is referred to by the entry and does not appear in the actual file.

# more /etc/path_to_inst

## Caution! This file contains critical kernel state

(output edited for clarity)

"/pci@1f,0" 0 "pcipsy" (PCI bus controller, "psycho" chip)

"/pci@1f,0/pci@1,1" 0 "simba" (PCI bus B)

"/pci@1f,0/pci@1,1/ebus@1" 0 "ebus" (extended bus)

"/pci@1f,0/pci@1,1/ebus@1/power@14,724000" 0 "power" (power management bus)

"/pci@1f,0/pci@1,1/ebus@1/fdthree@14,3023f0" 0 "fd" (floppy disk)

"/pci@1f,0/pci@1,1/ebus@1/SUNW,CS4231@14,200000" 0 "audiocs" (crystal semiconductor)

"/pci@1f,0/pci@1,1/ebus@1/su@14,3062f8" 1 "su" (mouse)

"/pci@1f,0/pci@1,1/ebus@1/se@14,400000" 0 "se" (serial ports A and B)

"/pci@1f,0/pci@1,1/ebus@1/su@14,3083f8" 0 "su" (keyboard)

"/pci@1f,0/pci@1,1/ebus@1/ecpp@14,3043bc" 0 "ecpp" (extended capability parallel

port)

"/pci@1f,0/pci@1,1/ide@3" 0 "uata" (ATA controller)

"/pci@1f,0/pci@1,1/ide@3/sd@2,0" 0 "sd" (CD-ROM)

"/pci@1f,0/pci@1,1/ide@3/dad@0,0" 0 "dad" (hard disk)

"/pci@1f,0/pci@1,1/network@1,1" 0 "hme" (Fast Ethernet)

"/pci@1f,0/pci@1,1/SUNW,m64B@2" 0 "m64" (color memory frame buffer)

"/pci@1f,0/pci@1" 1 "simba" (pci bus A controller)

"/options" 0 "options"

"/scsi_vhci" 0 "scsi_vhci"

"/pseudo" 0 "pseudo"

Here is more eleborate list from an old E450 system

# cat /etc/path_to_inst
#
#       Caution! This file contains critical kernel state
#
"/options" 0 "options"
"/pci@1f,4000" 0 "pcipsy"
"/pci@1f,4000/scsi@3" 0 "glm"
"/pci@1f,4000/scsi@3/sd@0,0" 15 "sd"
"/pci@1f,4000/scsi@3/sd@1,0" 16 "sd"
"/pci@1f,4000/scsi@3/sd@2,0" 17 "sd"
"/pci@1f,4000/scsi@3/sd@3,0" 18 "sd"
"/pci@1f,4000/scsi@3/sd@4,0" 19 "sd"
"/pci@1f,4000/scsi@3/sd@5,0" 20 "sd"
"/pci@1f,4000/scsi@3/sd@6,0" 21 "sd"
"/pci@1f,4000/scsi@3/sd@8,0" 22 "sd"
"/pci@1f,4000/scsi@3/sd@9,0" 23 "sd"
"/pci@1f,4000/scsi@3/sd@a,0" 24 "sd"
"/pci@1f,4000/scsi@3/sd@b,0" 25 "sd"
"/pci@1f,4000/scsi@3/sd@c,0" 26 "sd"
"/pci@1f,4000/scsi@3/sd@d,0" 27 "sd"
"/pci@1f,4000/scsi@3/sd@e,0" 28 "sd"
"/pci@1f,4000/scsi@3/sd@f,0" 29 "sd"
"/pci@1f,4000/scsi@3/st@0,0" 7 "st"
"/pci@1f,4000/scsi@3/st@1,0" 8 "st"
"/pci@1f,4000/scsi@3/st@2,0" 9 "st"
"/pci@1f,4000/scsi@3/st@3,0" 10 "st"
"/pci@1f,4000/scsi@3/st@4,0" 11 "st"
"/pci@1f,4000/scsi@3/st@5,0" 12 "st"
"/pci@1f,4000/scsi@3/st@6,0" 13 "st"
"/pci@1f,4000/scsi@3/ses@0,0" 16 "ses"
"/pci@1f,4000/scsi@3/ses@1,0" 17 "ses"
"/pci@1f,4000/scsi@3/ses@2,0" 18 "ses"
"/pci@1f,4000/scsi@3/ses@3,0" 19 "ses"
"/pci@1f,4000/scsi@3/ses@4,0" 20 "ses"
"/pci@1f,4000/scsi@3/ses@5,0" 21 "ses"
"/pci@1f,4000/scsi@3/ses@6,0" 22 "ses"
"/pci@1f,4000/scsi@3/ses@7,0" 23 "ses"
"/pci@1f,4000/scsi@3/ses@8,0" 24 "ses"
"/pci@1f,4000/scsi@3/ses@9,0" 25 "ses"
"/pci@1f,4000/scsi@3/ses@a,0" 26 "ses"
"/pci@1f,4000/scsi@3/ses@b,0" 27 "ses"
"/pci@1f,4000/scsi@3/ses@c,0" 28 "ses"
"/pci@1f,4000/scsi@3/ses@d,0" 29 "ses"
"/pci@1f,4000/scsi@3/ses@e,0" 30 "ses"
"/pci@1f,4000/scsi@3/ses@f,0" 31 "ses"
"/pci@1f,4000/scsi@2" 1 "glm"
"/pci@1f,4000/scsi@2/sd@0,0" 30 "sd"
"/pci@1f,4000/scsi@2/sd@1,0" 31 "sd"
"/pci@1f,4000/scsi@2/sd@2,0" 32 "sd"
"/pci@1f,4000/scsi@2/sd@3,0" 33 "sd"
"/pci@1f,4000/scsi@2/sd@4,0" 34 "sd"
"/pci@1f,4000/scsi@2/sd@5,0" 35 "sd"
"/pci@1f,4000/scsi@2/sd@6,0" 36 "sd"
"/pci@1f,4000/scsi@2/sd@8,0" 37 "sd"
"/pci@1f,4000/scsi@2/sd@9,0" 38 "sd"
"/pci@1f,4000/scsi@2/sd@a,0" 39 "sd"
"/pci@1f,4000/scsi@2/sd@b,0" 40 "sd"
"/pci@1f,4000/scsi@2/sd@c,0" 41 "sd"
"/pci@1f,4000/scsi@2/sd@d,0" 42 "sd"
"/pci@1f,4000/scsi@2/sd@e,0" 43 "sd"
"/pci@1f,4000/scsi@2/sd@f,0" 44 "sd"
"/pci@1f,4000/scsi@2/st@0,0" 14 "st"
"/pci@1f,4000/scsi@2/st@1,0" 15 "st"
"/pci@1f,4000/scsi@2/st@2,0" 16 "st"
"/pci@1f,4000/scsi@2/st@3,0" 17 "st"
"/pci@1f,4000/scsi@2/st@4,0" 18 "st"
"/pci@1f,4000/scsi@2/st@5,0" 19 "st"
"/pci@1f,4000/scsi@2/st@6,0" 20 "st"
"/pci@1f,4000/scsi@2/ses@0,0" 32 "ses"
"/pci@1f,4000/scsi@2/ses@1,0" 33 "ses"
"/pci@1f,4000/scsi@2/ses@2,0" 34 "ses"
"/pci@1f,4000/scsi@2/ses@3,0" 35 "ses"
"/pci@1f,4000/scsi@2/ses@4,0" 36 "ses"
"/pci@1f,4000/scsi@2/ses@5,0" 37 "ses"
"/pci@1f,4000/scsi@2/ses@6,0" 38 "ses"
"/pci@1f,4000/scsi@2/ses@7,0" 39 "ses"
"/pci@1f,4000/scsi@2/ses@8,0" 40 "ses"
"/pci@1f,4000/scsi@2/ses@9,0" 41 "ses"
"/pci@1f,4000/scsi@2/ses@a,0" 42 "ses"
"/pci@1f,4000/scsi@2/ses@b,0" 43 "ses"
"/pci@1f,4000/scsi@2/ses@c,0" 44 "ses"
"/pci@1f,4000/scsi@2/ses@d,0" 45 "ses"
"/pci@1f,4000/scsi@2/ses@e,0" 46 "ses"
"/pci@1f,4000/scsi@2/ses@f,0" 47 "ses"
"/pci@1f,4000/ebus@1" 0 "ebus"
"/pci@1f,4000/ebus@1/SUNW,envctrl@14,600000" 0 "envctrl"
"/pci@1f,4000/ebus@1/su@14,3083f8" 0 "su"
"/pci@1f,4000/ebus@1/su@14,3062f8" 1 "su"
"/pci@1f,4000/ebus@1/se@14,400000" 0 "se"
"/pci@1f,4000/ebus@1/fdthree@14,3023f0" 0 "fd"
"/pci@1f,4000/ebus@1/ecpp@14,3043bc" 0 "ecpp"
"/pci@1f,4000/ebus@1/power@14,724000" 0 "power"
"/pci@1f,4000/network@1,1" 0 "hme"
"/pci@1f,2000" 1 "pcipsy"
"/pci@4,4000" 2 "pcipsy"
"/pci@4,4000/TSI,gfxp@3" 0 "gfxp"
"/pci@4,2000" 3 "pcipsy"
"/pci@6,4000" 4 "pcipsy"
"/pci@6,4000/scsi@4" 2 "glm"
"/pci@6,4000/scsi@4/sd@0,0" 45 "sd"
"/pci@6,4000/scsi@4/sd@1,0" 46 "sd"
"/pci@6,4000/scsi@4/sd@2,0" 47 "sd"
"/pci@6,4000/scsi@4/sd@3,0" 48 "sd"
"/pci@6,4000/scsi@4/sd@4,0" 49 "sd"
"/pci@6,4000/scsi@4/sd@5,0" 50 "sd"
"/pci@6,4000/scsi@4/sd@6,0" 51 "sd"
"/pci@6,4000/scsi@4/sd@8,0" 52 "sd"
"/pci@6,4000/scsi@4/sd@9,0" 53 "sd"
"/pci@6,4000/scsi@4/sd@a,0" 54 "sd"
"/pci@6,4000/scsi@4/sd@b,0" 55 "sd"
"/pci@6,4000/scsi@4/sd@c,0" 56 "sd"
"/pci@6,4000/scsi@4/sd@d,0" 57 "sd"
"/pci@6,4000/scsi@4/sd@e,0" 58 "sd"
"/pci@6,4000/scsi@4/sd@f,0" 59 "sd"
"/pci@6,4000/scsi@4/st@0,0" 21 "st"
"/pci@6,4000/scsi@4/st@1,0" 22 "st"
"/pci@6,4000/scsi@4/st@2,0" 23 "st"
"/pci@6,4000/scsi@4/st@3,0" 24 "st"
"/pci@6,4000/scsi@4/st@4,0" 25 "st"
"/pci@6,4000/scsi@4/st@5,0" 26 "st"
"/pci@6,4000/scsi@4/st@6,0" 27 "st"
"/pci@6,4000/scsi@4/ses@0,0" 48 "ses"
"/pci@6,4000/scsi@4/ses@1,0" 49 "ses"
"/pci@6,4000/scsi@4/ses@2,0" 50 "ses"
"/pci@6,4000/scsi@4/ses@3,0" 51 "ses"
"/pci@6,4000/scsi@4/ses@4,0" 52 "ses"
"/pci@6,4000/scsi@4/ses@5,0" 53 "ses"
"/pci@6,4000/scsi@4/ses@6,0" 54 "ses"
"/pci@6,4000/scsi@4/ses@7,0" 55 "ses"
"/pci@6,4000/scsi@4/ses@8,0" 56 "ses"
"/pci@6,4000/scsi@4/ses@9,0" 57 "ses"
"/pci@6,4000/scsi@4/ses@a,0" 58 "ses"
"/pci@6,4000/scsi@4/ses@b,0" 59 "ses"
"/pci@6,4000/scsi@4/ses@c,0" 60 "ses"
"/pci@6,4000/scsi@4/ses@d,0" 61 "ses"
"/pci@6,4000/scsi@4/ses@e,0" 62 "ses"
"/pci@6,4000/scsi@4/ses@f,0" 63 "ses"
"/pci@6,4000/scsi@4,1" 3 "glm"
"/pci@6,4000/scsi@4,1/sd@0,0" 60 "sd"
"/pci@6,4000/scsi@4,1/sd@1,0" 61 "sd"
"/pci@6,4000/scsi@4,1/sd@2,0" 62 "sd"
"/pci@6,4000/scsi@4,1/sd@3,0" 63 "sd"
"/pci@6,4000/scsi@4,1/sd@4,0" 64 "sd"
"/pci@6,4000/scsi@4,1/sd@5,0" 65 "sd"
"/pci@6,4000/scsi@4,1/sd@6,0" 66 "sd"
"/pci@6,4000/scsi@4,1/sd@8,0" 67 "sd"
"/pci@6,4000/scsi@4,1/sd@9,0" 68 "sd"
"/pci@6,4000/scsi@4,1/sd@a,0" 69 "sd"
"/pci@6,4000/scsi@4,1/sd@b,0" 70 "sd"
"/pci@6,4000/scsi@4,1/sd@c,0" 71 "sd"
"/pci@6,4000/scsi@4,1/sd@d,0" 72 "sd"
"/pci@6,4000/scsi@4,1/sd@e,0" 73 "sd"
"/pci@6,4000/scsi@4,1/sd@f,0" 74 "sd"
"/pci@6,4000/scsi@4,1/st@0,0" 28 "st"
"/pci@6,4000/scsi@4,1/st@1,0" 29 "st"
"/pci@6,4000/scsi@4,1/st@2,0" 30 "st"
"/pci@6,4000/scsi@4,1/st@3,0" 31 "st"
"/pci@6,4000/scsi@4,1/st@4,0" 32 "st"
"/pci@6,4000/scsi@4,1/st@5,0" 33 "st"
"/pci@6,4000/scsi@4,1/st@6,0" 34 "st"
"/pci@6,4000/scsi@4,1/ses@0,0" 64 "ses"
"/pci@6,4000/scsi@4,1/ses@1,0" 65 "ses"
"/pci@6,4000/scsi@4,1/ses@2,0" 66 "ses"
"/pci@6,4000/scsi@4,1/ses@3,0" 67 "ses"
"/pci@6,4000/scsi@4,1/ses@4,0" 68 "ses"
"/pci@6,4000/scsi@4,1/ses@5,0" 69 "ses"
"/pci@6,4000/scsi@4,1/ses@6,0" 70 "ses"
"/pci@6,4000/scsi@4,1/ses@7,0" 71 "ses"
"/pci@6,4000/scsi@4,1/ses@8,0" 72 "ses"
"/pci@6,4000/scsi@4,1/ses@9,0" 73 "ses"
"/pci@6,4000/scsi@4,1/ses@a,0" 74 "ses"
"/pci@6,4000/scsi@4,1/ses@b,0" 75 "ses"
"/pci@6,4000/scsi@4,1/ses@c,0" 76 "ses"
"/pci@6,4000/scsi@4,1/ses@d,0" 77 "ses"
"/pci@6,4000/scsi@4,1/ses@e,0" 78 "ses"
"/pci@6,4000/scsi@4,1/ses@f,0" 79 "ses"
"/pci@6,4000/pci@3" 0 "pci_pci"
"/pci@6,4000/pci@3/SUNW,isptwo@4" 0 "isp"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@0,0" 0 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@1,0" 1 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@2,0" 2 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@3,0" 3 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@4,0" 4 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@5,0" 5 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@6,0" 6 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@8,0" 7 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@9,0" 8 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@a,0" 9 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@b,0" 10 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@c,0" 11 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@d,0" 12 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@e,0" 13 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/sd@f,0" 14 "sd"
"/pci@6,4000/pci@3/SUNW,isptwo@4/st@0,0" 0 "st"
"/pci@6,4000/pci@3/SUNW,isptwo@4/st@1,0" 1 "st"
"/pci@6,4000/pci@3/SUNW,isptwo@4/st@2,0" 2 "st"
"/pci@6,4000/pci@3/SUNW,isptwo@4/st@3,0" 3 "st"
"/pci@6,4000/pci@3/SUNW,isptwo@4/st@4,0" 4 "st"
"/pci@6,4000/pci@3/SUNW,isptwo@4/st@5,0" 5 "st"
"/pci@6,4000/pci@3/SUNW,isptwo@4/st@6,0" 6 "st"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@0,0" 0 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@1,0" 1 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@2,0" 2 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@3,0" 3 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@4,0" 4 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@5,0" 5 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@6,0" 6 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@7,0" 7 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@8,0" 8 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@9,0" 9 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@a,0" 10 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@b,0" 11 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@c,0" 12 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@d,0" 13 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@e,0" 14 "ses"
"/pci@6,4000/pci@3/SUNW,isptwo@4/ses@f,0" 15 "ses"
"/pci@6,4000/pci@3/SUNW,hme@0,1" 1 "hme"
"/pci@6,4000/pci@2" 1 "pci_pci"
"/pci@6,4000/pci@2/SUNW,qfe@0,1" 0 "qfe"
"/pci@6,4000/pci@2/SUNW,qfe@1,1" 1 "qfe"
"/pci@6,4000/pci@2/SUNW,qfe@2,1" 2 "qfe"
"/pci@6,4000/pci@2/SUNW,qfe@3,1" 3 "qfe"
"/pci@6,2000" 5 "pcipsy"
"/pseudo" 0 "pseudo"
"/scsi_vhci" 0 "scsi_vhci"

The device instance number, shown in the preceding example, appears to the left of the device instance name when recorded in this file.

Note – Different systems have different physical device paths. The preceding example shows an on-board peripheral component interconnect (PCI) bus configuration.

The following is a /etc/path_to_inst file from a system that has a different bus architecture. In this case, it is an example of a system that has an on-board Sun System bus (SBus).

# more /etc/path_to_inst

# Caution! This file contains critical kernel state

#"/sbus@1f,0" 0 "sbus"

"/sbus@1f,0/espdma@e,8400000" 0 "dma"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000" 0 "esp"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@3,0" 3 "sd"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@2,0" 2 "sd"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@1,0" 1 "sd"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@0,0" 0 "sd"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@6,0" 6 "sd"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@5,0" 5 "sd"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@4,0" 4 "sd"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/st@3,0" 3 "st"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/st@2,0" 2 "st"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/st@1,0" 1 "st"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/st@0,0" 0 "st"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/st@6,0" 6 "st"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/st@5,0" 5 "st"

"/sbus@1f,0/espdma@e,8400000/esp@e,8800000/st@4,0" 4 "st"

... < remaining lines removed > ...

The prtconf Command

Use the prtconf command to display the system’s configuration information, including the total amount of memory installed and the configuration of system peripherals, which is formatted as a device tree. The prtconf command lists all possible instances of devices, whether the device is attached or not attached to the system. To view a list of only attached devices on the system, perform the command:

# prtconf | grep -v not

Note – The grep -v not command is used to omit all lines containing the word "not" from the output (such as driver not attached).

The format Command

Use the format command to display both logical and physical device names for all currently available disks. To view the logical and physical devices for currently available disks, perform the command:

# format

Searching for disks...done

AVAILABLE DISK SELECTIONS:

0. c0t0d0 <SUN4.2G cyl 3880 alt 2 hd 16 sec 135>

/pci@1f,0/pci@1,1/ide@e/dad@0,0

1. c1t0d0 <SUN4.2G cyl 3880 alt 2 hd 16 sec 135>

/pci@if,0/pci@1/SUNW,isptwo@4/sd@3,0

Specify disk (enter its number):

Note – Press Control-D to exit the format command.

Reconfiguring Devices

The system recognizes a newly added peripheral device if:

Reconfiguring Devices

To reconfiger devices the command devfsadm -i is usually used. The following examples use the -i option:

To print the changes made by the devfsadm command to the /dev and /devices directories, perform the command:

# devfsadm -v

To invoke cleanup routines that remove unreferenced symbolic links for

devices, perform the command:

# devfsadm -C

Exercise: Configuring and Naming Devices (Level 3)

In this exercise, you complete the following tasks:

This exercise requires a system that is configured with an external disk or tape drive. During system boot, this external disk must remain powered off to avoid creating links and device files.

Task Summary

Complete the following tasks:

Task 1 – Identifying Device Files

Complete the following steps:

  1. Log in as the root user, and open a terminal window. Expand the window so that it occupies the entire screen area. Change to the /dev/dsk directory.
     
  2. List the files in this directory. Identify the files related to the boot disk of your system. Most systems use c0t0d0. Locate the item related to Slice 0 on this disk, and display a long listing of it.

    # ls

    # ls -l c0t0d0s0

    Which type of file did you just locate? The file type indicator is the first character on the left side of the long listing. Files in this directory are symbolic links. The letter l in the left-most column identifies a symbolic link.

    Record the full path name to which this file points.

    Systems that use PCI bus architectures list path names similar to the following:

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

  3. Highlight the path name you recorded in Step 2 by double-clicking the path name. Copy and paste this path name into a long listing command. If you are not using the CDE, you need to type the path name.

    # ls -l pathname

    Which type of file is this?

    Files in this directory are device files. The b character in the left-most column identifies a block-special device file.

    The command ls -lL c0t0d0s0 displays the same information but shows only the link file name, not the real device file name.

  4. Change to the /dev/rdsk directory. Display a long listing of the same file name you selected in Step 2.

    # cd /dev/rdsk

    # ls -l c0t0d0s0

    Which type of file is this?

    Files in this directory are symbolic links. The letter l in the left-most column identifies a symbolic link.

    Record the full path name to which this file points.

    Systems that use PCI bus architectures list path names similar to the following:

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

  5. Highlight the path name you recorded in Step 4. Use the Copy and Paste keys to copy and paste this path name into a long listing command. If you are not using CDE, you need to type in the path name.

    # ls -l pathname

    Which type of file is this?

    Files in this directory are device files. The c character in the left-most column identifies a character-special device file.

    The ls -lL c0t0d0s0 command displays the same information but shows only the link file name, not the real device file name.

  6. Change to the /etc directory. Display the contents of the

    path_to_inst file.

    # cd /etc

    # more path_to_inst

  7. Use the information from the previous steps to locate and record the

    entry for your boot disk. An Ultra 5 workstation, for example, would

    use c0t0d0 as its boot disk. This relates to the device file called

    dad@0,0 and is listed in the /etc/path_to_inst directory.

    Systems that use PCI bus architectures list path names similar to the

    following:

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

    The instance name is composed of the dad or sd tag and the number that precedes it in the /etc/path_to_inst file. What is the instance name for the device listed in this step?

    dad0, sd3, or sd0, depending on the system architecture.

Task 2 – Adding a New Disk or Tape Device

Complete the following steps:

1. In the /dev/dsk and /dev/rdsk directories, confirm that no files exist for your external disk or device, for example, /dev/dsk/c1t0d0s0 or /dev/rmt/0.

2. Shut down your system to run state 0.

# init 0

3. Power on the external disk or tape drive attached to your system.

4. Boot the system to its default run state.

ok boot

5. Log in as the root user, and open a terminal window. Run the devfsadm command with the -v option to create new links and device files for the new disk or tape drive. Observe the messages that the devfsadm command displays.

# devfsadm -v

6. Confirm that new links and device files exist in the /dev/dsk and /dev/rdsk directories for disks or /dev/rmt for tape drives.

Partitioning the Hard Disk

The format utility is a system administration tool used primarily to prepare hard disk drives for use in the Solaris OE. Although the format utility also performs a variety of disk-management activities, the main function of the format utility is to divide a disk into disk slices.

Note – You do not need to partition the disk before you install the Solaris OE.

Introducing the Fundamentals of Disk Partitioning

Only the root user can use the format utility. If a regular user runs the format utility, the following error message appears. To divide a disk into partitions(slices):

  1. Identify the correct disk.

  2. Plan the layout of the disk.

  3. Use the format utility to divide the disk into slices.

  4. Label (write partition to the disk) the disk with new slice information.

Disk slices are defined by an offset and a size in cylinders. The offset is the distance from Cylinder 0.  There are two common problems with the disk allocation:

partition> modify

Select partitioning base:

0. Current partition table (unnamed)

1. All Free Hog

Choose base (enter number) [0]? 0

Warning: Overlapping partition (1) in table.

Warning: Fix, or select a different partition table.

Caution – Do not change the size of disk slices that are currently in use.

Caution – When a disk with existing slices is repartitioned and relabeled, any existing data can become inaccessible. Copy existing data to backup media before the disk is repartitioned, and restore the data to the disk after the disk is relabeled and contains a new filesystem.

Introducing Disk Partition Tables

As the root user, when you use the format utility and select a disk to partition, a copy of the disk’s partition table is read from the label on the disk into memory and is displayed as the current disk partition table.

The format utility can also works with a file called /etc/format.dat, which is read when you invoke the format utility.

The /etc/format.dat file is a table of available disk types and a set of predefined partition tables that you can use to partition a disk quickly.

Introducing Disk Labels

The disk’s label is the area set aside for storing information about the disk’s controller, geometry, and slices. Another term used to describe a disk label is the volume table of contents (VTOC). The disk’s label or VTOC is stored on the first sector of the disk (MBR in DOS terms).

To label a disk means to write slice information onto the disk. If you fail to label a disk after defining slices, the slice information is lost. An important part of the disk label is the partition table, which identifies a disk’s slices, the slice boundaries in cylinders, and the total size of the slices.

Note – The terms disk slice and disk partition are interchangeable.

Using the format Command

The format utility is organized into two tiers of commands. When you type format on the command line, the first tier of commands appears. This set of commands allow you to, among other functions, select a disk, select a partition, save new disk and partition definitions, and write the label to the disk. The top tier of commands is denoted by the format> prompt.

The second tier of commands appears when you type partition from the format> prompt. This set of commands allow you to, among other functions, define the characteristics of the individual slices, print the existing partition table, and write the partition map and label to the disk.

Part The slice number. Valid slice numbers are 0 through 7. Tag A value that indicates how the slice is being used.

0 = unassigned

1 = boot

2 = root

3 = swap

4 = usr

5 = backup

6 = stand

8 = home

Sun StorEdge™ Volume Manager array tags:

14 = public (region)

15 = private (region)

Flag 00 wm = The disk slice is writable and mountable.

01 wu = The disk slice is writable and unmountable. This is the default state

of slices dedicated for swap areas.

10 rm = The disk slice is read-only and mountable.

11 ru = The disk slice is read-only and unmountable.

Cylinders The starting and ending cylinder number for the disk slice.

Size The slice size: Mbytes (MB), Gbytes (GB), blocks (b), or cylinders (c).

Blocks The total number of cylinders and the total number of sectors per slice.

Partitioning a Disk

Caution – Do not change the size of disk slices that are currently in use. The following steps demonstrate how to divide a disk into slices:

1. As the root user, type format at the prompt, and press Return.

# format

Searching for disks...done

AVAILABLE DISK SELECTIONS:

0. c0t0d0 <ST34321A cyl 8892 alt 2 hd 15 sec 63>

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

1. c1t0d0 <SUN1.3G cyl 1965 alt 2 hd 17 sec 80>

/pci@1f,0/pci@1/scsi@1/sd@0,0

Specify disk (enter its number):

The format utility searches for all attached disks that are powered on. For each disk it finds, the format utility displays the logical device name, Sun marketing name, physical parameters, and physical device name.

2. Choose the second disk by selecting the number located to the left of that disk’s logical device name. From the preceding display, the number chosen is 1. The format utility’s main menu appears.

Specify disk (enter its number): 1

selecting c1t0d0

[disk formatted]

FORMAT MENU:

disk - select a disk

type - select (define) a disk type

partition - select (define) a partition table

current - describe the current disk

format - format and analyze the disk

repair - repair a defective sector

label - write label to the disk

analyze - surface analysis

defect - defect list management

backup - search for backup labels

verify - read and display labels

save - save new disk/partition definitions

inquiry - show vendor, product and revision

volname - set 8-character volume name

!<cmd> - execute <cmd>, then return

quit

format>

The specific menu selections that you can use to view, change, or commit disk slices include the following:

3. Type partition at the format prompt. The Partition menu appears.

format> partition

PARTITION MENU:

0 - change ‘0’ partition

1 - change ‘1’ partition

2 - change ‘2’ partition

3 - change ‘3’ partition

4 - change ‘4’ partition

5 - change ‘5’ partition

6 - change ‘6’ partition

7 - change ‘7’ partition

select - select a predefined table

modify - modify a predefined partition table

name - name the current table

print - display the current table

label - write partition map and label to the disk

!<cmd> - execute <cmd>, then return

quit

partition Displays the Partition menu

label Writes the current partition definition to the disk

label

verify Reads and displays the disk label

quit Exits the format utility

The Partition menu enables you to perform the following functions:

4. Type print at the partition prompt to display the disk label that was copied to random access memory (RAM) when the format utility was invoked.

partition> print

Current partition table (unnamed):
Total disk cylinders available: 1965 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks

0 unassigned wm 0 0 (0/0/0) 0

1 unassigned wm 0 0 (0/0/0) 0

2 backup wu 0 - 1964 1.27GB (1965/0/0) 2672400

3 unassigned wm 0 0 (0/0/0) 0

4 unassigned wm 0 0 (0/0/0) 0

5 unassigned wm 0 0 (0/0/0) 0

6 unassigned wu 0 0 (0/0/0) 0

7 unassigned wm 0 0 (0/0/0) 0

The name of the partition table appears in parentheses in the first line of the table.

0–7 Specify the offset and size of up to eight slices select Choose a predefined partition table from the /etc/format.dat file modify Change the current partition table in memory name Provide a means to identify the partition table in the /etc/format.dat file print Display the current partition table in memory label Write the current partition table to the disk label !<cmd> Escape from the utility and execute a command from the shell The columns of the table have the following meanings:

5. Select Slice 0 (zero) by entering 0.

partition> 0

Part Tag Flag Cylinders Size Blocks

0 unassigned wm 0 0 (0/0/0) 0

6. When prompted for the ID tag, type a question mark (?), and press Return to list the available choices. You can change a tag by entering a new tag name.

Enter partition id tag[unassigned]: ?

Expecting one of the following: (abbreviations ok):

unassigned boot root swap

usr backup stand var

home alternates

Enter partition id tag[unassigned]:

7. Type the tag alternates, and press Return. Enter partition id tag[unassigned]: alternates

8. When prompted for the permission flags, type a question mark (?), and press Return to list the available choices. You can change a flag by entering the new flag name.

Enter partition permission flags[wm]: ?

Expecting one of the following: (abbreviations ok):

wm - read-write, mountable

wu - read-write, unmountable

rm - read-only, mountable

ru - read-only, unmountable

Enter partition permission flags[wm]:

Part The disk slice number

Tag The predefined, optional tag

Flag The predefined, optional flag

Cylinders The starting and ending cylinder number for the slice

Size The slice size in blocks (b), cylinders (c), Mbytes (MB),

or Gbytes (GB)

Blocks The total number of cylinders and the total number of

sectors per slice

9. Press Return to accept the default flag.

10. Press Return to accept the starting cylinder of 0 (zero).

11. Enter 400mb for the new partition size for Slice 0.

12. Type print, and press Return. The Partition table appears.

partition> print

Current partition table (unnamed):

Total disk cylinders available: 1965 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks

0 alternates wm 0 - 602 400.43MB (603/0/0) 820080

1 unassigned wm 0 0 (0/0/0) 0

2 backup wu 0 - 1964 1.27GB (1965/0/0) 2672400

3 unassigned wm 0 0 (0/0/0) 0

4 unassigned wm 0 0 (0/0/0) 0

5 unassigned wm 0 0 (0/0/0) 0

6 unassigned wu 0 0 (0/0/0) 0

7 unassigned wm 0 0 (0/0/0) 0

The current partition table shows the change to Slice 0. Now adjust the starting cylinder for Slice 1.

13. Select slice number 1 by typing 1. partition> 1

Part Tag Flag Cylinders Size Blocks

1 unassigned wm 0 0 (0/0/0) 0

14. Type the tag swap, and press Return.  Enter partition id tag[unassigned]: swap

15. Type wu at the permission flags selection, and press Return. Enter partition permission flags[wm]: wu

16. Enter the new starting cylinder for Slice 1. Enter new starting cyl[0]: 603

17. Enter the new partition size for Slice 1. Enter partition size[0b, 0c, 603e, 0.00mb, 0.00gb]: 60mb

18. Type print, and press Return.

partition> print

Current partition table (unnamed):

Total disk cylinders available: 1965 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks

0 alternates wm 0 - 602 400.43MB (603/0/0) 820080

1 swap wm 603 - 693 60.43MB (91/0/0) 123760

2 backup wu 0 - 1964 1.27GB (1965/0/0) 2672400

3 unassigned wm 0 0 (0/0/0) 0

4 unassigned wm 0 0 (0/0/0) 0

5 unassigned wm 0 0 (0/0/0) 0

6 unassigned wu 0 0 (0/0/0) 0

7 unassigned wm 0 0 (0/0/0) 0

The current partition table shows the change to Slice 1. The new starting cylinder for Slice 1 is one greater than the ending cylinder for Slice 0. Now adjust the starting cylinder for Slice 7.

19. Type 7 to select Slice 7.

partition> 7

Part Tag Flag Cylinders Size Blocks

7 unassigned wm 0 0 (0/0/0) 0

20. Type the tag home, and press Return. Enter partition id tag[unassigned]: home

21. Press Return to select the default flag. Enter partition permission flags[wm]: <return>

22. Type the new starting cylinder for Slice 7. Enter new starting cyl[0]: 694

23. Type the new partition size for Slice 7 by typing a dollar ($) sign.

Enter partition size[0b, 0c, 694e, 0.00mb, 0.00gb]: $

partition>

Note – Enter a dollar ($) sign as a value for the last partition size to automatically assign the remaining space on the disk to this slice.

Partitioning the Hard Disk

Managing Local Disk Devices 2-43

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

24. Type print to display the partition table.

partition> print

Current partition table (unnamed):

Total disk cylinders available: 1965 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks

0 alternates wm 0 - 602 400.43MB (603/0/0) 820080

1 swap wm 603 - 693 60.43MB (91/0/0) 123760

2 backup wu 0 - 1964 1.27GB (1965/0/0) 2672400

3 unassigned wm 0 0 (0/0/0) 0

4 unassigned wm 0 0 (0/0/0) 0

5 unassigned wm 0 0 (0/0/0) 0

6 unassigned wu 0 0 (0/0/0) 0

7 home wm 694 - 1964 844.02MB (1271/0/0) 1728560

Add up the cylinders in the Blocks column for Slice 0, Slice 1, and

Slice 7. The number should equal the total number of cylinders

contained in Slice 2.

25. After checking the partition table to ensure that there are no errors,

label the disk by typing label.

partition> label

Ready to label disk, continue? y

partition>

Saving a Partition Table to the /etc/format.dat File

Use this optional procedure to add the newly created partition table to the

/etc/format.dat file. You can save customized partition tables to the

/etc/format.dat file and use them to quickly partition other disks of the

same type on the system.

Note – Remember that, by default, the system saves the new partition

information to the ./format.dat file.You must enter the full path of the

/etc/format.dat file to update the proper file.

Partitioning the Hard Disk

2-44 Intermediate System Administration for the Solaris™ 9 Operating Environment

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

To save a customized partition table, display the Partition menu and

perform the following steps:

1. Type name to enter a unique name for the current partition table.

Frequently, the disk manufacturer’s name is used.

partition> name

Enter table name (remember quotes): SUN1.3G

Note – Quotes are only required if the partition table name is more than

one word, for example, "SUN1.3G Generic."

2. Exit the Partition menu.

partition> quit

3. Type save to save the new partition table information, and enter the

full path name for the /etc/format.dat file.

format> save

Saving new partition definition

Enter file name["./format.dat"]: /etc/format.dat

Using the Customized Partition Table

To retrieve a customized partition table, display the format menu and

perform the following steps:

1. Type partition.

format> partition

2. Type select to display a list of customized partition tables, and

choose the desired table by entering its assigned number.

partition> select

0. SUN1.3G

1. original

2. SUN4.2

Specify table (enter its number)[3]: 0

3. Label the disk with the selected partition table.

partition> label

Ready to label disk, continue? yes

Partitioning the Hard Disk

Managing Local Disk Devices 2-45

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

4. Exit the Partition menu.

partition> quit

5. Read the new disk label.

format> verify

Primary label contents:

Volume name = < >

ascii name = <SUN1.3G cyl 1965 alt 2 hd 17 sec 80>

pcyl = 3500

ncyl = 1965

acyl = 2

nhead = 17

nsect = 80

Part Tag Flag Cylinders Size Blocks

0 alternates wm 0 - 602 400.43MB (603/0/0) 820080

1 swap wm 603 - 693 60.43MB (91/0/0) 123760

2 backup wu 0 - 1964 1.27GB (1965/0/0) 2672400

3 unassigned wm 0 0 (0/0/0) 0

4 unassigned wm 0 0 (0/0/0) 0

5 unassigned wm 0 0 (0/0/0) 0

6 unassigned wu 0 0 (0/0/0) 0

7 home wm 694 - 1964 844.02MB (1271/0/0) 1728560

6. Exit the format utility.

format> quit

Managing Disk Labels

2-46 Intermediate System Administration for the Solaris™ 9 Operating Environment

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

Managing Disk Labels

Every disk in the Solaris OE has a label set aside for storing information

about the disk’s controller, geometry, and slices.

Viewing the Disk VTOC

You can use two methods for locating and viewing a disk’s label or

VTOC:

l Use the verify command from the format utility

l Invoke the prtvtoc command from the command line

Reading a Disk’s VTOC Using the verifyCommand

The verify command enables you to view a disk’s VTOC from within the

format utility. To read a disk’s VTOC, perform the following steps:

1. At the format prompt, enter the verify command, and press

Return.

format> verify

Primary label contents:

Volume name = < >

ascii name = <SUN1.3G cyl 1965 alt 2 hd 17 sec 80>

pcyl = 3500

ncyl = 1965

acyl = 2

nhead = 17

nsect = 80

Part Tag Flag Cylinders Size Blocks

0 root wm 0 - 602 400.43MB (603/0/0) 820080

1 swap wm 603 - 693 60.43MB (91/0/0) 123760

2 backup wm 0 - 1964 1.27GB (1965/0/0) 2672400

3 unassigned wm 0 0 (0/0/0) 0

4 unassigned wm 0 0 (0/0/0) 0

5 unassigned wm 0 0 (0/0/0) 0

6 unassigned wm 0 0 (0/0/0) 0

7 home wm 694 - 1964 844.02MB (1271/0/0) 1728560

2. Type quit or q, and press Return to exit the format menu.

Managing Disk Labels

Managing Local Disk Devices 2-47

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

Reading a Disk’s VTOC Using the prtvtocCommand

The prtvtoc command enables you to view a disk’s VTOC from the

command line. To view a disk’s VTOC from the command line, type the

following:

# prtvtoc /dev/rdsk/c1t0d0s2

* /dev/rdsk/c1t0d0s2 partition map

*

* Dimensions:

* 512 bytes/sector

* 80 sectors/track

* 17 tracks/cylinder

* 1360 sectors/cylinder

* 3500 cylinders

* 1965 accessible cylinders

*

* Flags:

* 1: unmountable

* 10: read-only

*

* First Sector Last

* Partition Tag Flags Sector Count Sector Mount Directory

0 2 00 0 820080 820079

1 3 00 820080 123760 943839

2 5 00 0 2672400 2672399

7 8 00 943840 1728560 2672399

The disk label information includes the following fields:

Dimensions Describes the logical dimensions of the disk.

Flags Describes the flags that are listed in the partition

table.

Partition A slice number. It is described further in

Table 2-2 on page 2-36.

Tag A value used to indicate how the slice is being

used. It is described further in Table 2-2 on page

2-36.

Flags The 00 flag is read/write, mountable; 01 is

read/write, unmountable; and 10 is read only.

These are described further in Table 2-2 on page

2-36.

First Sector Defines the first sector of the slice.

Managing Disk Labels

2-48 Intermediate System Administration for the Solaris™ 9 Operating Environment

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

Relabeling a Disk

Save a disk’s VTOC to a file by using the prtvtoc command. This allows

you to relabel the disk by using the fmthard command if one of the

following situations occurs:

l The VTOC on the disk has been destroyed.

l You accidentally changed the partition information on the disk and

did not save a backup label in the /etc/format.dat file.

To save a disk’s VTOC to a file, perform the command:

# prtvtoc /dev/rdsk/c1t0d0s2 > /vtoc/c1t0d0

The fmthard Command

To relabel a disk, you can save the output of the prtvtoc command into a

file on another disk and use it as the datafile argument to the fmthard

command.

fmthard -s datafile /dev/rdsk/c #t #d #s2

Caution – The fmthard command cannot write a disk label on an

unlabeled disk. Use the format utility for this purpose.

If the need to relabel a disk arises and the VTOC was previously saved to

a file, the following options are available:

l Run format, select the disk, and label it with the default partition

table.

l Use the fmthard command to write the desired label information,

previously saved to a datafileback to the disk.

# fmthard -s /vtoc/c1t0d0 /dev/rdsk/c1t0d0s2

Sector Count Defines the total number of sectors in the slice.

Last Sector Defines the last sector number in the slice.

Mount Directory If the field is empty, the slice is currently not

mounted and no entry exists in the /etc/vfstab

file.

Performing the Exercises

Managing Local Disk Devices 2-49

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

Performing the Exercises

You have the option to complete any one of three versions of a lab. To

decide which to choose, consult the following descriptions of the levels:

l Level 1 – This version of the lab provides the least amount of

guidance. Each bulleted paragraph provides a task description, but

you must determine your own way of accomplishing each task.

l Level 2 – This version of the lab is more difficult. Although each step

describes what you should do, you must determine which

commands (and options) to input.

l Level 3 – This version of the lab is the easiest to accomplish because

each step provides exactly what you should input to the system. This

level also includes the task solutions for all three levels.

Exercise: Working With Disks and Partitions (Level 1)

2-50 Intermediate System Administration for the Solaris™ 9 Operating Environment

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

Exercise:Working With Disks and Partitions (Level 1)

In this exercise, you complete the following tasks:

l Use the format utility to partition a disk

l Use the prtvtoc and fmthard commands to repair a corrupted

disk label

Preparation

This exercise requires a system configured with an external disk.

Tasks

Complete the following tasks:

l Use the format command to list the disks currently attached to your

system. Use the prtvtoc command to identify a disk that does not

currently hold any mounted file systems. Examine the information

that the prtvtoc command displays. Record the name of a disk that

has no mount directory listed.

(Steps 1–4 in the Level 2 lab)

l Use the format command to divide the unused disk into four slices

of equal size. Use Slices 0, 1, 3, and 4. Set all other slices to size 0.

Manually change the size of Slice 0 so that it ends 25 Mbytes into the

space assigned to Slice 1.

(Steps 4–11 in the Level 2 lab)

Exercise: Working With Disks and Partitions (Level 1)

Managing Local Disk Devices 2-51

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

l Attempt to correct the overlap by using the Modify menu. Record

the message that appears. Then correct the overlap by using the all

free hog option. Verify your disk label with the prtvtoc command.

(Steps 12–18 in the Level 2 lab)

l Create a directory called /vtoc. Run the prtvtoc command to read

the label of the disk you modified, and save its output in a file in the

/vtoc directory. Use the dd command from Step 21 of the Level 2 lab

to destroy the label on the same disk. Attempt to read the disk label

by using the prtvtoc command, and record the result. If required,

use the format command to write a default label to the disk. Use the

fmthard command to restore the label by using the output from the

prtvtoc command that you saved earlier. Verify that the new label

exists.

(Steps 19–25 in the Level 2 lab)

Exercise: Working With Disks and Partitions (Level 2)

2-52 Intermediate System Administration for the Solaris™ 9 Operating Environment

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

Exercise:Working With Disks and Partitions (Level 2)

In this exercise, you complete the following tasks:

l Use the format utility to partition a disk

l Use the prtvtoc and fmthard commands to repair a corrupted disk

label

Preparation

This exercise requires a system configured with an external disk.

Task Summary

In this exercise, you accomplish the following:

l Use the format command to list the disks currently attached to your

system. Use the prtvtoc command to identify a disk that does not

currently hold any mounted file systems. Examine the Mount

Directory field in the information that the prtvtoc command

displays. Record the name of a disk that has no mount directory

listed.

l Use the format command to divide the unused disk into four slices

of equal size. Use Slices 0, 1, 3, and 4. Set all other slices to size 0.

Manually change the size of Slice 0 so that it ends 25 Mbytes into the

space assigned to Slice 1.

l Attempt to correct the overlap by using Option 0 from the Modify

menu. Record the message that appears. Then correct the overlap by

using the all free hog option. Verify your disk label with the

prtvtoc command.

l Create a directory called /vtoc. Run the prtvtoc command to read

the label of the disk you modified, and save its output in a file in the

/vtoc directory. Use the dd command to destroy the label on the

same disk. Attempt to read the disk label by using the prtvtoc

command, and record the result. If required, use the format

command to write a default label to the disk. Use the fmthard

command to restore the label by using the output from the prtvtoc

command that you saved earlier. Verify that the new label exists.

Exercise: Working With Disks and Partitions (Level 2)

Managing Local Disk Devices 2-53

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

Tasks

Complete the following steps:

1. Log in as the root user, and open a terminal window. Run the

format command.

2. Record the list of disks presented by the format command, for example, c0t0d0 and c1t0d0.

Press the Control-D keys to exit the format utility.

3. Use the prtvtoc command to list the VTOC for each of the disks

that you found in the previous step. Examine the Mount Directory

field in the information that the prtvtoc command displays. Record

the name of a disk that has no mount directory listed. This is an

unused disk.

4. Run the format command again. Select the unused disk from the list

of disks presented.

5. Display the Partition menu. Print the current partition table, and

record the number of megabytes assigned to Slice 2. For example, if

the disk reports 4 Gbytes, record 4000 Mbytes.

Mbytes:

6. Divide the number of megabytes by 4. Use the result as the number

of megabytes to assign as disk space to four slices. Round down to

the next whole megabyte if the result includes a fraction.

Mbytes/4:

7. Display the Partition menu again. Select Slice 0. Accept the defaults

for tags and flags. Start this first slice on Cylinder 0. Enter the

resulting number of megabytes from the previous step for the slice

size. Print the partition table again to verify the change.

8. Set the sizes of Slices 1, 3, and 4 so that they are the same as Slice 0.

Begin each successive slice on the cylinder that follows the ending

cylinder of the previous slice.

9. Set Slices 5, 6, and 7 to start at Cylinder 0, and assign them 0 Mbytes.

10. Print the partition table. Is there any overlap of ending and

beginning cylinders for any of the slices listed? Proceed to the

following steps to introduce this problem.

Exercise: Working With Disks and Partitions (Level 2)

2-54 Intermediate System Administration for the Solaris™ 9 Operating Environment

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

11. Add 25 to the number Mbytes/4 value listed in Step 6.

(Mbytes/4) + 25:

Change Slice 0 so that it uses the new size listed above.

The partition table should now indicate that Slice 0 ends after Slice 1

begins.

12. Use the modify command from the Partition menu to attempt to fix

this problem. Select Item 0 to modify the current partition table.

Which warnings appear?

13. Modify the partition table. Select Item 1 to use the All Free Hog

method.

14. The partition table appears. Observe the Cylinders and Size columns,

and notice that they are all zero.

15. Respond to the prompts to continue the process. Select Slice 4 as the

All Free Hog slice. Use the size listed in Step 6 for Slices 0, 1, and

3. Set the other slices to Size 0.

At the end of this process, you should have three slices of equal size,

where Slice 4 takes up any extra room if it exists.

16. Name the partition table SA239Partition. Quit the Partition

menu.

17. Label and save your new partition table to the /etc/format.dat

file. Carefully read the message that is displayed by the format

utility, and enter the correct file name. Quit the format utility when

you have finished. Use the cat command to view the contents of the

/etc/format.dat file. Note that your information is appended to

the file.

18. Verify your new partition table with the prtvtoc command.

19. Create a directory called /vtoc.

20. Use the prtvtoc command to print the partition table that you just

created, and save its output to a file in the /vtoc directory. Name the

file so that it corresponds with the disk you are examining. Use the

cat command to verify that valid information exists in the file that

you create.

Exercise: Working With Disks and Partitions (Level 2)

Managing Local Disk Devices 2-55

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

21. Use the following dd command to destroy the disk label. Be certain

to specify the correct disk device name for the of= argument. Enter

all other arguments exactly as listed.

# dd if=/dev/zero of=/dev/rdsk/c1t0d0s2 bs=512 count=1

1+0 records in

1+0 records out

#

22. Attempt to read the label from the same disk by using the prtvtoc

command.

What happens?

23. If the prtvtoc command reported an "Unable to read Disk

geometry" message, use the format command to place a default

label on the disk for which you destroyed the label earlier.

If the prtvtoc command reports that only Slice 2 exists on the disk,

skip to the next step. Otherwise, perform the commands:

# format

Searching for disks...done

c1t0d0: configured with capacity of 4.00GB

AVAILABLE DISK SELECTIONS:

0. c0t0d0 <Seagate Medalist 34342A cyl 8892 alt 2 hd 15 sec 63>

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

1. c1t0d0 <SUN4.2G cyl 3880 alt 2 hd 16 sec 135>

/pci@1f,0/pci@1/pci@2/SUNW,isptwo@4/sd@3,0

Specify disk (enter its number): 1

selecting c1t0d0

[disk formatted]

Disk not labeled. Label it now? Y

(format menu)

format> q

#

# prtvtoc /dev/rdsk/c1t0d0s2

Exercise: Working With Disks and Partitions (Level 2)

2-56 Intermediate System Administration for the Solaris™ 9 Operating Environment

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

24. Use the fmthard command to write to the disk the label information

you saved earlier.

25. Attempt to read the label from the same disk.

Was this successful?

Exercise: Working With Disks and Partitions (Level 3)

Managing Local Disk Devices 2-57

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

Exercise:Working With Disks and Partitions (Level 3)

In this exercise, you complete the following tasks:

l Use the format utility to partition a disk

l Us the prtvtoc and fmthard commands to repair a corrupted disk

label

Preparation

This exercise requires a system configured with an external disk.

Task Summary

In this exercise, you accomplish the following:

l Use the format command to list the disks currently attached to your

system. Use the prtvtoc command to identify a disk that does not

currently hold any mounted file systems. Examine the Mount

Directory field in the information that the prtvtoc command

displays. Record the name of a disk that has no mount directory

listed.

l Use the format command to divide the unused disk into four slices

of equal size. Use Slices 0, 1, 3, and 4. Set all other slices to size 0.

Manually change the size of Slice 0 so that it ends 25 Mbytes into the

space assigned to Slice 1.

l Attempt to correct the overlap using Option 0 from the Modify

menu. Record the message that appears. Then correct the overlap by

using the all free hog partition. Verify your disk label with the

prtvtoc command.

l Create a directory called /vtoc. Run the prtvtoc command to read

the label of the disk you modified, and save its output in a file in the

/vtoc directory. Use the dd command to destroy the label on the

same disk. Attempt to read the disk label by using the prtvtoc

command, and record the result. If required, use the format

command to write a default label to the disk. Use the fmthard

command to restore the label by using the output from the prtvtoc

command that you saved earlier. Verify that the new label exists.

Tasks

Complete the following steps:

1. Log in as the root user, and open a terminal window. Run the

format command.

# format

2. Record the list of disks presented by the format command, for

example, c0t0d0 and c1t0d0.

Press Control-D to exit the format utility.

format> Control-D

#

3. Use the prtvtoc command to list the VTOC for each of the disks

you found in the previous step. Examine the Mount Directory field

in the information that the prtvtoc command displays. Record the

name of a disk that has no mount directory listed. This will be an

unused disk.

# prtvtoc /dev/rdsk/c1t0d0s2

Unused disk: Your entry will depend on your system.

4. Run the format command again. Select the unused disk from the list

of disks presented.

# format

(list of disks)

Specify disk (enter its number): x

5. Display the Partition menu. Print the current partition table, and

record the number of megabytes assigned to Slice 2. For example, if

the disk reports 4 Gbytes, record 4000 Mbytes.

format> part

partition> print

Mbytes: Your entry will depend on your system.

6. Divide the number of megabytes by 4. Use the result as the number

of megabytes to assign as disk space to four slices. Round down to

the next whole megabyte if the result includes a fraction.

Mbytes/4: Your entry will depend on your system.

Exercise: Working With Disks and Partitions (Level 3)

Managing Local Disk Devices 2-59

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

7. Display the Partition menu again. Select Slice 0. Accept the defaults

for tags and flags. Start this first slice on Cylinder 0. Enter the

resulting number of megabytes from the previous step for the slice

size. Print the partition table again to verify the change.

partition> 0

Part Tag Flag Cylinders Size Blocks

0 unassigned wm 0 0 (0/0/0) 0

Enter partition id tag[unassigned]: <Return>

Enter partition permission flags[wm]: <Return>

Enter new starting cyl[0]: 0

Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 300mb

partition> print

(partition table)

8. Set the sizes of Slices 1, 3, and 4 so that they are the same as Slice 0.

Begin each successive slice on the cylinder that follows the ending

cylinder of the previous slice.

partition> ?

(Partition menu)

partition> 1

Part Tag Flag Cylinders Size Blocks

1 unassigned wm 0 0 (0/0/0) 0

Enter partition id tag[unassigned]: <Return>

Enter partition permission flags[wm]: <Return>

Enter new starting cyl[0]: 452

Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 300mb

partition> print

(partition table)

9. Set Slices 5, 6, and 7 to start at Cylinder 0, and assign them 0 Mbytes.

partition> ?

(Partition menu)

partition> 5

Part Tag Flag Cylinders Size Blocks

5 unassigned wm 0 0 (0/0/0) 0

Enter partition id tag[unassigned]: <Return>

Enter partition permission flags[wm]: <Return>

Enter new starting cyl[0]: 0

Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 0m

partition>

10. Print the partition table. Is there any overlap of ending and

beginning cylinders for any of the slices listed? Proceed to the

following steps to introduce this problem.

partition> print

Exercise: Working With Disks and Partitions (Level 3)

2-60 Intermediate System Administration for the Solaris™ 9 Operating Environment

Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services, Revision A

11. Add 25 to the number Mbytes/4 value listed in Step 6.

(Mbytes/4) + 25: Your entry will depend on your system.

Change Slice 0 so that it uses the new size listed previously.

partition> ?

(Partition menu)

partition> 0

Part Tag Flag Cylinders Size Blocks

0 unassigned wm 0 - 451 300.16MB (452/0/0) 614720

Enter partition id tag[unassigned]: <Return>

Enter partition permission flags[wm]: <Return>

Enter new starting cyl[0]: 0

Enter partition size[614720b, 452c, 451e, 300.16mb, 0.29gb]: 325mb

partition> print

(partition table)

The partition table should now indicate that Slice 0 ends after Slice 1

begins.

12. Use the modify command from the Partition menu to attempt to fix

this problem. Select Item 0 to modify the current partition table.

partition> ?

(Partition menu)

partition> modify

Select partitioning base:

0. Current partition table (unnamed)

1. All Free Hog

Choose base (enter number) [0]? 0

Which warnings display?

Warning: Overlapping partition (1) in table.

Warning: Fix, or select a different partition table.

13. Modify the partition table. Select Item 1 to use the All Free Hog

option.

partition> modify

Select partitioning base:

0. Current partition table (original)

1. All Free Hog

Choose base (enter number) [0]? 1

14. The partition table appears. Observe the Cylinders and Size columns, and notice that they are all zero; for example:

Part Tag Flag Cylinders Size Blocks

0 root wm 0 0 (0/0/0) 0

1 swap wu 0 0 (0/0/0) 0

2 backup wu 0 - 1964 1.27GB (1965/0/0) 2672400

3 unassigned wm 0 0 (0/0/0) 0

4 unassigned wm 0 0 (0/0/0) 0

5 unassigned wm 0 0 (0/0/0) 0

6 usr wm 0 0 (0/0/0) 0

7 unassigned wm 0 0 (0/0/0) 0

15. Respond to the prompts to continue the process. Select Slice 4 as the All Free Hog partition. Use the size listed in Step 6 for Slices 0, 1, and 3. Set the other slices