Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [85]

By Root 2632 0
not designed to be formatted outside of the factory. However, you may be able to get special formatting software from the manufacturer, usually for Windows. Make sure the software matches the drive you plan to format and follow the manufacturer’s directions carefully.

SCSI disks format themselves in response to a command that you send from the host computer. The procedure for sending this command varies from system to system. On PCs, you can often send the command from the SCSI controller’s BIOS. Use the format command on Solaris and the mediainit command on HP-UX.

Some systems let you verify the integrity of a disk by writing random patterns onto it and then reading them back. This process is very time consuming, so unless you suspect that the disk is bad or you bill by the hour, you may want to skip it. Barring that, let the tests run overnight. Don’t be concerned about “wearing out” a disk with overuse or aggressive testing. Disks are designed to withstand constant activity.

Labeling and partitioning the disk

After a disk has been formatted and its bad sectors remapped, it must be divided into chunks called partitions or slices. Partitioning allows the disk to be treated as a group of independent data areas rather than as one vast expanse of blocks. Partitioning also allows “bonus” items such as the boot blocks and the partition table itself to be hidden from high-level software (e.g., the filesystem). Only the device driver knows about the layout of the entire disk; other software works with the cleaned-up abstraction of partitions.

Partitions make backups easier, prevent users from poaching each other’s disk space, improve performance, and confine potential damage from runaway programs. On most operating systems, the partition table is kept on the disk in a record called the label. The label usually occupies the first few blocks of the disk. Its exact contents vary, but it generally contains enough information to get the system booting.

Partitions are, in concept, distinct and separate from one another. However, almost all systems define one partition to be an image of the entire disk. That way, user-level commands can access the disk “directly” through a normal device file. For example, a user-level process could write the disk’s label or duplicate its contents to a backup disk by using the dd command. Of course, this special partition must be used carefully, since it allows every partition on the disk to be screwed up at once.

Some systems go even farther down this treacherous path and allow you to define multiple overlapping sets of partitions. For example, partitions 0, 1, and 2 might divide up the disk one way, while partitions 3 and 4 do it another way. You’re expected to use one set of self-consistent partitions and simply ignore the others. In real life, such overlapping partitions invite operator errors and are a common cause of random data corruption.

Modern systems tend to use fewer partitions than their predecessors, but on most systems you will have at least the following three.

• The root partition: Everything needed to bring the system up to single-user mode is kept here. A second copy of this partition is often stored on another disk for emergencies.

• The swap partition: A swap area stores pages of virtual memory when not enough physical memory is available to hold them. Every system should have at least one swap partition. See page 760 for more information about virtual memory.

• The user partition: Home directories, data files, source code libraries, and other random data files find a home here.

Opinions differ on the best way to split disks into partitions. Here are some hints:

• If you have multiple disks, make a copy of the root filesystem on one of them and verify that you can boot from it.

• As you add memory to your machine, you should also add swap space. For normal use, you should have at least as much swap space as real memory. This amount of swap allows a kernel crash dump to fit in the swap area in the event of a system panic.

• Splitting swap space among

Return Main Page Previous Page Next Page

®Online Book Reader