System Administration Guide: Basic Administration

Chapter 31 Managing Disks (Overview)

This chapter provides overview information about Solaris disk slices and introduces the format utility.

This is a list of overview information in this chapter.

For instructions on how to add a disk to your system, see Chapter 33, SPARC: Adding a Disk (Tasks) or Chapter 34, x86: Adding a Disk (Tasks).

What's New in Disk Management?

This section describes new disk management features in the Solaris 9 release.

Solaris Volume Manager and Soft Partitioning

The previously unbundled Solstice DiskSuiteTM product is now part of the Solaris 9 release and is called Solaris Volume Manager. Solaris Volume Manager's new partitioning feature, soft partitioning, enables more than eight partitions per disk.

For general information about Solaris Volume Manager, see “Storage Management Concepts” in Solaris Volume Manager Administration Guide. For information on soft partitioning, see “Soft Partitions (Overview)” in Solaris Volume Manager Administration Guide.

Where to Find Disk Management Tasks

Use these references to find step-by-step instructions for managing disks.

Disk Management Task 

For More Information 

Format a disk and examine a disk label 

Chapter 32, Administering Disks (Tasks)

Add a new disk to a SPARC system 

Chapter 33, SPARC: Adding a Disk (Tasks)

Add a new disk to an IA system 

Chapter 34, x86: Adding a Disk (Tasks)

Hot-Plug a SCSI or PCI disk 

Chapter 27, Dynamically Configuring Devices (Tasks)

Overview of Disk Management

The management of disks in the Solaris environment usually involves setting up the system and running the Solaris installation program to create the appropriate disk slices and file systems and to install the operating system. Occasionally, you might need to use the format utility to add a new disk drive or replace a defective one.


Note –

The Solaris operating environment runs on two types of hardware, or platforms—SPARC and IA. The Solaris operating environment runs on both 64–bit and 32–bit address spaces. The information in this document pertains to both platforms and address spaces unless called out in a special chapter, section, note, bullet, figure, table, example, or code example.


Disk Terminology

Before you can effectively use the information in this section, you should be familiar with basic disk architecture. In particular, you should be familiar with the following terms:

Disk Term 

Description 

Track 

A concentric ring on a disk that passes under a single stationary disk head as the disk rotates. 

Cylinder 

The set of tracks with the same nominal distance from the axis about which the disk rotates. 

Sector 

A data storage area on a disk, or sections of each disk platter. A sector holds 512 bytes. 

Disk controller 

A chip and its associated circuitry that controls the disk drive. 

Disk label 

The first sector of a disk that contains disk geometry and partition information. 

Device driver 

A device driver is a kernel module that controls a hardware or virtual device. 

For additional information, see the product information from your disk's manufacturer.

About Disk Slices

Files stored on a disk are contained in file systems. Each file system on a disk is assigned to a slice, which is a group of sectors set aside for use by that file system. Each disk slice appears to the operating system (and to the system administrator) as though it were a separate disk drive.

For information about file systems, see Chapter 37, Managing File Systems (Overview).


Note –

Slices are sometimes referred to as partitions. This book uses slice but certain interfaces, such as the format utility, refer to slices as partitions.


When setting up slices, remember these rules:

Slices are set up slightly differently on SPARC and IA platforms. The following table summarizes the differences.

Table 31–1 Slice Differences on Platforms

SPARC Platform 

IA Platform 

Whole disk is devoted to Solaris environment 

Disk is divided into fdisk partitions, one fdisk partition per operating environment

Disk is divided into 8 slices, numbered 0–7 

The Solaris fdisk partition is divided into 10 slices, numbered 0–9

SPARC: Disk Slices

On SPARC based systems, Solaris defines eight disk slices and assigns to each a conventional use. These slices are numbered 0 through 7. The following table summarizes the contents of the eight Solaris slices on a SPARC based system.

Table 31–2 SPARC: Customary Disk Slices

Slice 

File System 

Usually Found on Client or Server Systems? 

Purpose 

root (/)

Both 

Holds files and directories that make up the operating system. 

swap 

Both 

Provides virtual memory, or swap space. Swap space is used when running programs are too large to fit in a computer's memory. The Solaris operating environment then “swaps” programs from memory to the disk and back, as needed.

