System Administration Guide, Volume I

Part VII Managing Disks

This part provides instructions for managing disks in the Solaris environment. This part contains these chapters.

Chapter 21, Disk Management (Overview)

Provides an overview of Solaris disk slices and an introduction to the format utility.

Chapter 22, Administering Disks (Tasks)

Provides step-by-step instructions for formatting a disk, examining disk labels, and repairing a defective disk sector.  

Chapter 23, SPARC: Adding a Disk (Tasks)

Provides step-by-step instructions for adding a disk to a SPARC system.  

Chapter 24, x86: Adding a Disk (Tasks)

Provides step-by-step instructions for adding a disk to an x86 system.  

Chapter 25, The format Utility (Reference)

Provides a description of the format utility's menu and commands. This chapter also includes information about the format.dat file, rules for providing input to format commands, and instructions on using the help facility.

Chapter 21 Disk Management (Overview)

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

This is a list of the overview information in this chapter.

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

Where to Find Disk Management Tasks

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

Introduction

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

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:

If you are unfamiliar with these terms, refer to the glossary (for a brief definition) or product information from the 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--a group of cylinders 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.

See Part VIII for information about file systems.


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 x86 platforms. Table 21-1 summarizes the differences:

Table 21-1 Slice Differences on Platforms

SPARC Platforms 

x86 Platforms 

Whole disk is devoted to Solaris environment 

Disk is divided into fdisk partitions, one per operating environment

Disk is divided into eight slices, numbered 0-7 

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

SPARC: Disk Slices

On SPARC systems, Solaris defines eight disk slices and assigns to each a conventional use. These slices are numbered 0 through 7. Table 21-2 summarizes the contents of the eight Solaris slices on a SPARC system.

Table 21-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. It is defined automatically by Sun's format 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.

/export/swap

Server only 

Provides virtual memory space for client systems. 

/opt

Both 

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

/usr

Both 

Holds operating system commands--also known as executables-- designed to be run by users. This slice also holds documentation, system programs (init and syslogd, for example) and library routines.

/home or

/export/home

Both 

Holds files created by users. 

x86: Disk Slices

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

Solaris places ten slices, numbered 0-9, on the Solaris fdisk partition on a disk in an x86 system, as shown in Table 21-3.

Table 21-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. It is defined automatically by Sun's 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.  

/export/swap

Server only 

Provides virtual memory space for the client systems. 

/opt

Both 

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

/usr

Both 

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

/home or /export/home

Both 

Holds files created by users. 

-- 

Both 

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

-- 

Both 

Provides an area 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, cylinder 0 of each disk. This means that using third-party database applications that create raw data slices must not start at block 0, cylinder 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:

  1. Block 0, cylinder 0, where the disk label is stored.

  2. Avoid cylinder 0 entirely for improved performance.

  3. Slice 2, which represents the entire disk.

Slice Arrangements on Multiple Disks

Although a single disk that is large enough 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 a separate disk is provided for the /export/home file system and other file systems containing user data.

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

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

Having more than one disk also increases 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.

There are five system configurations:

Each system configuration requires the use of different slices. Table 21-4 lists these requirements.

Table 21-4 System Configurations and Slice Requirements

Slice 

Servers 

Diskless Clients 

Standalone 

Systems 

AutoClient 

Systems 

root 

(on server) 

root 

root 

swap 

(on server) 

swap 

swap 

-- 

-- 

-- 

-- 

/export

-- 

-- 

-- 

/export/swap

-- 

-- 

-- 

/opt

(on server) 

/opt

(on server) 

/usr

(on server) 

/usr

(on server) 

/export/home

(on server) 

/home

(on server) 

See Chapter 4, Managing Server and Client Support (Tasks) for more information about system configurations.


Note -

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


The format Utility

Read the following information if you want to see a conceptual view of the format utility and it uses before proceeding to the "how-to" or reference sections.

Definition

The format utility is a system administration tool used to prepare hard disk drives for use on your Solaris system. The format utility cannot be used on diskette drives, CD-ROM drives, or tape drives.

Features and Benefits

Table 21-5 shows the features and associated benefits that the format utility provides.

Table 21-5 Features and Benefits of the format Utility

Feature 

Benefit 

Searches your system for all attached disk drives 

Reports:

  • Target location

  • Disk geometry

  • Whether the disk is formatted

  • If the disk has mounted partitions

Retrieves disk labels 

Used in 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 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) 

All of the options of the format utility are fully described in Chapter 25, The format Utility (Reference).

When to Use the format Utility

Disk drives are partitioned and labeled by the Solaris installation program as part of installing the Solaris release. You may need to use the format utility when:

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

See Table 21-6 for guidelines on using the format utility.

Guidelines for Using the format Utility

Table 21-6 The format Utility Guidelines

Use format To ...

Considerations ... 

Where to Go ... 

Format a disk 

  • Any existing data will be destroyed when a disk is reformatted.

  • The need for formatting a disk drive has dropped as more and more manufacturers ship their disk drives formatted and partitioned. You may not need to use the format utility when adding 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.

Chapter 23, SPARC: Adding a Disk (Tasks) or Chapter 24, x86: Adding a Disk (Tasks) or if the system must be reinstalled, Solaris Advanced Installation Guide

Divide a disk into slices 

  • Any existing data will be destroyed when a disk with existing slices is repartitioned and relabeled.

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

Chapter 23, SPARC: Adding a Disk (Tasks) or Chapter 24, x86: Adding a Disk (Tasks)

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.

Chapter 23, SPARC: Adding a Disk (Tasks) or Chapter 24, x86: Adding a Disk (Tasks)

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 may not need to use the format utility to repair disk drives.

  • Repairing 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 may need to remap a bad sector and restore any lost data.

Chapter 25, The format Utility (Reference)

Formatting a Disk

In most cases, disks are formatted by the manufacturer or reseller and do not need to be reformatted when you install the drive. To determine whether or not a disk is formatted, use the format utility. See "How to Determine If a Disk is Formatted" for more information.

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

Formatting a disk accomplishes two steps:


Caution - Caution -

Formatting is a destructive process--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 causing recurring problems, you can use the format utility to do a surface analysis, but be careful to use only the commands that do not destroy data. See "How to Format a Disk" for details.


A small percentage of total disk space 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 may 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 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 changing its slices.

If you fail to label a disk after creating 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 total size of the slices. A disk's partition table can be displayed using the format utility. Table 21-7 describes partition table terminology.

Table 21-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 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.

See "How to Display Disk Slice Information" or "How to Examine a Disk Label" for more information on displaying the partition table.

Examples--Partition Tables

The following partition table example is displayed from a 535-Mbyte disk using the format utility:

Graphic

The partition table contains the following information:

Column Name 

Description 

Part

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

Tag

Partition tag. See Table 21-7 for a description of this column.

Flags

Partition flag. See Table 21-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 example displays a disk label using the prtvtoc command.


# prtvtoc /dev/rdsk/c0t3d0s0
* /dev/rdsk/c0t3d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*      80 sectors/track
*       9 tracks/cylinder
*     720 sectors/cylinder
*    2500 cylinders
*    1151 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                     First   Sector   Last
* Partition Tag Flags Sector  Count   Sector  Mount Directory
       0     2   00        0   66240   66239   /
       1     3   01    66240  131760  197999
       2     5   00        0  828720  828719
       3     0   00   198000   66240  264239   /export
       4     0   00   264240   66240  330479   /export/swap
       5     0   00   330480   72000  402479   /opt
       6     4   00   402480  385200  787679   /usr
       7     8   00   787680   41040  828719   /export/home
# 

The disk label includes the following information:

Dimensions - This section describes the physical dimensions of the disk drive.

Flags - This section describes the flags listed in the partition table section. See Table 21-7 for a description of partition flags.

Partition (or Slice) Table - This section contains the following information:

Column Name 

Description  

Partion

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

Tag

Partition tag. See Table 21-7 for a description of this column.

Flags

Partition flag. See Table 21-7 for a description of this column.

First Sector

The first sector of the slice. 

Sector Count

The total number of sectors in the slice. 

Last Sector

The last sector number in 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:

The easiest way to divide a disk into slices is to use the modify command from the partition menu. The modify command allows you to create slices by specifying the size of each slice in megabytes without having to keep track of starting cylinder boundaries. It also keeps tracks of any disk space remainder 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 donor slice exists only during installation or when you run the format utility. There is no permanent donor slice during day-to-day, normal operations.

See "SPARC: How to Create Disk Slices and Label a Disk" or "x86: How to Create Disk Slices and Label a Disk" for information on using the free hog slice.

Chapter 22 Administering Disks (Tasks)

This chapter contains disk administration procedures. Many of the procedures described in this chapter are optional if you are already familiar with how disks are managed on systems running the Solaris release.

This is a list of step-by-step instructions in this chapter.

For overview information about disk management, see Chapter 21, Disk Management (Overview).

Administering Disks Task Map

Table 22-1 Administering Disks Task Map

Task 

Description 

For Instructions, Go To 

1. Identify the Disks on a System 

If you are not sure of the types of disks on a system, use the format utility to identify the disk types.

"How to Identify the Disks on a System"

2. Format the Disk 

Determine whether a disk is already formatted by using the format utility.

"How to Determine If a Disk is Formatted"

 

In most cases, disks are already formatted. Use the format utility if you need to format a disk.

"How to Format a Disk"

3. Display Slice Information 

Display slice information by using the format utility.

"How to Display Disk Slice Information"

4. Label the Disk 

Create the disk label by using the format utility.

"How to Label a Disk"

5. Examine the Disk Label 

Examine the disk label by using the prtvtoc command.

"How to Examine a Disk Label"

6. Create a format.dat Entry

Create a format.dat entry to support a third-party disk.

"How to Create a format.dat Entry"

7. Repair a Defective Disk Sector  

Identify a defective disk sector by using the format utility.

"How to Identify a Defective Sector by Using Surface Analysis"

8. If Necessary, Fix a Defective Disk Sector 

Fix a defective disk sector by using the format utility.

"How to Repair a Defective Sector"

Identifying Disks on a System

Use the format utility to discover the types of disks that are connected to a system. You can also use the format utility to verify that a disk is known to the system. See Chapter 25, The format Utility (Reference) for information on using the format utility.

How to Identify the Disks on a System

  1. Become superuser.

  2. Identify the disks that are recognized on the system with the format utility.


    # format
    

    The format utility displays a list of disks that it recognizes under AVAILABLE DISK SELECTIONS.

