460 likes | 597 Views
Chapter 8 Adding a Disk. By Vickie Shen. Content :. A general discussion of the SCSI and IDE standards The structure of modern hard disks The general mechanisms by which disks are formatted and partitioned The procedure for initial file systems
E N D
Chapter 8 Adding a Disk By Vickie Shen
Content : • A general discussion of the SCSI and IDE standards • The structure of modern hard disks • The general mechanisms by which disks are formatted and partitioned • The procedure for initial file systems • Proprietary commands for setting up new disks supported by individual vendors • System’s installation procedure for one particular disk
How do most systems connect their disks? Two major methods are being used => • SCSI (the small Computer Systems Interfaces) • IDE (Integrated Drive Electronics)
Disk Interfaces • The common-use interface standards: 1. SCSI 2. IDE 3. Fibre Channel 4. USB
The features of the SCSI interface: • One of the most common and widely supported disk interfaces • Support multiple disks on a bus • Various speeds support • Support different communication styles * SCSI will be described in more detail in the next section
The features of the IDE interface: • Developed as a simple, low-cost interface for PCs • Now support all modern disks (why?) Because it put the hardware controller in the same box as the disk platters and used a relatively high-leave protocol for communication between the computer and the disks. • Medium in speed • High in capacity • Very cheap • Design only for workstations with four or fewer devices
The features of the Fibre Chennel interface: • High bandwidth • Large number of devices can be attached to the Fibre Channel at once • Devices connect together with a fiber optic or twinaxial copper cable • High speed: can reach to 100MB/s and up • Two common topologies: 1) FC-AL (Fibre Channel Arbitrated Loop): Can speak with several protocols, including SCSI and even IP / Channel devices are identified by hardwired ID number called World Wide Name. 2) Fabrics : Construct with Fibre Channel Switches
The features of the USB interface: • Stand for Universal Serial Bus • A popular interface for connecting devices such as keyboard and mice • Good for PCs • Easier for users to remover a disk among disks • Enough bandwidth to support slower disk devices such as removable HDs and CD-ROM drives
Introduction to SCSI Interfaces • SCSI standard is composed of several chip sets • Vendors sometimes put SCSI support on the CPU or peripheral board. • Generic data pipe is being used by all kinds peripheral - disks - tape drives - scanners - printers
Continue… • The summarize the different SCSI version and their associated bus bandwidths and cable length : (Table 8.1- p.121) Version Freq. Wedth Speed Length Diff.length SCSI-1 5 MH 8 bits 5 MB/s 6m 25m SCSI-2 5 MH 8 bits 5 MB/s 6m 25m Fast SCSI-2 10 MH 8 bits 10 MB/s 3m 25m Fast/wide SCSI-2 10 MH 16 bits 20 MB/s 3m 25m Ultra SCSI 20 MH 8 bits 20 MB/s 1.5m 25m Wide Ultra SCSI 20 MH 16 bits 40 MB/s 1.5m 25m Wide Ultra2 SCSI 40 MH 16 bits 80 MB/s - 25m(HVD) 12m(LVD) Wide Ultra3 SCSI 80 MH 16 bits 160 MB/s - 12m(LVD)
Continue… • Common SCSI connectors: (p122) - Centronics(50 pins, SCSI-1/2, external) - Bibbon connector(female, 50 pins, SCSI-1/2, internal) - Mini-micro, aka HD50(50 pins, SCSI-2, external) - Wide mini-micro, aka HD68(68 pins, SCSI-2/3, int/ext) - SCA-2(80 pins, SCSI-3, internal) • SCSI address/ target number Each device has a SCSI address or target number that distinguishes it from the other devices on the bus. Target number starts at 0 and go up to 7-15, depending on whether the bus is narrow or wide. The SCSI controller itself counts as a device and is usually target 7. All other devices must have their target numbers set to unique values.It is a common error to forget that SCSI controller has a target number and to set a device to the same target number as the controller.
Continue… • SCSI buses configuration - Easy to configure - The variety of things need to pay attention during the installation process 1. Many workstations have internal SCSI devices. Check the listing of current devices before you reboot to add a new device. Remember that most tape systems and some floppy drives are SCSI. 2. Make sure for the following things when setup : - a differential SCSI controller has only differential devices and differential terminator connected to it. - a single chain does not contain any differential devices. - the single ended and differential singling technique are incompatible.
Continue... - After you added a new SCSI devices, check the listing of devices discovered by the OS when it reboots to make sure that everything you expect is there. Most SCSI drivers will not detect multiple devices that have the same SCSI address, which is an illegal configuration. SCSI address conflicts can lead to very strange behavior. - Some expansion boxes terminate the bus inside the box. If devices are attached after the expansion box, you can have reliability problems with any of the devices on the SCSI chain. Always double-check that you have exactly two terminators and that they are both at the ends of the bus. -The thumbwheel used to set a devices SCSI address is sometimes connected backwards. When this happens, the thumbwheel will change the SCSI address, but not to the displayed value.
Continue... - When figuring the length of your SCSI-2 bus, make sure you count the cables inside devices and expansion boxes. They can be quite long. Also remember that the maximum length can be reduced if order SCSI devices are added to a newer SCSI bus. - Never forget that your SCSI controller uses one of the SCSI addresses!
Which is better, SCSI or IDE? • For a signal-user workstation, a good IDE disk is simple , high-capacity, dirt-cheap solution that provides 85% of the performance of a SCSI setup. In most cases, upgrading a single-user workstation to SCSI will not increase the system’s perceived performance.
Continue... • In some situations SCSI is advisable or even mandatory: 1. If you absolutely must have the best possible performance, go SCSI. 2. For the Servers and multiuser systems, it requires SCSI. 3. If you want to connect many devices, SCSI wins again. 4. You might need some particular feature that only SCSI provides
Introduction to IDE Interfaces • IDE, also called ATA (for AT Attachment) • IDE was designed for simple and inexpensive purposes • The controller is built into disk, which reduces interface cost and simplifier the firmware. • The IDE connector is a 40-pin header that connects the drive to the interface card with a ribbon cable.
Continue... • IDE devices are accessed in a connected manner -> means that only one device can be active at the same time. Therefore, performance is best if you spread the devices out over multiple buses. SCSI handles multiple devices on a bus much better than does IDE • Designate one as master and the other one as the slave when more then one device on an IDE bus.
The revolution of IDE inferfaces: • ATA-1 • ATA-2 The following features are added to ATA-2: - Faster Programmed I/O (PIO) - Direct Memory Access mode(DMA) - Extend the bus’s Plug and Play features - Logical Block Addressing (LBA) - overcomes a problem that prevented BIOSs from accessing more than the first 1024 cylinders of a disk. The constraint formerly limited disk si e t0 504MB
Continue... • ATA-3 - Additional reliability, more sophisticated power management, and self-monitoring capabilities. • ATA-4 (still being developed) - merge ATA-3 with ATA Packet Interface(ATAPI) *APAPI is a protocol that allows CD-ROM and tape drivers to work on an IDE bus. • Ultra-ATA - is designed to bridge the gap between ATA-3 and ATA-4 • Ultra DMA-33 & Ultra DMA/66 - extend the bus bandwidth from 16MB/s to 33MB/s to 66MB/s, respectively.
An overview of the disk installation procedure • Connecting the disk to the computer • Creating device file through which the disk can be accessed • Formatting the disk • Labeling and partitioning the disk • Establishing logical volumes • Creating UNIX filesystems whithin disk partitions • Setting up automatic mounting • Setting up swapping
Connecting the disk • Depends mostly on the interface that is used. • If the disk is IDE => configure the system with only one IDE disk per bus. Check the cable orientation and the master/ slave settings on each disk. If the disk is SCSI => double-check the following things... 1) you have properly terminated both ends of the SCSI bus 2) the cable length is less then the maximum appropriate for the SCSI variant you are using 3) new SCSI target does not conflict with the controller or another device on the bus
Creating device entrices • Before you can access a new disk, you need device files in /dev that point to it. You will need both block device files and character device files. Many versions of UNIX automatically create files for all possible SCSI devices (detail on p.138) * Block device files generally used for mounting filesystems. * Character device files used for backing up and checking the integrity of filesystems.
Formattingthe disk • The formatting process does two things: - Writes address information and timing marks on the patters to delineate each sector. - Identify “bad blocks”.(Imperfactions in the media that result in areas that cannot be reliably read or written. • On order 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. Users and driver itself do not need to worry about it • Encounter read or write when formatting, first check for cabling, termination, and address problems, which can cause symptoms similar to those of a bad block .
Countinue... • IDE disks are usually not designed to be formatted outside of the factory. However, you may be able to get special formatting software from the manufacturer, usually for Window. Make sure the software matches the drive you plan to format and follow the manufacturer’s directions carefully. • SCSI disks format 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. (format command on Solaris; mediainit command on HP-UX)
Continue... • Some systems let you varify the integrity of a disk by writing random patterns onto it and then reading tem back.This process is very time consuming. You may want. to skip it.
Labeling and partitioning the disk What is partitions? After a disk has been formatted and its bad sectors remapped, it must be divided into chunks called partitions or slices.
Continue... What does the partitioning do? 1. Partitioning allows the disk to be treated as a group of independent data areas rather ten as one vast expanse of blocks. 2. Partitioning also allows the boot blocks and the partition table itself to be hidden from high-level software (e.g., filesystem) 3. Partitions make backups easier, prevent users from poaching each other’s disk space. 4. Partitions can improve performance of the entire system. 5. Partitions confine potential damage from runaway programs.
Continue... What is called “label”? On most operation 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. Basically, what it does is to get the system booting.
Continue... • Some systems allow users to define multiple overlapping sets of partitions. In real life, such overlapping partitions invite operator errors and a common cause of random data corruption. • Modern system tend to have fewer partitions then their predecessor. Most systems will have at least the following three partition - The root partition - The swap partition - The user partition
Continue... • 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.
Continue... • 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.
Continue... • The user partition : Home directories, data files, source code libraries, and other random data files find a home here.
Continue... Some hints for splitting disks into partitions: • If you have multiple disks, make a copy of the root filesystem of one of them and verity that you can boot from it. • As you add memory to your machine, you should also add swap space. • 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.
Continue... • It is a good idea to create a separate filesystem (/tmp) for temporary files because it limits the files to a finite si e and save you from having to back them up. • If your system keeps long files in /var, it is a good idea for /var to be a separate disk partition. Many systems ship with /var as part of a very small root partition, making it easy to fill the root and bring the machine to a halt.
Establishing logical volume Some system have a “logical volume manager” that provide a sort of supercharged version of disk partitioning. The volume managers let user group multiple disks or partitions into a logical volume. The common features supported by volume managers: • Striping • RAID5 (Redundant Array of Inexpensive Disks) • Mirroring
Continue... Volume Manager and the supported vendors Veritas………………………………..…Solaris & HP-UX Solstice DiskSuite……………….…...…Sun Vinum(Open source volume manager)…Free BSD LinuxLVM & implementation of kernel RAID………..Linux
Creating UNIX filesystems After a hard disk has been conceptually divided into partitions. The filesystem needs to add a little of its own overhead before the disk is ready for use. • Use newfs or mkfs toinstall a filesystem within a disk partition.
Setting up automatic mounting A system must be mounted before it becomes available on UNIX processes. The mount point for a filesystem can be any directory, but the files and subdirectories beneath it will not be accessible while a filesystem is mounted there. *mount, unmount, swapon and fsck all read the fstab file The command used to mount new filesystems: mount The command used for unmounting filesystems: unmount
Enabling swapping Why do we need swapping? This feature allows the operation system to pretend that the machine has more memory then it actually does. • The more swap space you have, the more virtual memory your process can allocate. • The best swap performance is achieved when the swap area is split among several drives. • Users can manually enable swapping to a particular device, but you will generally want to have this function performed automatically at boot time. • On most systems, swap areas can be listed in the fstab file.
Check and repair filesystems The UNIX filesystem is surprisingly reliable, and it does a remarkable job of coping with unexpected system crashes and flaky hardware. However, filesystems can become damaged or inconsistent in a number of ways.
Continue... Problem : Any time the kernel panics or power fails, small inconsistencies may be introduced to the filesystems that will active immediately preceding the crash. Additional information: Since the kernel buffers both data blocks and summary information, the most recent image of the filesystem is split between disk and memory. During a crash, the memory portion of the image is lost. The buffered blocks are effectively “overwritten” with the version that were most recently saved to disk.
Continue... Solutions: There are a couple of approaches to fixing this problem. 1) fsck command : can be used to solved minor damage. It is’nt a very architechurally elegant way of approaching the issue, but it works pretty well for all the common inconsistencies. 2) Journaling filesystems: write metadata out to a sequential log file that is flushed to disk before each command returns. If the system crashes, the log can be rolled up to the most recent consistency point. * Journaling filesystems is available on Solaris’s UFS filesystem and VXFS for HP-UX.
Continue... If some form of journaling is not available, you must wait for fsck to work. The five 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.
Continue... • fsck -pbesides correct the errors, it also examines all local filesystems listed in /etc/fstab. It can also be run on particular filesystem
Vendor Specifies Adding a disk to different vendor systems: • SPARC-based Solaris system • Red Hat Linux • Free BSD