— 

Both 

Refers to the entire disk, by convention. This slice is defined automatically by the format utility and the Solaris installation programs. The size of this slice should not be changed.

/export

Server only 

Holds alternative versions of the operating system. These alternative versions are required by client systems whose architectures differ from that of the server. Clients with the same architecture type as the server obtain executables from the /usr file system, usually slice 6.

 

 

Optional slice to be defined based on your site's needs. 

 

 

Optional slice to be defined based on your site's needs. 

Can be used to hold application software added to a system. If a slice is not allocated for the /opt file system during installation, the /opt directory is put in slice 0.

/usr

Both 

Holds operating system commands (also known as executables). This slice also holds documentation, system programs (init and syslogd, for example) and library routines.

/home or

/export/home

Both 

Holds files that are created by users. 

x86: Disk Slices

On IA based systems, disks are divided into fdisk partitions. An fdisk partition is a section of the disk that reserved for a particular operating environment, such as the Solaris release.

The Solaris release places ten slices, numbered 0–9, on a Solaris fdisk partition as shown in the following table.

Table 31–3 x86: Customary Disk Slices

Slice 

File System 

Usually Found on Client or Server Systems? 

Purpose 

root (/) 

Both 

Holds the files and directories that make up the operating system. 

swap 

Both 

Provides virtual memory, or swap space. Swap space is used when running programs are too large to fit in a computer's memory. The Solaris operating environment then “swaps” programs from memory to the disk and back, as needed.

— 

Both 

Refers to the entire disk, by convention. This slice is defined automatically by the format utility and the Solaris installation programs. The size of this slice should not be changed.

/export

Server only 

Holds alternative versions of the operating system. These alternative versions are required by client systems whose architectures differ from that of the server.  

 

 

Optional slice to be defined based on your site's needs. 

 

Both 

Optional slice to be defined based on your site's needs. 

Can be used to hold application software added to a system. If a slice is not allocated for the /opt file system during installation, the /opt directory is put in slice 0.

/usr

Both 

Holds operating system commands (also known as executables). This slice also holds documentation, system programs (init and syslogd, for example) and library routines.

/home or /export/home

Both 

Holds files that are created by users. 

— 

Both 

Contains information necessary for to boot the Solaris environment from the hard disk. The slice resides at the beginning of the Solaris fdisk partition (although the slice number itself does not indicate this fact), and is known as the boot slice.

— 

Both 

Provides an area that is reserved for alternate disk blocks. Slice 9 is known as the alternate sector slice. 

Using Raw Data Slices

The SunOS operating system stores the disk label in block 0 of each disk. So, third-party database applications that create raw data slices must not start at block 0, or the disk label will be overwritten and the data on the disk will be inaccessible.

Do not use the following areas of the disk for raw data slices, which are sometimes created by third-party database applications:

Slice Arrangements on Multiple Disks

Although a single large disk can hold all slices and their corresponding file systems, two or more disks are often used to hold a system's slices and file systems.


Note –

A slice cannot be split between two or more disks. However, multiple swap slices on separate disks are allowed.


For instance, a single disk might hold the root (/) file system, a swap area, and the /usr file system, while another disk holds the /export/home file system and other file systems that contain user data.

In a multiple disk arrangement, the disk that contains the operating system software and swap space (that is, the disk that holds the root (/) and /usr file systems and the slice for swap space) is called the system disk. Other disks are called secondary disks or non-system disks.

When you arrange a system's file systems on multiple disks, you can modify file systems and slices on the secondary disks without having to shut down the system or reload operating system software.

When you have more than one disk, you also increase input-output (I/O) volume. By distributing disk load across multiple disks, you can avoid I/O bottlenecks.

Determining Which Slices to Use

When you set up a disk's file systems, you choose not only the size of each slice, but also which slices to use. Your decisions about these matters depend on the configuration of the system to which the disk is attached and the software you want to install on the disk.

System configurations that need disk space are as follows:

Each system configuration requires the use of different slices. The following table lists these requirements.

Table 31–4 System Configurations and Slice Requirements

Slice 

Servers 

Standalone Systems 

root 

root 

swap 

swap 

— 

— 

/export

— 

/usr

/usr

/export/home

/home

For more information about system configurations, see Overview of System Types.