Examples--Identifying the Disks on a System

The following format output is from a system with two disks.


# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c0t1d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
          /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@1,0
       1. c0t3d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
          /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0
Specify disk (enter its number): 

The format output associates a disk's physical and local device name to the disk's marketing name which appears in brackets <>. This is an easy way to identify which local device names represent the disks connected to your system. See Chapter 20, Accessing Devices (Overview) for a description of local and physical device names.

The following example uses a wildcard to display the disks connected to a second controller.


# format /dev/rdsk/c2*
AVAILABLE DISK SELECTIONS:
   0. /dev/rdsk/c2t0d0s0 <SUN2.1G cyl 2733 alt 2 hd 19 sec 80>
      /io-unit@f,e0200000/sbi@0,0/QLGC,isp@2,10000/sd@0,0
   1. /dev/rdsk/c2t1d0s0 <SUN2.1G cyl 2733 alt 2 hd 19 sec 80>
      /io-unit@f,e0200000/sbi@0,0/QLGC,isp@2,10000/sd@1,0
   2. /dev/rdsk/c2t2d0s0 <SUN2.1G cyl 2733 alt 2 hd 19 sec 80>
      /io-unit@f,e0200000/sbi@0,0/QLGC,isp@2,10000/sd@2,0
   3. /dev/rdsk/c2t3d0s0 <SUN2.1G cyl 2733 alt 2 hd 19 sec 80>
      /io-unit@f,e0200000/sbi@0,0/QLGC,isp@2,10000/sd@3,0
   4. /dev/rdsk/c2t5d0s0 <SUN2.1G cyl 2733 alt 2 hd 19 sec 80>
      /io-unit@f,e0200000/sbi@0,0/QLGC,isp@2,10000/sd@5,0
Specify disk (enter its number): 

The following example identifies the disks on a SPARC based system.


# format
AVAILABLE DISK SELECTIONS:
       0. c0t3d0 <SUN2.1G cyl 2733 alt 2 hd 19 sec 80>
          /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@3,0
Specify disk (enter its number): 

The format output identifies that disk 0 (target 3) is connected to the first SCSI host adapter (espdma@...), which is connected to the first SBus device (sbus@0...). The output also associates both the physical and logical device name to the disk's marketing name, SUN02.1G.

The following example identifies the disks on an x86 based system.


# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <DEFAULT cyl 507 alt 2 hd 64 sec 32>
          /eisa/dpt@5c88,0/cmdk@0,0
       1. c0t3d0 <DEFAULT cyl 1852 alt 2 hd 15 sec 74>
          /eisa/dpt@5c88,0/cmdk@3,0
Specify disk (enter its number): 

The format output identifies that disk 0, target 0 (cmdk@0,0) is connected to the first DPT host adapter (dpt@5...), which is connected to the EISA device (eisa). The format output on an x86 based system does not identify disks by their marketing names.

Where to Go From Here

Check the following table if the format utility did not recognize the disk.

If the Disk ... 

Then ... 

Is newly added and you didn't perform a reconfiguration boot 

Go to Chapter 23, SPARC: Adding a Disk (Tasks) or Chapter 24, x86: Adding a Disk (Tasks).

Is a third-party disk 

Go to "Creating a format.dat Entry".

Label was corrupted by a system problem, such as a power failure 

Go to "How to Label a Disk".

Is not properly connected to the system 

Connect the disk to the system using your disk hardware documentation. 

Formatting a Disk

Disks are formatted by the manufacturer or reseller and usually do not need to be reformatted when you install the drive.

A disk must be formatted before:


Caution - Caution -

Formatting is a destructive process--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 causing recurring problems, you can use the format utility to do a surface analysis, but be careful to use only the commands that do not destroy data.


How to Determine If a Disk is Formatted

  1. Become superuser.

  2. Enter the format utility.


    # format
    
  3. Enter the number of the disk that you want to check from the list displayed on your screen.


    Specify disk (enter its number): 0
    
  4. Verify that the disk you chose is formatted by identifying the following message.


    [disk formatted]

Example--Determining If a Disk Is Formatted

The following example shows that disk c0t3d0 is formatted.


# format
AVAILABLE DISK SELECTIONS:
       0. c0t1d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72> 
		       /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@1,0
       1. c0t3d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
          /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0
Specify disk (enter its number): 0
selecting c0t1d0
[disk formatted]

How to Format a Disk

  1. Become superuser.

  2. Enter the format utility.


    # format
    
  3. Enter the number of the disk that you want to format from the list displayed on your screen.


    Specify disk (enter its number): 0
    

    Caution - Caution -

    Do not select the system disk. Formatting your system disk deletes your operating system and any data that you may have on this disk.


  4. To begin formatting the disk, enter format at the format> prompt. Confirm the command by typing y.


    format> format
    Ready to format.  Formatting cannot be interrupted
    and takes 26 minutes (estimated). Continue? yes
    
  5. Verify that the disk format is successful by identifying the following messages.


    Formatting ...
    done
    Verifying media ...
    pass 0 - pattern = 0xc6dec6de
    2035/12/18
    pass 1 - pattern = 0x6db6db6d
    2035/12/18
    total of 0 defective blocks repaired.

Example--Formatting a Disk

The following example formats the disk c0t2d0.


# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c0t1d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
	          /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@1,0
       1. c0t3d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
          /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0
Specify disk (enter its number):0
Selecting c0t1d0
[disk unformatted]
format> format
Ready to format. Formatting cannot be interrupted
and takes 26 minutes (estimated). Continue? yes
Beginning format. The current time is Wed Jun 10 10:24:48 1998
Formatting ...
done
Verifying media ...
pass 0 - pattern = 0xc6dec6de
2035/12/18
pass 1 - pattern = 0x6db6db6d
2035/12/18
total of 0 defective blocks repaired.
format>

Displaying Disk Slices

You can use the format utility to check whether or not a disk has the appropriate disk slices. If you determine that a disk does not contain the slices you want to use, use the format utility to re-create them and label the disk. See "SPARC: How to Create Disk Slices and Label a Disk" or "x86: How to Create Disk Slices and Label a Disk" for information on creating disk slices.


Note -

The format utility uses the term partition in place of slice.


How to Display Disk Slice Information

  1. Become superuser.

  2. Enter the format utility.


    # format
    
  3. Identify the disk for which you want to display slice information by selecting a disk listed under AVAILABLE DISK SELECTIONS.


    Specify disk (enter its number):1
    
  4. Enter the partition menu by typing partition at the format> prompt.


    format> partition 
    
  5. Display the slice information for the current disk drive by typing print at the partition> prompt.


    partition> print
    
  6. Exit the format utility by typing q at the partition> prompt and typing q at the format> prompt.


    partition> q
    format> q
    #
  7. Verify displayed slice information by identifying specific slice tags and slices.

    If the screen output shows that no slice sizes are assigned, the disk probably does not have slices.

Examples--Displaying Disk Slice Information

The following example displays slice information for disk /dev/rdsk/c0t3d0.


# format
Searching for disks...done
Specify disk (enter its number):1
Selecting c0t3d0
format> partition
partition> print
Current partition table (original):
Total disk cylinders available: 1866 + 2 (reserved cylinders)
Part      Tag   Flag   Cylinders    Size      Blocks
  0       root   wm     0 -  292  80.12MB   (293/0/0)   164080
  1       swap   wu   293 -  410  32.27MB   (118/0/0)    66080
  2     backup   wm     0 - 1865  510.23MB  (1866/0/0) 1044960
  3 unassigned   wm     0         0         (0/0/0)          0
  4 unassigned   wm     0         0         (0/0/0)          0
  5       home   wm   411 - 1311  246.37MB  (901/0/0)   504560
  6        usr   wm  1312 - 1718  111.29MB  (407/0/0)   227920
  7 unassigned   wm  1719 - 1865   40.20MB  (147/0/0)    82320
partition> q
format> q
#

See Chapter 21, Disk Management (Overview) for a detailed description of the slice information displayed in these examples.

The following example displays the slice information on disk /dev/rdsk/c0t0d0.


# format
Searching for disks...done
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted]
format> partition
partition> print
Current partition table (original):
Total disk cylinders available: 1479 + 2 (reserved cylinders)
 
Part   Tag    Flag     Cylinders    Size          Blocks
  0      root   wm      1 -  400   108.01MB  (400/0/0)  221200
  1      swap   wu    401 -  556    42.12MB  (156/0/0)   86268
  2    backup   wu      0 - 1479   399.63MB  (1480/0/0) 818440
  3 unassigned  wm      0           0        (0/0/0)         0
  4 unassigned  wm      0           0        (0/0/0)         0
  5 unassigned  wm    557 -  734    48.06MB  (178/0/0)   98434
  6        usr  wm    735 - 1401   180.10MB  (667/0/0)  368851
  7       home  wm   1402 - 1476    20.25MB   (75/0/0)   41475
  8       boot  wu      0 -    0     0.27MB   (1/0/0)      553
  9 unassigned  wm      0           0         (0/0/0)        0
partition> q
format> q

Creating and Examining a Disk Label

Labeling a disk is usually done during system installation or when you are creating new disk slices. You may need to relabel a disk if the disk label is corrupted (for example, from a power failure).

The format utility will attempt to automatically configure any unlabeled SCSI disk. If format is able to automatically configure an unlabeled disk, it will display a message like the following:


	c1t0d0:configured with capacity of 404.65MB

How to Label a Disk

  1. Become superuser.

  2. Enter the format utility.


    # format
    
  3. Enter the number of the disk that you want to label from the list displayed on your screen.


    Specify disk (enter its number):1
    
  4. Use the table below to determine how to label the disk.

    If the Disk Is Unlabeled and Was Successfully Configured ... 

    If the Disk Was Labeled and You Want to Change the Type, or Format Was Not Able to Automatically Configure the Disk ... 

    Format will ask if you want to label the disk. Go to step 5 to label the disk. 

    You must specify the disk type. Go to steps 6-7 to set the disk type and label the disk. 

  5. Label the disk by typing y at the Label it now? prompt.


    Disk not labeled. Label it now? y
    

    The disk is now labeled. Go to step 10 to exit the format utility.

  6. Enter type at the format> prompt.


    format> type
    

    Format displays the Available Drive Types menu.

  7. Select a disk type from the list of possible disk types.


    Specify disk type (enter its number)[8]: 8
    
  8. Label the disk. If the disk is not labeled, the following message is displayed.


    Disk not labeled. Label it now? y
    

    Otherwise you are prompted with this message:


    Ready to label disk, continue? y
    
  9. Use the verify command from the format main menu to verify the disk label.


    format> verify 
    
  10. Exit the format utility by typing q at the format> prompt.


    partition> q
    format> q
    #

