Download presentation
Presentation is loading. Please wait.
1
Adding a Disk Chapter 8
2
Introduction There is never enough disk space.
Therefore, an administrator will occasionally have to install new disk drives. This chapter begins with a general discussion of the SCSI and IDE standards and a structure of modern hard disks. Then there is a discussion of the general mechanisms by which disks are formatted and partitioned and the procedure for initializing filesystems. Chapter 8 - Adding a Disk
3
1. Disk Interfaces SCSI IDE
One of the most common and widely supported disk interfaces. It comes in several flavors, all of which support multiple disks on a bus and various speeds and communication styles. (covered in the next section) IDE Developed as a simple, low-cost interface for PCs Medium in speed, high in capacity, and unbelievably cheap. Chapter 8 - Adding a Disk
4
1. Disk Interfaces Fibre Channel USB
A serial interface gaining popularity due to high bandwidth (>100MB/s) and to the large number of devices that can be attached to it at once. USB Has become popular for connecting such devices as keyboards and mice, but it has enough bandwidth to support slower disk devices such as removable hard disks and CD-ROM drives. Chapter 8 - Adding a Disk
5
1. Disk Interfaces The SCSI interface
SCSI defines a generic data pipe that can be used by all kinds of peripherals. Most commonly it is used for disks, tape drives, scanners, and printers. The standard does not specify how a disk is constructed or laid out, only the manner in which it communicates with other devices. Chapter 8 - Adding a Disk
6
1. Disk Interfaces The SCSI standard has been through several revisions SCSI-1 (1986) ANSI standard based upon Shuggart and Associates System Interface (SASI) SCSI-2 (1990) Backwards compatible. Added several performance features - command queuing, Scatter-Gather DMA Fast and Wide options (bus speed, data path, # of devices) SCSI-3 (in committee) Family of standards (including FireWire) Chapter 8 - Adding a Disk
7
1. Disk Interfaces Chapter 8 - Adding a Disk
8
1. Disk Interfaces Note: the connectors on SCSI devices are almost always female, and the ends of the cables are male. SCSI busses use a daisy chain configuration. Chapter 8 - Adding a Disk
9
1. Disk Interfaces Each device has a SCSI “target number” that distinguish it from other devices on the bus. The controller itself counts as a device and is usually target 7 - forgetting this (and using 7 for some device) is a common error. Chapter 8 - Adding a Disk
10
1. Disk Interfaces The IDE interface
IDE, also called ATA (for AT attachment), was designed to be simple and inexpensive. It is most often found on PCs or low cost workstations. The controller is built into the disk, which reduces interface costs and simplifies firmware. IDE became popular in the 1980s Chapter 8 - Adding a Disk
11
1. Disk Interfaces ATA-2 added
Faster Programmed I/O (PIO) and Direct Memory Access (DMA) modes Logical Block Addressing (LBA) to allow disks bigger than 504MB ATA-3 adds additional reliability, more sophisticated power management, and self-monitoring capabilities ATA-4 is under development Chapter 8 - Adding a Disk
12
1. Disk Interfaces IDE disks are almost always used internally
Max cable length is 18 inches Max drives per IDE bus port is 2 This is why most motherboards include multiple IDE busses IDE devices are accessed in a connected manner Only one device can be active at a time. Therefore spread devices across multiple buses Fast devices (disks) on one bus and slow (tape, CD) on another. Chapter 8 - Adding a Disk
13
1. Disk Interfaces Which is better, SCSI or IDE? SCSI is better
in all things except the cost. In some situations SCSI is advisable (or mandatory): Servers and multiuser systems Many devices You can’t build a hot-swappable disk array out of IDE drives Chapter 8 - Adding a Disk
14
2. Disk geometry Def: Platter Surface Cylinder Sector Head
Chapter 8 - Adding a Disk
15
3. An overview of the disk installation procedure
The procedure involves: 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 the disk partitions. Setting up automatic mounting Setting up swapping and swap partitions Chapter 8 - Adding a Disk
16
3. An overview of the disk installation procedure
Connecting the disk The way it is done depends mostly on the interface that is used. IDE Try one drive per bus Double check cable orientation SCSI Check proper termination of both ends of the SCSI bus Check SCSI device # for conflicts. Chapter 8 - Adding a Disk
17
3. An overview of the disk installation procedure
Creating device entries (Chapter 12 covers this more in depth) Before you can access a new disk, you need files in /dev that point to it. It is possible to destroy a filesystem in seconds by writing randomly to it, so check permissions on the devices. Read and Write to the owner (root) Read for group (operator) Allows dump to work Chapter 8 - Adding a Disk
18
3. An overview of the disk installation procedure
Formatting the disk Note – approximately 10% of the raw disk is taken up by the hardware and software to mark the disk and know what is written where. Formatting writes address information and timing marks on the platters to delineate each sector. It also identifies “bad blocks” SCSI disks deal with bad block management at the formatting level. Some systems let you verify the integrity of a disk by writing random patterns to it and then reading them back This process is very time consuming Chapter 8 - Adding a Disk
19
3. An overview of the disk installation procedure
Labeling and partitioning the disk After a disk has been formatted, it must be divided into chunks called partitions (or slices) Partitions: Make backups easier Confine potential damage from runaway programs. Prevents users from poaching each other’s disk space. Chapter 8 - Adding a Disk
20
3. An overview of the disk installation procedure
Modern systems tend to use fewer partitions than their predecessors, but most will have at least the following three The root partition Everything needed to bring the machine up in single user mode. A second copy of this partition is often stored on another disk for emergencies. The swap partition Disk space for virtual memory The user partition Home directories, data files, source code libraries, … Chapter 8 - Adding a Disk
21
3. An overview of the disk installation procedure
Hints: Swap – you should have as much swap as real memory Splitting swap space among several disks increases performance If you intend to back up a partition, don’t make it bigger than the capacity of your backup device. It is a good idea to create a separate filesystem ( /tmp) for temporary files because it limits the files to a finite size and saves you from having to back them up. If your system keeps log files in /var, it is a good idea for /var to be a separate partition. Chapter 8 - Adding a Disk
22
3. An overview of the disk installation procedure
Establishing logical volumes The goal is to group multiple disks or partitions into a logical volume or meta disk. There are different ways to put them together Concatenation Striping RAID (5) Mirroring is another common feature of volume managers. Chapter 8 - Adding a Disk
23
3. An overview of the disk installation procedure
Creating UNIX filesystems To install a filesystem within a disk partition, you can either use newfs or mkfs. newfs is actually just a friendly front end for mkfs. A BSD filesystem consists of 5 components A set of inode storage cells A set of scattered “superblocks” A map of the disk blocks in the filesystem A block usage summary A set of data blocks Chapter 8 - Adding a Disk
24
3. An overview of the disk installation procedure
inodes – determines the number of files – set aside when the filesystem is made. superblocks Contains information about the characteristics of the filesystem Length of a disk block; Size and location of inode tables; the disk block map and usage information; the size of the cylinder groups; and a few other pieces of important information. Because damage to this can mess things up, several copies are maintained in scattered locations (block 32 always holds a backup) Chapter 8 - Adding a Disk
25
3. An overview of the disk installation procedure
For each mounted filesystem, UNIX keeps both an in-memory copy of the superblock and several on-disk copies. The sync system call flushes the cached superblocks to their permanent homes on disk, making the filesystem consistent for a split second. Sync also flushes modified inodes and cached data blocks. Most systems perform a sync every 30 seconds or so to minimize the amount of data lost in the event of a crash. Chapter 8 - Adding a Disk
26
3. An overview of the disk installation procedure
Setting up automatic mounting Remember that a filesystem must be mounted before it becomes available to UNIX processes. Be sure that the partition you are trying to mount has a valid filesystem on it. If you try to mount the swap partition, you can really mess things up. Brand new filesystems have a directory called lost+found This is used by fsck to fix an unstable filesystem Chapter 8 - Adding a Disk
27
3. An overview of the disk installation procedure
You will generally want to configure the system to mount local filesystems at boot time This is done in the file /etc/fstab (or some similar name) mount umount, swapon and fsck all read the fstab file. Chapter 8 - Adding a Disk
28
3. An overview of the disk installation procedure
Enabling swapping To make swapping efficient, raw partitions (without filesystems) are normally used as the backing store. The more swap space you have the more virtual memory your processes can allocate. The best performance is achieved when the swap area is split among several drives (better yet drives on different buses/channels) During startup a command (often swapon or swap) is run to enable swapping on all partitions listed in the fstab file. Chapter 8 - Adding a Disk
29
4. fsck: check and repair filesystems
The UNIX filesystem is surprisingly reliable, and it does a remarkable job of coping with unexpected crashes and flaky hardware. However filesystems can become damaged or inconsistent in a number of ways. Kernel panics Power failures Minor damage can usually be fixed with the fsck command Chapter 8 - Adding a Disk
30
4. fsck: check and repair filesystems
If journaling is not available, you must wait for fsck to work its magic. The five most common types of damage are: Unreferenced inodes Inexplicably large link counts Unused data blocks not recorded in the block maps Data blocks listed as free that are also used in a file. Incorrect summary information in the superblock. fsck can safely and automatically fix these five problems Chapter 8 - Adding a Disk
31
4. fsck: check and repair filesystems
If fsck makes corrections to a filesystem, you should rerun it until the filesystem comes up completely clean. Disks are normally checked at boot time with the command fsck –p, which examines local filesystems listed in /etc/fstab Errors that do not fall into the five listed are potentially serious. When run in manual mode fsck asks you to confirm each repair it wants to make. Chapter 8 - Adding a Disk
32
4. fsck: check and repair filesystems
Those errors that require manual intervention are: Blocks claimed by more than one user. Blocks claimed outside the filesystem range Link counts that are too small. Blocks that are not accounted for. Directories that refer to unallocated inodes. Various format errors. If fsck can’t fix it,……….. Chapter 8 - Adding a Disk
33
5. Vendor specifics Unfortunately, the installation of new disks is a task that every UNIX vendor has decided to handle differently. In the next few subsections of the text they present a bloody blow by blow example of the procedure for each sample vendor. Chapter 8 - Adding a Disk
34
Chapter 8 - Adding a Disk
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.