Note –

The Solaris installation program provides slice size recommendations based on the software you select for installation.


The format Utility

Read the following overview of the format utility and its uses before proceeding to the “how-to” or reference sections.

The format utility is a system administration tool that is used to prepare hard disk drives for use on your Solaris system.

The following table shows the features and associated benefits that the format utility provides.

Table 31–5 Features and Benefits of the format Utility

Feature 

Benefit 

Searches your system for all attached disk drives 

Reports on the following:

  • Target location

  • Disk geometry

  • Whether the disk is formatted

  • If the disk has mounted partitions

Retrieves disk labels 

Convenient for repair operations 

Repairs defective sectors 

Allows administrators to repair disk drives with recoverable errors instead of sending the drive back to the manufacturer 

Formats and analyzes a disk 

Creates sectors on the disk and verifies each sector 

Partitions a disk 

Divides a disk into slices so individual file systems can be created on separate slices 

Labels a disk 

Writes disk name and configuration information to the disk for future retrieval (usually for repair operations) 

The format utility options are fully described in Chapter 35, The format Utility (Reference).

When to Use the format Utility

Disk drives are partitioned and labeled by the Solaris installation program when you install the Solaris release. You can use the format utility to do the following:

The main reason a system administrator uses the format utility is to divide a disk into disk slices. These steps are covered in Chapter 33, SPARC: Adding a Disk (Tasks) and Chapter 34, x86: Adding a Disk (Tasks).

See the following section for guidelines on using the format utility.

Guidelines for Using the format Utility

Table 31–6 The format Utility Guidelines

Task 

Guidelines 

For More Information 

Format a disk 

  • Any existing data is destroyed when you reformat a disk.

  • The need for formatting a disk drive has dropped as more and more manufacturers ship their disk drives formatted and partitioned. You might not need to use the format utility when you add a disk drive to an existing system.

  • If a disk has been relocated and is displaying a lot of disk errors, you can attempt to reformat it, which will automatically remap any bad sectors.

How to Format a Disk

Replace a system disk 

  • Data from the damaged system disk must be restored from a backup medium. Otherwise, the system will have to be reinstalled by using the installation program.

SPARC: How to Connect a System Disk and Boot or IA: How to Connect a System Disk and Boot or if the system must be reinstalled, Solaris 9 Installation Guide

Divide a disk into slices 

  • Any existing data is destroyed when you repartition and relabel a disk with existing slices.

  • Existing data must be copied to backup media before the disk is repartitioned and restored.

SPARC: How to Create Disk Slices and Label a Disk or IA: How to Create Disk Slices and Label a Disk

Add a secondary disk to an existing system 

  • Any existing data must be restored from backup media if the secondary disk is reformatted or repartitioned.

SPARC: How to Connect a Secondary Disk and Boot or IA: How to Connect a Secondary Disk and Boot

Repair a disk drive 

  • Some customer sites prefer to replace rather than repair defective drives. If your site has a repair contract with the disk drive manufacturer, you might not need to use the format utility to repair disk drives.

  • The repair of a disk drive usually means that a bad sector is added to a defect list. New controllers remap bad sectors automatically with no system interruption.

  • If the system has an older controller, you might need to remap a bad sector and restore any lost data.

Repairing a Defective Sector

Formatting a Disk

In most cases, disks are formatted by the manufacturer or reseller. So, they do not need to be reformatted when you install the drive. To determine if a disk is formatted, use the format utility. For more information, see How to Determine if a Disk is Formatted.

If you determine that a disk is not formatted, use the format utility to format the disk.

When you format a disk, you accomplishes two steps:


Caution – Caution –

Formatting a disk is a destructive process because it overwrites data on the disk. For this reason, disks are usually formatted only by the manufacturer or reseller. If you think disk defects are the cause of recurring problems, you can use the format utility to do a surface analysis. However, be careful to use only the commands that do not destroy data. For details, see How to Format a Disk.


A small percentage of total disk space that is available for data is used to store defect and formatting information. This percentage varies according to disk geometry, and decreases as the disk ages and develops more defects.

Formatting a disk might take anywhere from a few minutes to several hours, depending on the type and size of the disk.

About Disk Labels