Example--Labeling a Disk

The following example automatically configures and labels a 424-Mbyte disk.


# format
	c1t0d0: configured with capacity of 404.65MB
 
AVAILABLE DISK SELECTIONS:
		   0. c0t3d0 <SUN0424 cyl 1151 alt 2 hd 9 sec 80>
        /sbus@1,f8000000/esp@0,800000/sd@3,0
		   1. c1t0d0 <SUN0424 cyl 1151 alt 2 hd 9 sec 80>
			     /sbus@1,f8000000/QLGC,isp@1,10000/sd@0,0
Specify disk (enter its number): 1
Disk not labeled.  Label it now?  yes
format> verify
#

How to Examine a Disk Label

Examine disk label information by using the prtvtoc(1M) command. See Chapter 21, Disk Management (Overview) for a detailed description of the disk label and the information displayed by the prtvtoc command.

  1. Become superuser.

  2. Display the disk label information by using the prtvtoc command.


    # prtvtoc /dev/rdsk/device-name
    

    device-name

    Raw disk device you want to examine.  

Example--Examining a Disk Label

The following example shows the disk label information for disk /dev/rdsk/c0t0d0s0.


# prtvtoc /dev/rdsk/c0t0d0s0
* c0t0d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*      36 sectors/track
*       9 tracks/cylinder
*     324 sectors/cylinder
*    1272 cylinders
*    1254 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                       First   Sector    Last	
* Partition Tag Flags  Sector   Count    Sector  Mount Directory
      0      2   00         0    37260    37259   /
      1      3   01     37260    77760   115019
      2      5   00         0   406296   406295
      6      4   00    115020   283824   398843   /usr
      7      6   00    398844     7452   406295   /export/home
#

Recovering a Corrupted Disk Label

Sometimes a power or system failure will cause a disk's label to become unrecognizable. This doesn't always mean that the slice information or the disk's data will have to be recreated or restored.

The first step to recovering a corrupted disk label is to label the disk with the correct geometry and disk type information. This can be done through the normal disk labeling method, either automatic configuration or manual disk type specification.

If format recognizes the disk type, the next step is to search for a backup label to label the disk. Labeling the disk with the backup label will label the disk with the correct partitioning information, the disk type, and disk geometry.

How to Recover a Corrupted Disk Label

  1. Boot the system to single-user mode. If necessary, boot the system from a local CD-ROM or the network in single-user mode to access the disk.

    See Chapter 8, Booting a SPARC System (Tasks) or Chapter 9, x86: Booting a System (Tasks) for information on booting the system.

  2. Use the format utility to relabel the disk.


    # format
    

    At this point, format attempts to automatically configure any unlabeled SCSI disk. If format is able to configure the unlabeled and corrupted disk, it will display:


    cwtxdy: configured with capacity of abcMB

    The format utility then displays the list of disks on the system.

  3. Enter the number of the disk that you need to recover from the list displayed on your screen.


    Specify disk (enter its number): 1
    
  4. Use the table below to determine how to label the disk.

    If the Disk was Successfully Configured ... 

    If the Disk was not Successfully Configured ... 

    Follow steps 5 and 6. Then go to step 12. 

    Follow steps 7-11. Then go to step 12. 

  5. Search for the backup label by using the verify command.


    format> verify
    Warning: Could not read primary label.
    Warning: Check the current partitioning and 'label' the disk or 
    use the 'backup' command.
    Backup label contents:
    Volume name = <        >
    ascii name  = <SUN0424 cyl 1151 alt 2 hd 9 sec 80>
    pcyl        = 2500
    ncyl        = 1151
    acyl        =    2
    nhead       =    9
    nsect       =   80
    Part     Tag    Flag    Cylinders      Size      Blocks
      0       root   wm      0 -   91   32.34MB   (92/0/0)   66240
      1       swap   wu     92 -  183   32.34MB   (92/0/0)   66240
      2     backup   wu      0 - 1150  404.65MB  (1151/0/0) 828720
      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    184 - 1150   339.96MB  (967/0/0) 696240
      7 unassigned   wm      0              0      (0/0/0)       0
  6. If format was able to find a backup label and the backup label contents appear satisfactory, use the backup command to label the disk with the backup label.


    format> backup
    Disk has a primary label, still continue? y
     
    Searching for backup labels...found.
    Restoring primary label

    The disk label has been recovered. Go to step 12.

  7. If format was not able to automatically configure the disk, specify the disk type using the type command.


    format> type
    

    The format utility displays the Available Drives Type menu.

  8. Select 0 to automatically configure the disk, or select a disk type from the list of possible disk types.


    Specify disk type (enter its number)[8]: 8
    
  9. If the disk was successfully configured, reply with no when format asks if you want to label the disk.


    Disk not labeled.  Label it now?  no
    
  10. Use the verify command to search for backup labels.


    format> verify
    Warning: Could not read primary label.
    Warning: Check the current partitioning and 'label' the disk
    or use the 'backup' command.
    .
    .
    .
  11. If format was able to find a backup label and the backup label contents appear satisfactory, use the backup command to label the disk with the backup label.


    format> backup
    Disk has a primary label, still continue? y
     
    Searching for backup labels...found.
    Restoring primary label

    The disk label has been recovered.

  12. Exit the format utility by typing q.


    format> q
    
  13. Verify the file systems on the recovered disk by using the fsck command.

    See Chapter 31, Checking File System Integrity for information about using the fsck command.

Adding a Third-Party Disk

The Solaris environment supports many third-party disks. However, you may need to supply either a device driver, a formt.dat entry, or both of these.

If the third-party disk was designed to work with standard SunOS operating system-compatible device drivers, creating an appropriate format.dat entry should be enough to allow the disk to be recognized by the format utility. In other cases, you'll need to load a third-party device driver to support the disk.


Note -

Sun cannot guarantee that its format utility will work properly with all third-party disk drivers. If the disk driver is not compatible with the Solaris format utility, the disk drive vendor should supply you with a custom format program.


This section discusses what to do if some of this software support is missing. Typically, this occurs when you invoke the format utility and find that the disk type is not recognized.

Supply the missing software as described in this section, and then refer to the appropriate configuration procedure for adding system disks or secondary disks in Chapter 23, SPARC: Adding a Disk (Tasks) or Chapter 24, x86: Adding a Disk (Tasks).

Creating a format.dat Entry

Unrecognized disks cannot be formatted without precise information about the disk's geometry and operating parameters. This information is supplied in the /etc/format.dat file.


Note -

SCSI-2 drives do not require a format.dat entry. Starting with the Solaris 2.3 release, the format utility automatically configures the SCSI-2 drivers if the drives are powered on during a reconfiguration boot. See "How to Automatically Configure a SCSI Drive" for step-by-step instructions on configuring a SCSI disk drive automatically.


If your disk was not recognized, use a text editor to create an entry in format.dat for the disk. You'll need to gather all the pertinent technical specifications about the disk and its controller before you start. This information should have been provided with the disk. If not, contact the disk manufacturer or your supplier. See Chapter 25, The format Utility (Reference) for more information on adding an entry to the /etc/format.dat file.

How to Create a format.dat Entry

  1. Become superuser.

  2. Make a copy of the /etc/format.dat file.


    # cp /etc/format.dat /etc/format.dat.gen
    
  3. Modify the /etc/format.dat file to include an entry for the third-party disk using the format.dat information described in Chapter 25, The format Utility (Reference).

    Use the disk's hardware product documentation to gather the required information.

Automatically Configuring SCSI Disk Drives

In Solaris 2.3 release and compatible versions, the format utility automatically configures SCSI disk drives even if that specific type of drive is not listed in the /etc/format.dat file. This feature enables you to format, slice, and label any disk driver compliant with SCSI-2 specification for disk device mode sense pages.

The following steps are involved in configuring a SCSI drive using autoconfiguration:

After the reconfiguration boot, invoke the format utility. The format utility will attempt to configure the disk and, if successful, alert the user that the disk was configured. See "How to Automatically Configure a SCSI Drive" for step-by-step instructions on configuring a SCSI disk drive automatically.

Here are the default slice rules that format uses to create the partition table.

Table 22-2 SCSI Disk Slice Rules

Disk Size 

Root File System 

Swap Slice 

0 - 180 Mbytes 

16 Mbytes 

16 Mbytes 

180 Mbytes - 280 Mbytes 

16 Mbytes 

32 Mbytes 

280 Mbytes - 380 Mbytes 

24 Mbytes 

32 Mbytes 

380 Mbytes - 600 Mbytes 

32 Mbytes 

32 Mbytes 

600 Mbytes - 1.0 Gbytes 

32 Mbytes 

64 Mbytes 

1.0 Gbytes - 2.0 Gbytes 

64 Mbytes 

128 Mbytes 

More than 2.0 Gbytes 

128 Mbytes 

128 Mbytes 

In all cases, slice 6 (for the /usr file system) gets the remainder of the space on the disk.

Here's an example of a format-generated partition table for a 1.3-Gbyte SCSI disk drive.


Part    Tag    Flag     Cylinders     Size        Blocks
   0     root    wm       0 -   96    64.41MB      (97/0/0)
   1     swap    wu      97 -  289   128.16MB     (193/0/0)
   2   backup    wu       0 - 1964     1.27GB    (1965/0/0)
   6      usr    wm     290 - 1964     1.09GB    (1675/0/0)

See Chapter 25, The format Utility (Reference) for more information about using SCSI automatic configuration.

