Exam Objective 2.4: Given a scenario, partition a disk correctly using the appropriate files, commands, and options, and manage disk labels using SMI and EFI labels as they relate to disk sets.
A disk can, and often does, hold a number of file systems. Each file system occupies its own space on the disk, called a slice or a partition. In this section, we will explore what partitions are, how the partition information is stored on the disk, and how a disk is actually partitioned.
As you already know from the previous chapter, a file lives inside a file system. Each file system, in turn, resides in a specific part of the disk called a slice, or a partition. In other words, a slice (or a partition) is a group of cylinders of the disk set aside for use by a specific file system.
You might be wondering, is it a slice or a partition? As you noticed in the previous section, the logical device name still uses "s" in it to refer to a slice on the disk. Slices were called partitions in Solaris 4.x, and as you see in the exam objectives for Solaris 10, they are called partitions as well. In this book, we will be using these two terms interchangeably. Having said that, no confusion is permitted on this issue.
The location of a disk slice is defined by two elements: an offset that specifies the distance from cylinder 0 to mark the beginning of the slice, and a size in cylinders to mark the end of the slice. Usually, the administrator provides the first cylinder and the last cylinder while using a utility to partition a disk. In order to manage slices effectively, remember the following rules about them:
Each disk slice can hold only one file system.
Each file system can reside only on one slice (i.e., a file system cannot span multiple slices).
A slice cannot span multiple disks.
Once you have created a file system on a slice, its size cannot be changed without destroying it—that is, repartitioning it.
Table 5-2 presents a comparison between disk slices on SPARC and x86 systems. On an x86 system, a disk can be divided into 10 fdisk partitions numbered 0 to 9, an fdisk partition being a slice of the disk reserved for a specific OS. Table 5-3 describes the slices that may be found on a Solaris system.
Feature | SPARC | x86 |
---|---|---|
Multiple booting | Entire disk is dedicated to Solaris OS. | You can divide the disk into fdisk partitions, one partition per OS. |
Volume Table of Contents (VTOC) disk | Disk is divided into 8 slices numbered 0 to 7. | Disk is divided into 10 slices numbered 0 to 9. |
Extensible Firmware Interface (EFI) disk. | Disk is divided into 7 slices numbered 0 to 6. | Disk is divided into 7 slices numbered 0 to 6. |
Slice | File System | Content |
---|---|---|
0 | / (root) | Files and directories that make up the OS. |
1 | swap | Provides space on the disk to be used as virtual memory. |
2 | — | In a disk with a VTOC label, this is reserved for referring to the entire disk, and its size should no be changed. In a disk with an EFI label, you can use it as you wish. |
3 | For example: /export | Optional slice; you can use it based on your site's need. |
4 | — | Optional slice; you can use it based on your site's need. |
5 | For example: /opt | Optional slice; you can use it based on your site's need. |
6 | /usr | System-related commands, programs, and library routines. |
7 | Standalone system: /home Server: /export /home | Files created by individual users. |
8 | — | VTOC: NA On EFI: reserved slice created by default; do not modify it or delete it. It is similar to slice 9 on VTOC. |
9 | For x86 only | VTOC: Known as alternate sector slice; reserved for alternate disk blocks. EFI: NA. |
Once you partition a disk, you need to make this information available to the operating system, and you do that by labeling the disk, which we explore next.
In a VTOC disk, slice 2 is reserved for referring to the entire disk, while in an EFI disk, you can use it to meet your needs. Furthermore, you cannot boot a system using a disk with an EFI label.
A disk label is the information about the disk's controller, geometry, and slices. A special area is set aside on each disk to store this information. The process of storing the slice information into this area is called disk labeling. You store this information after you create slices, and if you fail to do so, the OS will have no way to find out about the slices. An important component of a disk label is called a partition table, which identifies each slice, its boundaries by cylinders, and its size.
In order to provide support for multiterabyte disks, Solaris offers the Extensible Firmware Interface (EFI) disk label for both 64-bit and 32-bit Solaris kernels. The EFI label differs from the VTOC label in the following ways:
It provides support for disks greater than one terabyte in size.
It provides seven slices numbered from 0 to 6, all of them being usable—that is, slice 2 is just another slice.
A slice cannot overlap with the label or with another slice. That means the first slice will start at sector 34, because the size of the EFI label is typically 34 sectors.
The unit for reporting sizes is a block.
The EFI label does not contain any cylinder, head, or sector information.
The information that was stored in the last two cylinders of the disk is stored in slice 8 of an EFI disk.
If you use the format utility to change the partition sizes, the unassigned partition tag will be assigned to partitions with size equal to zero. The format utility assigns, by default, the /usr tag to any slice with a size greater than zero. Although you can reassign the partition tags by using the partition change menu, you cannot change a partition with non-zero size to the unassigned tag.
Sector 0 on a VTOC disk is reserved for storing the label, and the first 34 sectors of an EFI disk are used for the label. Therefore, you cannot include these sectors in the slices.
The /etc/format.dat file contains the list of predefined partition tables that can be used by the format utility.
Let's explore how the disks are actually partitioned.
When you install the Solaris system, disk drives are partitioned and labeled by the Solaris installation utility. After the system has been installed, you can use the format utility to perform low-level formatting, partitioning, and labeling on additional disks, along with many other tasks. You will mostly be using the format utility just to partition a disk, because the low-level formatting on the disk usually has already been performed. To partition a disk, you will perform the following steps:
Determine which slices are needed.
Determine the size of each slice.
Partition the disk by using the format utility.
Label the disk with the new partition information.
Create the file system for each partition.
The easiest way to partition a disk is to select the partition option provided by the format command, and then select the modify option from the partition menu. The modify command helps you in two ways:
It allows you to create partitions by specifying the size of each partition without having to keep track of the cylinder boundaries.
The modify command also keeps track of any disk space that remains in the free hog slice.
The free hog slice is a temporary slice that automatically expands and shrinks to accommodate the unused disk space during slice-resizing operations. The format utility is used by issuing the format command, which has the following syntax:
format [<options>] <deviceNames>
The <deviceNames> is a list of raw disk logical device names such as /dev/rdsk/c<k>t<l>d<m>s<n>. Following are some typical options for the format command:
-d <deviceName>. The logical device name from the list specified by <deviceNames>; this disk will become the current disk for the utility to work on. You do not need this option if <deviceNames> contain only one disk name.
-f <commandFile>. Take input to the format command from the file specified by <commandFile>, not from the standard input.
-l <logFile>. Create a log of your format session and save it in the file whose name is specified by <logFile>.
-m. Enable more detailed error messages. This option is useful when you are getting an error message and want to probe deeper.
-M. Enable diagnostic messages in addition to everything that -m option does.
-s. Suppress all the output.
When you issue the format command, it displays a long menu that includes the tasks listed in Table 5-4.
Task | Description |
---|---|
analyze | Perform surface analysis on the disk. |
current | Display the information about the current disk: device name, path name to the disk device, and disk geometry. |
defect | Display defect list. Supported only for SCSI devices. |
disk | Select a disk to format. |
fdisk | Run the fdisk utility to create an fdisk partition on an x86 system. |
format | Do the low-level formatting on SCSI disks. IDE disks are preformatted by their manufacturers. |
inquiry | Display the product name, vendor name, and revision level of the current disk. |
label | Write label to the current disk. |
partition | Create and modify slices. |
repair | Repair a specific sector on a disk. |
save | Save new disk and slice information. |
type | Select and define the disk type. |
verify | Display labels. |
volname | Assign an 8-character volume name to the disk. |
The IDE disks have low-level formatting already performed on them by the manufacturer. You may, however, need to perform low-level formatting on the SCSI disks before you can partition them. You can do this by selecting the format option from the format command menu.
On the Job | When you are running the format utility, do not select the system, otherwise you will delete the OS and lose the data on the disk. |
From time to time you will need to know which devices are connected to the system or which devices the system recognizes. Furthermore, when the system is up and running you will want it to recognize a newly added device. Now, let's explore how to list devices on a Solaris system and how to reconfigure the devices.