UNIX System Administration Handbook - Evi Nemeth [84]
8.3 AN OVERVIEW OF THE DISK INSTALLATION PROCEDURE
The procedure for adding a new disk involves the following steps:
• Connecting the disk to the computer
• Creating device files through which the disk can be accessed
• Formatting the disk
• Labeling and partitioning the disk
• Establishing logical volumes
• Creating UNIX filesystems within disk partitions
• Setting up automatic mounting
• Setting up swapping on swap partitions
The following sections describe the process in general, without reference to any particular vendor’s peculiarities. Starting on page 138, we describe the exact procedure for our four example systems.
Connecting the disk
The way a disk is attached to the system depends mostly on the interface that is used. The rest is all mounting brackets and cabling. If the disk is IDE, try to configure the system with only one IDE disk per bus. Double-check your cable orientation and the master/slave settings on each disk. If the disk is SCSI, double-check that you have properly terminated both ends of the SCSI bus, that the cable length is less than the maximum appropriate for the SCSI variant you are using, and that the new SCSI target does not conflict with the controller or another device on the bus. For more details, see the system-specific sections toward the end of this chapter.
Creating device entries
Before you can access a new disk, you need device files in /dev that point to it. You will need both block device files (generally used for mounting filesystems) and character device files (used for backing up and checking the integrity of filesystems). Many versions of UNIX automatically create files for all possible SCSI devices; details start on page 138.
See Chapter 12 for more information about device files.
It is possible to destroy a filesystem in seconds by writing randomly on the disk, so you should set the permissions on disk device files quite restrictively. We allow read and write access for the owner (root) and read access for the group owner (operator); this setup allows dump to be run by operators without superuser privileges but prevents mere mortals from reading from the raw device.
Formatting the disk
Overeager vendors often quote disk capacities in terms of the number of unformatted bytes. About 10% of that capacity is typically used up to mark the disk surfaces so that the hardware and software can find the data that is written there. When purchasing disks, always think in terms of formatted size and compare prices accordingly.
Another common trick is to quote disk sizes in “megabytes” that are really millions of bytes. In the context of computer systems, a megabyte is actually 220 or 1,048,576 bytes. Using the 1MB = 1,000,000 byte convention overstates the capacity of a disk drive by almost 5%.6 Be sure to check your units when comparing disk capacities.
The formatting process writes address information and timing marks on the platters to delineate each sector. It also identifies “bad blocks,” imperfections in the media that result in areas that cannot be reliably read or written. On older disks (including SMD disks), the UNIX device driver is responsible for understanding bad blocks and mapping them to replacement blocks elsewhere on the disk. SCSI disks have bad block management built in, so neither you nor the driver need to worry about it.7
All hard disks come preformatted, and the factory formatting is often more precise than any formatting you can do in the field. It is best to avoid doing a low-level format if it is not required. If you encounter read or write errors on a disk, first check for cabling, termination, and address problems, which can cause symptoms similar to those of a bad block. If after this procedure you are still convinced that the disk is bad, you might be better off to replace it with a new one rather than waiting long hours for a format to complete.
IDE disks are usually