How to Automatically Configure a SCSI Drive

  1. Become superuser.

  2. Create the /reconfigure file that will be read when the system is booted.


    # touch /reconfigure
    
  3. Shut down the system.


    # shutdown -i0 -g30 -y
    

    -i0

    Brings the system down to init state 0 (zero), the power-down state. 

    -g30

    Notifies logged-in users that they have n seconds before the system begins to shut down.

    -y

    Specifies the command should run without user intervention. 

    The ok or > prompt is displayed after the operating environment is shut down.

  4. Turn off power to the system and all external peripheral devices.

  5. Make sure the disk you are adding has a different target number than the other devices on the system.

    You will often find a small switch located at the back of the disk for this purpose.

  6. Connect the disk to the system and check the physical connections.

    Refer to the disk's hardware installation guide for installation details.

  7. Turn on the power to all external peripherals.

  8. Turn on the power to the system.

    The system will boot and display the login prompt.

  9. Login as superuser, invoke the format utility, and select the disk to be configured automatically.


    # format
    Searching for disks...done
    c1t0d0: configured with capacity of 404.65MB
    AVAILABLE DISK SELECTIONS:
           0. c0t3d0 <SUN0424 cyl 1151 alt 2 hd 9 sec 80>
              /sbus@1,f8000000/esp@0,800000/sd@3,0
           1. c1t0d0 <SUN0424 cyl 1151 alt 2 hd 9 sec 80>
              /sbus@1,f8000000/QLGC,isp@1,10000/sd@0,0
    Specify disk (enter its number): 1
    
  10. Reply yes to the prompt to label the disk.

    Replying y will cause the disk label to be generated and written to the disk by the autoconfiguration feature.


    Disk not labeled. Label it now? y
    
  11. Verify the disk label with the verify command.


    format> verify
    
  12. Exit the format utility.


    format> q
    

Repairing a Defective Sector

If a disk on your system has a defective sector, you can repair it by using the instructions in the following procedures. You may become aware of defective sectors when you:

How to Identify a Defective Sector by Using Surface Analysis

  1. Become superuser.

  2. Unmount the file system in the slice that contains the defective sector.

    See mount(1M) for more information.


    # umount /dev/dsk/device-name
    
  3. Enter the format utility by typing format.


    # format
    
  4. Select the affected disk.


    Specify disk (enter its number):1
    selecting c0t2d0:
    [disk formatted]
    Warning: Current Disk has mounted partitions.
  5. Enter the analyze menu by typing analyze at the format> prompt.


    format> analyze
    
  6. Set up the analysis parameters by typing setup at the analyze> prompt. Use the parameters shown here:


    analyze> setup
    Analyze entire disk [no]? n
    Enter starting block number [0, 0/0/0]: 12330
    Enter ending block number [584159, 1216/9/47]: 12360
    Loop continuously [no]? y
    Repair defective blocks [yes]? n
    Stop after first error [no]? n
    Use random bit patterns [no]? n
    Enter number of blocks per transfer [31, 0/0/31]: 1
    Verify media after formatting [yes]? y
    Enable extended messages [no]? n
    Restore defect list [yes]? y
    Create defect label [yes]? y
    
  7. Use the read command to find the defect.


    analyze> read
    Ready to analyze (won't harm SunOS). This takes a long time,
    but is interruptible with Control-C. Continue? y
            pass 0
       25/7/24
            pass 1
    Block 12354  (18/4/18), Corrected media error (hard data ecc)
       25/7/24
    ^C
    Total of 1 defective blocks repaired.

How to Repair a Defective Sector

  1. Become superuser.

  2. Enter the format utility and select the disk that contains the defective sector.


    # format
    Searching for disks...done
    AVAILABLE DISK SELECTIONS:
        0. c0t2d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
    /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@2,0
        1. c0t3d0 <SUN0535 cyl 1866 alt 2 hd 7 sec 80>
    /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0
    Specify disk (enter its number): 1
    selecting c0t3d0
    [disk formatted]
    format> 
  3. Enter the repair command at the format> prompt.


    format> repair
    
  4. Enter the defective block number.


     Enter absolute block number of defect: 12354
       Ready to repair defect, continue? y
       Repairing block 12354 (18/4/18)...ok.
    format>

    If you are unsure of the format used to identify the defective sector, see "How to Identify a Defective Sector by Using Surface Analysis" for more information.

Tips and Tricks

Use the following tips to help you manage disks more efficiently.

Debugging format Sessions

Invoke format -M to enable extended and diagnostic messages for using the format utility with SCSI devices only.

In this example, the series of numbers below Inquiry: represent the hexadecimal value of the inquiry data displayed to the right of the numbers.


# format -M
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c0t3d0 <SUN0535 cyl 1866 alt 2 hd 7 sec 80>
/iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0
 
Specify disk (enter its number): 0
selecting c0t3d0
[disk formatted]
format> inquiry
Inquiry:
00 00 02 02 27 00 00 12 43 4f 4e 4e 45 52 20 20   ....'...CONNER 
43 50 33 30 35 34 30 20 20 53 55 4e 30 35 33 35   CP30540  SUN0535
42 30 42 42 39 33 30 38 46 39 30                  B0BB9308F90
Vendor:   CONNER 
Product:  CP30540  SUN0535
Revision: B0BB
format> 

Label Multiple Disks by Using the prtvtoc and fmthard Commands

Use the prtvtoc and fmthard commands to label multiple disks with the same disk geometry.

Use this for loop in a script to copy a disk label from one disk and replicate it on multiple disks.


# for i in x y z
> do
> prtvtoc /dev/rdsk/cwtxdysz | fmthard -s - /dev/rdsk/cwt${i}d0s2
> done

Example--Labeling Multiple Disks

In this example, the disk label from c2t0d0s0 is copied to four other disks.


# for i in 1 2 3 5
> do
> prtvtoc /dev/rdsk/c2t0d0s0 | fmthard -s - /dev/rdsk/c2t${i}d0s2
> done
fmthard:  New volume table of contents now in place.
fmthard:  New volume table of contents now in place.
fmthard:  New volume table of contents now in place.
fmthard:  New volume table of contents now in place.
#

Chapter 23 SPARC: Adding a Disk (Tasks)

This chapter provides the procedures for adding a disk to a SPARC system.

This is a list of the step-by-step instructions in this chapter.

For overview information about disk management, see Chapter 21, Disk Management (Overview).

SPARC: About System and Secondary Disks

A system disk contains the root (/) or /usr file systems, or both. If the disk containing either of these file systems becomes damaged, you have two ways to recover:

A secondary disk doesn't contain the root (/) and /usr file systems. It usually contains space for user files. You can add a secondary disk to a system for more disk space or you can replace a damaged secondary disk. If you replace a secondary disk on a system, you can restore the old disk's data on the new disk.

SPARC: Adding a System or Secondary Disk Task Map

Table 23-1 Adding a System or Secondary Disk Task Map

Task 

Description 

For Instructions, Go To 

1. Connect the Disk and Boot 

System Disk

Connect the new disk and boot from a local or remote Solaris CD.  

"SPARC: How to Connect a System Disk and Boot"

 

Secondary Disk

Connect the new disk and perform a reconfiguration boot, so the system will recognize the disk.  

"SPARC: How to Connect a Secondary Disk and Boot"

2. Create Slices and Label the Disk 

Create disk slices and label the disk if it has not already been done by the disk manufacturer.  

"SPARC: How to Create Disk Slices and Label a Disk"

3. Create File Systems 

Create UFS file systems on the disk slices with the newfs command. You must create the root (/) or /usr file system (or both) for a system disk.

"SPARC: How to Create File Systems"

4. Restore File Systems 

Restore the root (/) or /usr file system (or both) on the system disk. If necessary, restore file systems on the secondary disk.

Chapter 35, Restoring Files and File Systems (Tasks)

5. Install Boot Block 

System Disk Only. Install the boot block on the root (/) file system, so the system can boot.

"SPARC: How to Install a Boot Block on a System Disk"

SPARC: How to Connect a System Disk and Boot

This procedure assumes that the system is shut down.

  1. Disconnect the damaged system disk from the system.

  2. Make sure the disk you are adding has a different target number than the other devices on the system.

    You will often find a small switch located at the back of the disk for this purpose.

  3. Connect the replacement system disk to the system and check the physical connections.

    Refer to the disk's hardware installation guide for installation details.

  4. Follow the instructions in the table below depending on whether you are booting from a local or remote Solaris CD.

    If You Are Booting From ... 

    Then ... 

    A Solaris CD from a local CD-ROM drive 

    1. Make sure the CD is in the CD-ROM drive. 

    2. Boot from the CD to single-user mode: 

    ok boot cdrom -s

    A Solaris CD from a CD-ROM drive over the network 

    Boot from the net to single-user mode:  

    ok boot net -s

     

    After a few minutes, the root prompt (#) is displayed.

Where to Go From Here

After you boot the system, you can create slices and a disk label on the disk. Go to "SPARC: How to Create Disk Slices and Label a Disk".

SPARC: How to Connect a Secondary Disk and Boot

  1. Become superuser.

  2. If the disk type is unsupported by the Solaris software, add the device driver for the disk by following the instructions included with the hardware.

    If necessary, see "How to Create a format.dat Entry" for information on creating a format.dat entry for the disk.

  3. Create the /reconfigure file that will be read when the system is booted.


    # touch /reconfigure
    

    The /reconfigure file will cause the SunOS software to check for the presence of any newly installed peripheral devices when you power on or boot your system later.

  4. Shut down the system.


    # shutdown -i0 -g30 -y
    

    -i0

    Brings the system down to init state 0 (zero), the power-down state. 

    -gn

    Notifies logged-in users that they have n seconds before the system begins to shut down.

    -y

    Specifies the command should run without user intervention. 

    The ok or > prompt is displayed after the operating environment is shut down.

  5. Turn off power to the system and all external peripheral devices.

  6. Make sure the disk you are adding has a different target number than the other devices on the system.

    You will often find a small switch located at the back of the disk for this purpose.

  7. Connect the disk to the system and check the physical connections.

    Refer to the disk's hardware installation guide for installation details.

  8. Turn on the power to all external peripherals.

  9. Turn on the power to the system.

    The system will boot and display the login prompt.

Where to Go From Here

After you boot the system, you can create slices and a disk label on the disk. Go to "SPARC: How to Create Disk Slices and Label a Disk".

SPARC: How to Create Disk Slices and Label a Disk

  1. Become superuser.

  2. Start the format(1M) utility.


    # format
    

    A list of available disks is displayed.

  3. Enter the number of the disk that you want to repartition from the list displayed on your screen.


    Specify disk (enter its number): disk-number
    

    disk-number

    Is the number of the disk that you want to repartition. 

  4. Go into the partition menu (which lets you set up the slices).


    format> partition
    
  5. Display the current partition (slice) table.


    partition> print
    
  6. Start the modification process.


    partition> modify
    
  7. Set the disk to all free hog.


    Choose base (enter number) [0]? 1
    

    See "Using the Free Hog Slice" for more information about the free hog slice.

  8. Create a new partition table by answering y when prompted to continue.


    Do you wish to continue creating a new partition table based on 
    above table[yes]?y
    
  9. Identify the free hog partition (slice) and the sizes of the slices when prompted.

    When adding a system disk, you must set up slices for:

    • root (slice 0) and swap (slice 1) and/or

    • /usr (slice 6)

    After you identify the slices, the new partition table is displayed.

  10. Make the displayed partition table the current partition table by answering y when asked.


    Okay to make this the current partition table[yes]? y
    

    If you don't want the current partition table and you want to change it, answer no and go to Step 6.

  11. Name the partition table.


    Enter table name (remember quotes): "partition-name"
    

    partition-name

    Is the name for the new partition table. 

  12. Label the disk with the new partition table when you have finished allocating slices on the new disk.


    Ready to label disk, continue? yes
    
  13. Quit the partition menu.


    partition> q
    
  14. Verify the disk label using the verify command.


    format> verify
    
  15. Quit the format menu.


    format> q
    

SPARC: Example--Creating Disk Slices and Labeling a System Disk

The following example uses the format utility to divide a 1-Gbyte disk into three slices: one for the root (/) file system, one for the swap area, and one for the /usr file system.


# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c0t1d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
          /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@1,0
       1. c0t3d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
          /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0
Specify disk (enter its number): 0
selecting c0t1d0
[disk formatted]
format> partition
partition> print
partition> modify
Select partitioning base:
	0. Current partition table (original)
	1. All Free Hog
Choose base (enter number) [0]? 1
 
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 - 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       0               0         (0/0/0)          0
  7 unassigned    wm       0               0         (0/0/0)          0
Do you wish to continue creating a new partition
table based on above table[yes]? yes
Free Hog partition[6]? 6
Enter size of partition `0' [0b, 0c, 0.00mb]: 200mb
Enter size of partition `1' [0b, 0c, 0.00mb]: 200mb
Enter size of partition `3' [0b, 0c, 0.00mb]:
Enter size of partition `4' [0b, 0c, 0.00mb]:
Enter size of partition `6' [0b, 0c, 0.00mb]:
Enter size of partition `7' [0b, 0c, 0.00mb]:
 
 Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0 -  406      200.32MB    (407/0/0)   410256
  1       swap    wu     407 -  813      200.32MB    (407/0/0)   410256
  2     backup    wu       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     814 - 2035      601.45MB    (1222/0/0) 1231776
  7 unassigned    wm       0               0         (0/0/0)          0
 
Okay to make this the current partition table[yes]? yes
Enter table name (remember quotes): "disk0"
Ready to label disk, continue? yes
partition> quit
format> verify
format> quit

SPARC: Example--Creating Disk Slices and Labeling a Secondary Disk

The following example uses the format utility to divide a 1-Gbyte disk into one slice for the /export/home file system.


# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c0t1d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
          /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@1,0
       1. c0t3d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
         /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0
Specify disk (enter its number): 0
selecting c0t1d0
[disk formatted]
format> partition
partition> print
partition> modify
Select partitioning base:
	0. Current partition table (original)
	1. All Free Hog
Choose base (enter number) [0]? 1
 
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 - 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       0               0         (0/0/0)          0
  7 unassigned    wm       0               0         (0/0/0)          0
Do you wish to continue creating a new partition
table based on above table[yes]? y
Free Hog partition[6]? 7
Enter size of partition '0' [0b, 0c, 0.00mb, 0.00gb]: 
Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]: 
Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]: 
Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]: 
Enter size of partition '5' [0b, 0c, 0.00mb, 0.00gb]: 
Enter size of partition '6' [0b, 0c, 0.00mb, 0.00gb]:
 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 - 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       0               0         (0/0/0)          0
  7 unassigned    wm       0 - 2035     1002.09MB    (2036/0/0) 2052288 