A special area of every disk is set aside for storing information about the disk's controller, geometry, and slices. That information is called the disk's label. Another term that is used to described the disk label is the VTOC (Volume Table of Contents). To label a disk means to write slice information onto the disk. You usually label a disk after you change its slices.

If you fail to label a disk after you create slices, the slices will be unavailable because the operating system has no way of “knowing” about the slices.

Partition Table

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. You can display a disk's partition table by using the format utility. The following table describes partition table terminology.

Table 31–7 Partition Table Terminology

Partition Term 

Value 

Description 

Number 

0-7

Partition (or slice number). Valid numbers are 0–7. 

Tag 

0=UNASSIGNED 1=BOOT 2=ROOT 3=SWAP 4=USR 5=BACKUP 7=VAR 8=HOME

A numeric value that usually describes the file system mounted on this partition.  

Flags 

wm

The partition is writable and mountable. 

 

wu rm

The partition is writable and unmountable. This is the default state of partitions that are dedicated for swap areas. (However, the mount command does not check the “not mountable” flag.)

 

rm

The partition is read only and mountable. 

Partition flags and tags are assigned by convention and require no maintenance.

For more information on displaying the partition table, see How to Display Disk Slice Information or How to Examine a Disk Label.

Displaying Partition Table Information

The following is an example of a partition table from a 1.05-Gbyte disk by using the format utility:


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

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0 -  300      148.15MB    (301/0/0)   303408
  1       swap    wu     301 -  524      110.25MB    (224/0/0)   225792
  2     backup    wm       0 - 2035     1002.09MB    (2036/0/0) 2052288
  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     525 - 2035      743.70MB    (1511/0/0) 1523088
  7 unassigned    wm       0               0         (0/0/0)          0

The partition table displayed by the format utility contains the following information:

Column Name 

Description 

Part

Partition (or slice number). See Table 31–7 for a description of this column.

Tag

Partition tag. See Table 31–7 for a description of this column.

Flags

Partition flag. See Table 31–7 for a description of this column.

Cylinders

The starting and ending cylinder number for the slice. 

Size

The slice size in Mbytes. 

Blocks

The total number of cylinders and the total number of sectors per slice in the far right column. 

The following is an example of a disk label displayed by using the prtvtoc command.


# prtvtoc /dev/rdsk/c0t1d0s0
* /dev/rdsk/c0t1d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*      72 sectors/track
*      14 tracks/cylinder
*    1008 sectors/cylinder
*    2038 cylinders
*    2036 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0    303408    303407   /
       1      3    01     303408    225792    529199
       2      5    00          0   2052288   2052287
       6      4    00     529200   1523088   2052287   /usr

The prtvtoc command provides the following information:

Column Name 

Description  

Dimensions

This section describes the physical dimensions of the disk drive. 

Flags

This section describes the flags listed in the partition table section. For a description of partition flags, see Table 31–7.

Partition (or Slice) Table

This section contains the following information: 

Partition

Partition (or slice number). For a description of this column, see Table 31–7.

Tag

Partition tag. For a description of this column, see Table 31–7.

Flags

Partition flag. For a description of this column, see Table 31–7.

First Sector

The first sector of the slice. 

Sector Count

The total number of sectors in the slice. 

Last Sector

The last sector of the slice. 

Mount Directory

The last mount point directory for the file system. 

Dividing a Disk Into Slices

The format utility is most often used by system administrators to divide a disk into slices. The steps are as follows:

The easiest way to divide a disk into slices is to use the modify command from the partition menu of the format utility. The modify command allows you to create slices by specifying the size of each slice in Mbytes without having to keep track of the starting cylinder boundaries. The modify command also keeps tracks of any disk space that remains in the “free hog” slice.

Using the Free Hog Slice

When you use the format utility to change the size of one or more disk slices, you designate a temporary slice that will expand and shrink to accommodate the resizing operations.

This temporary slice donates, or “frees,” space when you expand a slice, and receives, or “hogs,” the discarded space when you shrink a slice. For this reason, the donor slice is sometimes called the free hog.

The free hog slice exists only during installation or when you run the format utility. There is no permanent free hog slice during day-to-day operations.

For information on using the free hog slice, see SPARC: How to Create Disk Slices and Label a Disk or IA: How to Create Disk Slices and Label a Disk.