Okay to make this the current partition table[yes]? yes
Enter table name (remember quotes): "home"
Ready to label disk, continue? y
partition> q
format> verify
format> q
# 

Where to Go From Here

After you create disk slices and label the disk, you can create file systems on the disk. Go to "SPARC: How to Create File Systems".

SPARC: How to Create File Systems

  1. Become superuser.

  2. Create a file system for each slice with the newfs(1M) command.


    # newfs /dev/rdsk/cwtxdysz
    

    /dev/rdsk/cwtxdysx

    Raw device for the file system to be created. 

    See Chapter 27, Creating File Systems (Tasks) for more information about the newfs command.

  3. Verify the new file system by mounting it on an unused mount point.


    # mount /dev/dsk/cwtxdysz/mnt
    # ls
    lost+found

Where to Go From Here

If You Are Adding A ... 

Then ... 

System Disk 

You need to restore the root (/) and /usr file systems on the disk. Go to Chapter 35, Restoring Files and File Systems (Tasks).

After the root (/) and /usr file systems are restored, install the boot block. Go to "SPARC: How to Install a Boot Block on a System Disk".

Secondary Disk 

You may need to restore file systems on the new disk. Go to Chapter 35, Restoring Files and File Systems (Tasks).

 

If you are not restoring file systems on the new disk, you are finished adding a secondary disk. See Chapter 28, Mounting and Unmounting File Systems (Tasks) for information on making the file systems available to users.

SPARC: How to Install a Boot Block on a System Disk

  1. Become superuser.

  2. Install a boot block on a system disk using the installboot(1M) command.


    # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk 
    /dev/rdsk/cwtxdys0
    

    /usr/platform/`uname -i`/lib/fs /ufs/bootblk

    Boot block code. 

    /dev/rdsk/cwtxdys0

    Raw device of the root (/) file system.

  3. Verify the boot blocks are installed by rebooting the system to run level 3.


    # init 6
    

SPARC: Example--Installing a Boot Block on a System Disk

The following example installs the boot block on a SPARCstation 10.


# installboot /usr/platform/sun4m/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

Chapter 24 x86: Adding a Disk (Tasks)

This chapter provides the procedures for adding a disk on an x86 system. This is a list of the step-by-step instructions in this chapter.

For overview information about disk management, see Chapter 21, Disk Management (Overview).

x86: About System and Secondary Disks

A system disk contains the root (/) or /usr file systems, or both. If the disk containing either of these file systems becomes damaged, you have two ways to recover:

A secondary disk doesn't contain the root (/) and /usr file systems. It usually contains space for user files. You can add a secondary disk to a system for more disk space or you can replace a damaged secondary disk. If you replace a secondary disk on a system, you can restore the old disk's data on the new disk.

x86: Adding a System or Secondary Disk Task Map

Table 24-1 Adding a System or Secondary Disk Task Map

Task 

Description 

For Instructions, Go To 

1. Connect the Disk and Boot 

System Disk

Connect the new disk and boot from a local or remote Solaris CD.  

"x86: How to Connect a System Disk and Boot"

 

Secondary Disk

Connect the new disk and perform a reconfiguration boot, so the system will recognize the disk.  

"x86: How to Connect a Secondary Disk and Boot"

2. Create Slices and Label the Disk 

Create disk slices and label the disk if it has not already been done by the disk manufacturer.  

"x86: How to Create a Solaris fdisk Partition" and "x86: How to Create Disk Slices and Label a Disk"

3. Create File Systems 

Create UFS file systems on the disk slices with the newfs command. You must create the root (/) or /usr file system (or both) for a system disk.

"x86: How to Create File Systems"

4. Restore File Systems 

Restore the root (/) or /usr file system (or both) on the system disk. If necessary, restore file systems on the secondary disk.

Chapter 35, Restoring Files and File Systems (Tasks)

5. Install Boot Block 

System Disk Only. Install the boot block on the root (/) file system, so the system can boot.

"x86: How to Install a Boot Block on a System Disk"

x86: Guidelines for Creating an fdisk Partition

Follow these guidelines when setting up the fdisk partition.


x86 only -

Solaris slices are sometimes called partitions. This user guide uses the term slice, but some Solaris documentation and programs may refer to a slice as a partition. To avoid confusion, Solaris documentation tries to distinguish between fdisk partitions (which are supported only on SolarisTM (Intel Platform Edition) and the divisions within the Solaris fdisk partition, which may be called slices or partitions.


x86: How to Connect a System Disk and Boot

This procedure assumes that the system is down.

  1. Disconnect the damaged system disk from the system.

  2. Make sure the disk you are adding has a different target number than the other devices on the system.

    You will often find a small switch located at the back of the disk for this purpose.

  3. Connect the replacement system disk to the system and check the physical connections.

    Refer to the disk's hardware installation guide for installation details. Also, refer to the Solaris 7 (Intel Platform Edition) Device Configuration Guide about hardware configuration requirements specific to the disk.

  4. Follow steps a-e if you are booting from a local or remote Solaris CD.

    If you are booting from the network, skip step a.

    1. Insert the Solaris installation CD into the CD-ROM drive.

    2. Insert the Solaris boot diskette into the primary diskette drive (DOS drive A).

    3. Press any key to reboot the system if the system displays the Type any key to reboot prompt. Or, use the reset button to restart the system if the system is shut down.

      The Multiple Device Boot Subsystem menu is displayed after a few minutes.

    4. Select the CD-ROM drive or net(work) as the boot device from the Multiple Device Boot menu.

      The Secondary Boot Subsystem menu is displayed.

    5. Boot the system in single-user mode.


      Select the type of installation: b -s
      

      After a few minutes, the root prompt (#) is displayed.

Where to Go From Here

After you boot the system, you can create slices and a disk label on the disk. Go to "x86: How to Create Disk Slices and Label a Disk".

x86: How to Connect a Secondary Disk and Boot

  1. Become superuser.

  2. If the disk is unsupported by the Solaris software, add the device driver for the disk by following the instructions included with the hardware.

  3. Create the /reconfigure file that will be read when the system is booted.


    # touch /reconfigure
    

    The /reconfigure file will cause the SunOS software to check for the presence of any newly installed peripheral devices when you power on or boot your system later.

  4. Shut down the system.


    # shutdown -i0 -g30 -y
    

    -i0

    Brings the system down to init state 0 (zero), the power-down state. 

    -gn

    Notifies logged-in users that they have n seconds before the system begins to shut down.

    -y

    Specifies the command should run without user intervention. 

    The Type any key to reboot prompt is displayed.

  5. Turn off power to the system and all external peripheral devices.

  6. Make sure the disk you are adding has a different target number than the other devices on the system.

    You will often find a small switch located at the back of the disk for this purpose.

  7. Connect the disk to the system and check the physical connections.

    Refer to the disk's hardware installation guide for installation details. Also, refer to the Solaris 7 (Intel Platform Edition) Device Configuration Guide for hardware configuration requirements specific to the disk.

  8. Turn on the power to all external peripherals.

  9. Turn on the power to the system.

    The system will boot and display the login prompt.

Where to Go From Here

After you boot the system, you can create slices and a disk label on the disk. Go to "x86: How to Create Disk Slices and Label a Disk".

x86: How to Create a Solaris fdisk Partition

  1. Make sure you have read "x86: Guidelines for Creating an fdisk Partition".

  2. Become superuser.

  3. Start the format(1M) utility.


    # format
    
  4. Enter the number of the disk on which to create a Solaris fdisk partition from the list displayed on your screen.


    Specify disk (enter its number): disk-number
    

    disk-number

    Is the number of the disk on which to create a Solaris fdisk partition.

  5. Go into the fdisk menu.


    format> fdisk
    

    The fdisk menu displayed is dependent upon whether the disk has existing fdisk partitions. Determine the next step using the following table.

    If You Want To ... 

    Go To ... 

    See ... 

    Create a Solaris fdisk partition to span the entire disk.

    Step 6 

    "x86: Example--Creating a Solaris fdisk Partition That Spans the Entire Drive"

    Create a Solaris fdisk partition and preserve existing non-Solaris fdisk partition(s).

    Step 7 

    "x86: Example--Creating a Solaris fdisk Partition and Preserving an Existing fdisk Partition"

    Create a Solaris fdisk partition and additional non-Solaris fdisk partition(s).

    Step 7 

    "x86: Example--Creating a Solaris fdisk Partition and an Additional fdisk Partition"

  6. Create and activate a Solaris fdisk partition spanning the entire disk by specifying y at the prompt. Then go to step 14.


    The recommended default partitioning for your disk is:
     
      a 100% "SOLARIS System" partition.
     
    To select this, please type "y".  To partition your disk
    differently, type "n" and the "fdisk" program will
    let you select other partitions. y
    
  7. Specify n at the prompt if you do not want the Solaris fdisk partition to span the entire disk.


    To select this, please type "y".  To partition your disk
    differently, type "n" and the "fdisk" program will let you
    select other partitions. n
    Total disk size is 2694 cylinders
                 Cylinder size is 765 (512 byte) blocks
                                              Cylinders
        Partition   Status    Type      Start   End   Length    %
        =========   ======    ========  =====   ===   ======   ===
     
    THERE ARE NO PARTITIONS CURRENTLY DEFINED SELECT ONE OF THE
    FOLLOWING:
     
         1.   Create a partition
         2.   Change Active (Boot from) partition
         3.   Delete a partition
         4.   Exit (Update disk configuration and exit)
         5.   Cancel (Exit without updating disk configuration)
    Enter Selection: 
  8. Select option 1, Create a partition, to create an fdisk partition.


                 Total disk size is 2694 cylinders
                 Cylinder size is 765 (512 byte) blocks
                                              Cylinders
        Partition   Status    Type      Start   End   Length    %
        =========   ======    ========  =====   ===   ======   ===
     
    THERE ARE NO PARTITIONS CURRENTLY DEFINED SELECT ONE OF THE
    FOLLOWING:
     
         1.   Create a partition
         2.   Change Active (Boot from) partition
         3.   Delete a partition
         4.   Exit (Update disk configuration and exit)
         5.   Cancel (Exit without updating disk configuration)
    Enter Selection: 1
    
  9. Create a Solaris fdisk partition by selecting 1(=Solaris).


    Indicate the type of partition you want to create
      (1=SOLARIS, 2=UNIX, 3=PCIXOS, 4=Other, 8=DOSBIG)
      (5=DOS12, 6=DOS16, 7=DOSEXT, 0=Exit) ? 1
    
  10. Identify the percentage of disk to be reserved for the Solaris fdisk partition. Keep in mind the size of any existing fdisk partitions when calculating this percentage.


    Indicate the percentage of the disk you want this partition
    to use (or enter "c" to specify in cylinders). nn
    
  11. Activate the Solaris fdisk partition by typing y at the prompt.


    Do you want this to become the Active partition? If so, it will be 
    activated each time you reset your computer or when you turn it on 
    again. Please type "y" or "n". y
    

    The Enter Selection: prompt is displayed afer the fdisk partition is activated.

  12. Select option 1, Create a partition, to create another fdisk partition.

    See steps 9-11 for instructions on creating an fdisk partition.

  13. Update the disk configuration and exit the fdisk menu from the selection menu.


    Selection: 4 
    
  14. Relabel the disk using the label command.


    WARNING: Solaris fdisk partition changed - Please relabel the disk
    format> label
    Ready to label disk, continue? yes
    format> 
  15. Quit the format menu.


    format> quit
    

Where to Go From Here

After you create a Solaris fdisk partition on the disk, you can create slices on the disk. Go to "x86: How to Create Disk Slices and Label a Disk".

x86: Example--Creating a Solaris fdisk Partition That Spans the Entire Drive

The following example uses the format's utility's fdisk option to create a Solaris fdisk partition that spans the entire drive.


# format
Searching for disks...done
 
AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <DEFAULT cyl 1479 alt 2 hd 7 sec 79>
          /eisa/eha@1000,0/cmdk@0,0
       1. c0t2d0 <SUN1.05 cyl 2692 alt 2 hd 9 sec 85>
          /eisa/eha@1000,0/cmdk@2,0
Specify disk (enter its number): 1
selecting c0t2d0
[disk formatted]
format> fdisk
The recommended default partitioning for your disk is:
 
  a 100% "SOLARIS System" partition.
 
To select this, please type "y".  To partition your disk
differently, type "n" and the "fdisk" program will let you
select other partitions. y
 
WARNING: Solaris fdisk partition changed - Please relabel the disk
format> label
Ready to label disk, continue? yes
format> quit

x86: Example--Creating a Solaris fdisk Partition and Preserving an Existing fdisk Partition

The following example describes how to create a Solaris fdisk partition on a disk that has an existing DOS-BIG fdisk partition.


format> fdisk
             Total disk size is 2694 cylinders
             Cylinder size is 765 (512 byte) blocks
                                         Cylinders
     Partition   Status    Type     Start  End   Length    %
     =========   ======   ========  =====   ===   ====== ===
        1                 DOS-BIG       1   538     538   20
SELECT ONE OF THE FOLLOWING:
     1.   Create a partition
     2.   Change Active (Boot from) partition
     3.   Delete a partition
     4.   Exit (Update disk configuration and exit)
     5.   Cancel (Exit without updating disk configuration)
Enter Selection: 1
Indicate the type of partition you want to create
  (1=SOLARIS, 2=UNIX, 3=PCIXOS, 4=Other, 8=DOSBIG)
  (5=DOS12, 6=DOS16, 7=DOSEXT, 0=Exit) ?1
Indicate the percentage of the disk you want this partition
to use (or enter "c" to specify in cylinders). 80
Do you want this to become the Active partition? If so, it will be 
activated each time you reset your computer or when you turn it on 
again. Please type "y" or "n". y
Partition 2 is now the Active partition Total disk size is 2694 
cylinders
             Cylinder size is 765 (512 byte) blocks
                                         Cylinders
    Partition   Status    Type      Start   End   Length    %
    =========   ======    ========  =====   ===   ======   ===
        1                 DOS-BIG       1   538     538     20
        2       Active    SOLARIS     539  2693    2155     80
SELECT ONE OF THE FOLLOWING:
     1.   Create a partition
     2.   Change Active (Boot from) partition
     3.   Delete a partition
     4.   Exit (Update disk configuration and exit)
     5.   Cancel (Exit without updating disk configuration)
Enter Selection: Selection: 4
WARNING: Solaris fdisk partition changed - Please relabel the disk
format> label
Ready to label disk, continue? yes
format> q

x86: Example--Creating a Solaris fdisk Partition and an Additional fdisk Partition

This following example describes how to create a Solaris fdisk partition and a DOSBIG fdisk partition.


format> fdisk
The recommended default partitioning for your disk is:
   a 100% "SOLARIS System" partition.
To select this, please type "y".  To partition your disk
differently, type "n" and the "fdisk" program will let you
select other partitions. n
             Total disk size is 2694 cylinders
             Cylinder size is 765 (512 byte) blocks
                                         Cylinders
    Partition   Status    Type      Start   End   Length    %
    =========   ======    ========  =====   ===   ======   ===
THERE ARE NO PARTITIONS CURRENTLY DEFINED SELECT ONE OF THE FOLLOWING:
     1.   Create a partition
     2.   Change Active (Boot from) partition
     3.   Delete a partition
     4.   Exit (Update disk configuration and exit)
     5.   Cancel (Exit without updating disk configuration)
Enter Selection: 1
Indicate the type of partition you want to create
  (1=SOLARIS, 2=UNIX, 3=PCIXOS, 4=Other, 8=DOSBIG)
  (5=DOS12, 6=DOS16, 7=DOSEXT, 0=Exit) ?8
Indicate the percentage of the disk you want this partition
to use (or enter "c" to specify in cylinders). 20
Do you want this to become the Active partition? If so, it will be 
activated each time you reset your computer or when you turn it on 
again. Please type "y" or "n". n
             Total disk size is 2694 cylinders
             Cylinder size is 765 (512 byte) blocks
                                        Cylinders
    Partition   Status    Type      Start   End   Length    %
    =========   ======    ========  =====   ===   ======   ===
        1                 DOS-BIG       1   538     538     20
SELECT ONE OF THE FOLLOWING:
     1.   Create a partition
     2.   Change Active (Boot from) partition
     3.   Delete a partition
     4.   Exit (Update disk configuration and exit)
     5.   Cancel (Exit without updating disk configuration)Enter
Selection: 1
Indicate the type of partition you want to create
  (1=SOLARIS, 2=UNIX, 3=PCIXOS, 4=Other, 8=DOSBIG)
  (5=DOS12, 6=DOS16, 7=DOSEXT, 0=Exit) ?1
Indicate the percentage of the disk you want this partition
to use (or enter "c" to specify in cylinders). 80
Do you want this to become the Active partition? If so, it will be 
activated each time you reset your computer or when you turn it on 
again. Please type "y" or "n". y
Partition 2 is now the Active partition Total disk size is 2694 
cylinders
            Cylinder size is 765 (512 byte) blocks
                                         Cylinders
    Partition   Status    Type      Start   End   Length    %
    =========   ======    ========  =====   ===   ======   ===
        1                 DOS-BIG       1   538     538     20
        2       Active    SOLARIS     539  2693    2155     80
 
SELECT ONE OF THE FOLLOWING:
     1.   Create a partition
     2.   Change Active (Boot from) partition
     3.   Delete a partition
     4.   Exit (Update disk configuration and exit)
     5.   Cancel (Exit without updating disk configuration)
Enter Selection: 4
format> q

x86: How to Create Disk Slices and Label a Disk

  1. Become superuser.

  2. Start the format utility.


    # format
    
  3. Enter the number of the disk that you want to repartition from the list displayed on your screen.


    Specify disk (enter its number): disk-number
    

    disk-number

    Is the number of the disk that you want to repartition. 

  4. Go into the partition menu (which lets you set up the slices).


    format> partition
    
  5. Display the current partition (slice) table.


    partition> print
    
  6. Start the modification process.


    partition> modify
    
  7. Set the disk to all free hog.


    Choose base (enter number) [0]? 1
    

    See "Using the Free Hog Slice" for more information about the free hog slice.

  8. Create a new partition table by answering yes when prompted to continue.


    Do you wish to continue creating a new partition
    table based on above table[yes]? yes
    
  9. Identify the free hog partition (slice) and the sizes of the slices when prompted.

    When adding a system disk, you must set up slices for:

    • root (slice 0) and swap (slice 1) and/or

    • /usr (slice 6)

    After you identify the slices, the new partition table is displayed.

  10. Make the displayed partition table the current partition table by answering yes when asked.


    Okay to make this the current partition table[yes]? yes
    

    If you don't want the current partition table and you want to change it, answer no and go to Step 6.

  11. Name the partition table.


    Enter table name (remember quotes): "partition-name"
    

    partition-name

    Is the name for the new partition table. 

  12. Label the disk with the new partition table when you have finished allocating slices on the new disk.


    Ready to label disk, continue? yes
    
  13. Quit the partition menu.


    partition> quit
    
  14. Verify the new disk label with verify command.


    format> verify
    
  15. Quit the format menu.


    format> quit
    

Where to Go From Here

After you create disk slices and label the disk, you can create file systems on the disk. Go to "x86: How to Create File Systems".

x86: How to Create File Systems

  1. Become superuser.

  2. Create a file system for each slice with the newfs(1M) command.


    # newfs /dev/rdsk/cwtxdysz
    

    /dev/rdsk/cwtxdysZ

    Raw device for the file system to be created. 

    See Chapter 28, Mounting and Unmounting File Systems (Tasks) for more information about the newfs command.

  3. Verify the new file system by mounting it on an unused mount point.


    # mount /dev/dsk/cwtxdysz /mnt
    # ls /mnt
    lost+found
     

Where to Go From Here

If You Are Adding A ... 

Then ... 

System Disk 

You need to restore the root (/) and /usr file systems on the disk. Go to Chapter 35, Restoring Files and File Systems (Tasks).

After the root (/) and /usr file systems are restored, install the boot block. Go to "x86: How to Install a Boot Block on a System Disk".

Secondary Disk 

You may need to restore file systems on the new disk. Go to Chapter 35, Restoring Files and File Systems (Tasks).

 

If you are not restoring file systems on the new disk, you are finished adding a secondary disk. See Chapter 28, Mounting and Unmounting File Systems (Tasks) for information on making the file systems available to users.

x86: How to Install a Boot Block on a System Disk

  1. Become superuser.

  2. Install the boot block.


    # /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/pboot /usr/platform/`uname -i`
    /lib/fs/ufs/bootblk /dev/rdsk/cwtxdys2
    

    /usr/platform/`uname -i`/lib/fs/ufs/pboot

    Is the partition boot file. 

    /usr/platform/`uname -i`/lib/fs/ufs/bootblk

    Is the boot block code. 

    /dev/rdsk/cwtxdys2

    Is the raw device name that represents the whole disk. 

  3. Verify the boot blocks are installed by rebooting the system to run level 3.


    # init 6
    

x86: Example--Installing a Boot Block on a System Disk


# /usr/sbin/installboot /usr/platform/i86pc/lib/fs/ufs/pboot
 /usr/platform/i86pc/lib/fs/ufs/bootblk /dev/rdsk/c0t6d0s2

Chapter 25 The format Utility (Reference)

This chapter describes the format utility's menu and commands.

This is a list of the overview information in this chapter.

See Chapter 21, Disk Management (Overview) for a conceptual overview of when to use the format utility.

Requirements or Restrictions for Using the format Utility

You must be superuser to use the format utility. If you are not superuser, you will see the following error message when you try to use format.


% format
	Searching for disk...done
 
	No permission (or no disk found)!

Recommendations for Preserving Information When Using format

Format Menu and Command Descriptions

The format main menu looks like the following:


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
        quit
format> 

Table 25-1 describes the format main menu items.

Table 25-1 The format Main Menu Item Descriptions

Item 

Command or Menu? 

Allows You To ... 

disk

Command 

Choose the disk that will be used in subsequent operations (known as the current disk). All of the system's drives are listed. 

type

Command 

Identify the manufacturer and model of the current disk. A list of known drive types is displayed. Choose the Auto configure option for all SCSI-2 disk drives.

partition

Menu 

Create and modify slices. See "The partition Menu" for more information.

current

Command 

Display the following information about the current disk: 

  • Device name and type

  • Number of cylinders, alternate cylinders, heads and sectors

  • Physical device name

format

Command 

Format the current disk, using one of these sources of information in this order: 

  1. Information found in the format.dat file

  2. Information from the automatic configuration process

  3. Information you enter at the prompt if there is no format.dat entry

fdisk

Menu 

Run the fdisk program to create a Solaris fdisk partition.

repair

Command 

Repair a specific block on the disk. 

label

Command 

Write a new label to the current disk. 

analyze

Menu 

Run read, write, compare tests. See "The analyze Menu" for more information.

defect

Menu 

Retrieve and print defect lists. See "The defect Menu" for more information.

backup

Command 

Search for backup labels. 

verify

Command 

Print the following information about the disk: 

  • Device name and type

  • Number of cylinders, alternate cylinders, heads and sectors

  • Partition table

save

Command 

Save new disk and partition information. 

inquiry

Command 

Print the vendor, product name, and revision level of the current drive (SCSI disks only). 

volname

Command 

Label the disk with a new eight-character volume name. 

quit

Command 

Exit the format menu.

The partition Menu

The partition menu looks like this.


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
        quit
partition> 

Table 25-2 describes the partition menu items.

Table 25-2 The partition Menu Item Descriptions

The Command ... 

Allows You To ... 

change `x' partition

Specify new slice: 

  • Identification tag

  • Permission flags

  • Starting cylinder

  • Size

select

Choose a predefined slice table. 

modify

Change all the slices in the slice table. This command is preferred over the individual change `x' partition commands.

name

Specify a name for the current slice table. 

print

View the current slice table. 

label

Write the slice map and label to the current disk. 

quit

Exit the partition menu.

x86: The fdisk Menu

The fdisk menu appears on x86 systems only and looks like this.


format> fdisk
             Total disk size is 1855 cylinders
             Cylinder size is 553 (512 byte) blocks
                                           Cylinders
      Partition   Status    Type      Start   End   Length    %
      =========   ======    ========  =====   ===   ======   ===
          1                 DOS-BIG       0   370     371     20
          2       Active    SOLARIS     370  1851    1482     80
 
SELECT ONE OF THE FOLLOWING:
 
     1.   Create a partition
     2.   Change Active (Boot from) partition
     3.   Delete a partition
     4.   Exit (Update disk configuration and exit)
     5.   Cancel (Exit without updating disk configuration)
Enter Selection: 

Table 25-3 describes the fdisk menu items.

Table 25-3 The fdisk Menu Item Descriptions

The Command ... 

Allows You To ... 

Create a partition

Create an fdisk partition. You must create a separate partition for each operating environment such as Solaris or DOS. There is a maximum of 4 partitions per disk. You will be prompted for the size of the fdisk partition as a percentage of the disk.

Change Active partition

Specify which partition will be used for booting. This identifies where the first stage boot program will look for the second stage boot program. 

Delete a partition

Delete a previously created partition. This command will destroy all the data in the partition. 

Exit

Write a new version of the partition table and exit the fdisk menu.

Cancel

Exit the fdisk menu without modifying the partition table.

The analyze Menu

The analyze menu looks like this.


format> analyze
 
ANALYZE MENU:
    read     - read only test   (doesn't harm SunOS)
    refresh  - read then write  (doesn't harm data)
    test     - pattern testing  (doesn't harm data)
    write    - write then read      (corrupts data)
    compare  - write, read, compare (corrupts data)
    purge    - write, read, write   (corrupts data)
    verify   - write entire disk, then verify (corrupts data)
    print    - display data buffer
    setup    - set analysis parameters
    config   - show analysis parameters
    quit
analyze> 

Table 25-4 describes the analyze menu items.

Table 25-4 The analyze Menu Item Descriptions

The Command ... 

Allows You To ... 

read

Read each sector on this disk. Repairs defective blocks as a default. 

refresh

Read then write data on the disk without harming the data. Repairs defective blocks as a default. 

test

Write a set of patterns to the disk without harming the data. Repairs defective blocks as a default. 

write

Write a set of patterns to the disk then read the data on the disk back. Destroys existing data on the disk. Repairs defective blocks as a default. 

compare

Write a set of patterns to the disk, read the data back, and compare it to the data in the write buffer. Destroys existing data on the disk. Repairs defective blocks as a default. 

purge

Remove all data from the disk so that the data can't be retrieved by any means. Data is removed by writing three distinct patterns over the entire disk (or section of the disk), then writing an hex-bit pattern if the verification passes. 

Repairs defective blocks as a default. 

verify

Write unique data to each block on the entire disk in the first pass. Read and verify the data in the next pass. Destroys existing data on the disk. Repairs defective blocks as a default. 

print

View the data in the read/write buffer. 

setup

Specify the following analysis parameters 

Analyze entire disk? yes
Starting block number: depends on drive
Ending block number: depends on drive
Loop continuously? no
Number of passes: 2
	Repair defective blocks? yes
Stop after first error? no
Use random bit patterns? no
Number of blocks per transfer: 126 (0/n/nn)
Verify media after formatting? yes
Enable extended messages? no
Restore defect list? yes
Restore disk label? yes

Defaults are shown in bold. 

config

View the current analysis parameters. 

quit

Exit the analyze menu.

The defect Menu

The defect menu looks like this.


format> defect
 
DEFECT MENU:
        primary  - extract manufacturer's defect list
        grown    - extract manufacturer's and repaired defects lists
        both     - extract both primary and grown defects lists
        print    - display working list
        dump     - dump working list to file
        quit
defect> 

Table 25-5 describes the defect menu items.

Table 25-5 The defect Menu Item Descriptions

The Command ... 

Allows You To ... 

primary

Read the manufacturer's defect list from the disk drive and update the in-memory defect list. 

grown

Read the grown defect list (defects that have been detected during analysis) and update the in-memory defect list. 

both

Read both the manufacturer's and grown defect list and update the in-memory defect list. 

print

View the in-memory defect list. 

dump

Save the in-memory defect list to a file. 

quit

Exit the defect menu.

Files Used by format--format.dat

The format data file, /etc/format.dat, contains:

The format.dat file shipped with the Solaris operating environment supports many standard disks. If your disk drive is not listed in the format.dat file, you can choose to add an entry for it or allow format to prompt you for the information it needs while it is performing operations.

Adding an entry to the format.dat file can save time if the disk drive will be used throughout your site. To use the format.dat file on other systems, copy the file to each system that will use the specific disk drive you added to the format.dat file.

You should modify the data file for your system if you have one of the following:


Note -

Do not alter default entries. If you want to alter the default entries, copy the entry, give it a different name, and make the modification to avoid confusion.


Structure

The format.dat contains specific disk drive information used by the format utility. Three items are defined in the format.dat file:

Syntax

The following syntax rules apply to the data file:

Keywords

The data file contains disk definitions that are read in by format when it is started. Each definition starts with one of the following keywords: search_path, disk_type, and partition, which are described in Table 25-6.

Table 25-6 format.dat Keyword Descriptions

Keyword 

Use 

search_path

This keyword is no longer used in the format.dat file. Starting with the Solaris 2.0 release, the format utility searchs the logical device hierarchy (/dev)so there is no need to set this keyword to find a system's disks.

disk_type

Defines the controller and disk model. Each disk_type definition contains information concerning the physical geometry of the disk. The default data file contains definitions for the controllers and disks that the Solaris operating environment supports. You need to add a new disk_type only if you have an unsupported disk. You can add as many disk_type definitions to the data file as you want.

partition

Defines a slice table for a specific disk type. The slice table contains the slice information, plus a name that lets you refer to it in format. The default data file contains default slice definitions for several kinds of disk drives. Add a slice definition if you recreated slices on any of the disks on your system. Add as many slice definitions to the data file as you need.

Disk Type

disk_type defines the controller and disk model. Each disk_type definition contains the physical geometry of the disk. The default data file contains definitions for the controllers and disks that the Solaris operating environment supports. You need to add a new disk_type only if you have an unsupported disk. You can add as many disk_type definitions to the data file as you want.

The keyword itself is assigned the name of the disk type. This name appears in the disk's label, and is used to identify the disk type whenever format is run. Enclose the name in double quotes to preserve any white space in the name. Table 25-7 describes the identifiers that must also be assigned values in all disk_type definitions.

Table 25-7 Required disk_type Identifiers

Identifier 

Description 

ctlr

Valid controller type for the disk type. Currently, the supported values for this assignment are SCSI and ISP-80 (IPI controller).  

ncyl

The number of data cylinders in the disk type. This determines how many logical cylinders of the disk the system will be allowed to access.  

acyl

The number of alternate cylinders in the disk type. These cylinders are used by format to store information such as the defect list for the drive. You should always leave at least two cylinders for alternates.

pcyl

The number of physical cylinders in the disk type. This number is used to calculate the boundaries of the disk media. This number is usually equal to ncyl plus acyl.

nhead

The number of heads in the disk type. This number is used to calculate the boundaries of the disk media.  

nsect

The number of data sectors per track in the disk type. This number is used to calculate the boundaries of the disk media. Note that this is only the data sectors, any spares are not reflected in the assignment.  

rpm

The rotations per minute of the disk type. This information is put in the label and later used by the file system to calculate the optimal placement of file data.  

Other assignments may be necessary depending on the controller. Table 25-8 describes the assignments required for SCSI controllers.

Table 25-8 disk_type Identifiers for SCSI Controllers

Identifier 

Description 

fmt_time

A number indicating how long it takes to format a given drive. See the controller manual for more information.  

cache

A number that controls the operation of the onboard cache while format is operating. See the controller manual for more information.

trks_zone

A number that specified how many tracks you have per defect zone, to be used in alternate sector mapping. See the controller manual for more information.  

asect

The number assigned to this parameter specifies how many sectors are available for alternate mapping within a given defect zone. See the controller manual for more information.  

Below are some examples of disk_type definitions:


disk_type = "SUN0535" \
	: ctlr = SCSI : fmt_time = 4 \
	: ncyl = 1866 : acyl = 2 : pcyl = 2500 : nhead = 7 : nsect = 80 \
	: rpm = 5400
disk_type = "SUN0669" \
	: ctlr = SCSI : fmt_time = 4 \
	: trks_zone = 15 : asect = 5 : atrks = 30 \
	: ncyl =  1614 : acyl = 2 : pcyl = 1632 : nhead = 15 : nsect = 54 \
	: rpm = 3600 : bpt = 31410
disk_type = "SUN1.0G" \
	: ctlr = SCSI : fmt_time = 4 \
	: trks_zone = 15 : asect = 5 : atrks = 30 \
	: ncyl =  1703 : acyl = 2 : pcyl = 1931 : nhead = 15 : nsect = 80 \
	: rpm = 3597 : bpt = 41301

Slice Tables

A partition definition keyword is assigned the name of the slice table. Enclose the name in double quotes to preserve any white space in the name. Table 25-9 describes the identifiers that must be assigned values in all slice tables.

Table 25-9 Required Identifiers for Slice Tables

Identifier 

Description 

disk

The name of the disk_type that this slice table is defined for. This name must appear exactly as it does in the disk_type definition.

ctlr

The disk controller type this slice table can be attached to. Currently, the supported values for this assignment are ISP-80 for IPI controllers and SCSI for SCSI controllers. The controller type specified here must also be defined for the disk_type chosen above.

The other assignments in a slice definition describe the actual slice information. The identifiers are the numbers 0 through 7. These assignments are optional. Any slice not explicitly assigned is set to 0 length. The value of each of these assignments is a pair of numbers separated by a comma. The first number is the starting cylinder for the slice, and the second is the number of sectors in the slice. Below are some examples of slice definitions:


partition = "SUN0535" \
	: disk = "SUN0535" : ctlr = SCSI \
	: 0 = 0, 64400 : 1 = 115, 103600 : 2 = 0, 1044960 : 6 = 300, 876960
partition = "SUN0669" \
	: disk = "SUN0669" : ctlr = SCSI \
	: 0 = 0, 32400 : 1 = 40, 64800 : 2 = 0, 1307340 : 6 = 120, 1210140
partition = "SUN1.0G" \
	: disk = "SUN1.0G" : ctlr = SCSI \
	: 0 = 0, 32400 : 1 = 27, 64800 : 2 = 0, 2043600 : 6 = 81, 1946400

Location

The format utility learns of the location of your data file by the following methods.

  1. If a filename is given with the -x command line option, that file is always used as the data file.

  2. If the -x option is not specified, then format looks in the current directory for a file named format.dat. If the file exists, it is used as the data file.

  3. If neither of these methods yields a data file, format uses /etc/format.dat as the data file. This file is shipped with the Solaris operating environment and should always be present.

Rules for Input to format Commands

When using the format utility, you need to provide various kinds of information. This section describes the rules for this information. See "Help" for information on using format's help facility when inputting data.

Numbers

Several places in format require an integer as input. You must either specify the data or select one from a list of choices. In either case, the help facility causes format to print the upper and lower limits of the integer expected. Simply enter the number desired. The number is assumed to be in decimal format unless a base is explicitly specified as part of the number (for example, 0x for hexadecimal).

The following are examples of integer input:

Enter number of passes [2]: 34
Enter number of passes [34] Oxf 

Block Numbers

Whenever you are required to specify a disk block number, there are two ways to input the information:

You can specify the information as an integer representing the logical block number. You can specify the integer in any base, but the default is decimal. The maximum operator (a dollar sign, $) can also be used here to let format select the appropriate value. Logical block format is used by the SunOS disk drivers in error messages.

The other way to specify a block number is by the cylinder/head/sector designation. In this method, you must specify explicitly the three logical components of the block number: the cylinder, head, and sector values. These values are still logical, but they allow you to define regions of the disk related to the layout of the media.

If any of the cylinder/head/sector numbers are not specified, the appropriate value is assumed to be zero. You can also use the maximum operator in place of any of the numbers and let format select the appropriate value. Below are some examples of cylinder, head, and sector entries:

Enter defective block number: 34/2/3
Enter defective block number: 23/1/
Enter defective block number: 457//
Enter defective block number: 12345
Enter defective block number: Oxabcd
Enter defective block number: 334/$/2
Enter defective block number: 892//$

The format utility always prints block numbers, in both of the above formats. Also, the help facility shows you the upper and lower bounds of the block number expected, in both formats.

Command Names

Command names are needed as input whenever format is displaying a menu prompt. You can abbreviate the command names, as long as what you enter is sufficient to uniquely identify the command desired.

For example, use p to enter the partition menu from the format menu. Then enter p to display the current slice table.


format> p
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
        quit
partition> p

Other Names

There are certain times in format when you must name something. In these cases, you are free to specify any string desired for the name. If the name has white space in it, the entire name must be enclosed in double quotes ("). Otherwise, only the first word of the name is used.

Help

The format utility provides a help facility you can use whenever format is expecting input. You can request help about what information is expected by entering a question mark (?). The format utility displays a brief description of what type of input is needed.

If you enter a ? at a menu prompt, a list of available commands is displayed.

Associated Man Pages

The man pages associated with the format utility is format(1M), which describes the basic format utility capabilities and provides descriptions of all command line variables, and format.dat(4), which describes disk drive configuration information for the format utility.