8/2/2019 Addin a Disk
1/46
Chapter 8 Adding a Disk
By Vickie Shen
8/2/2019 Addin a Disk
2/46
6/11/02
Content :
A general discussion of the SCSI and IDE standards
The structure of modern hard disks
The general mechanisms by which disks are formatted andpartitioned
The procedure for initial file systems
Proprietary commands for setting up new disks supported
by individual vendors Systems installation procedure for one particular disk
8/2/2019 Addin a Disk
3/46
6/11/02
How do most systems connect their disks?
Two major methods are being used =>
SCSI (the small Computer Systems Interfaces)
IDE (Integrated Drive Electronics)
8/2/2019 Addin a Disk
4/46
6/11/02
Disk Interfaces
The common-use interface standards:
1. SCSI
2. IDE
3. Fibre Channel
4. USB
8/2/2019 Addin a Disk
5/46
6/11/02
The features of the SCSIinterface:
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
8/2/2019 Addin a Disk
6/46
6/11/02
The features of theIDEinterface:
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
8/2/2019 Addin a Disk
7/46
6/11/02
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 twinaxialcopper 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
8/2/2019 Addin a Disk
8/46
6/11/02
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
8/2/2019 Addin a Disk
9/46
6/11/02
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
8/2/2019 Addin a Disk
10/46
6/11/02
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 25mFast 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)
8/2/2019 Addin a Disk
11/46
6/11/02
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.
8/2/2019 Addin a Disk
12/46
6/11/02
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 devicesand differential terminator connected to it.
- a single chain does not contain any differential devices.
- the single ended and differential singling technique are
incompatible.
8/2/2019 Addin a Disk
13/46
6/11/02
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 youexpect 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.
8/2/2019 Addin a Disk
14/46
6/11/02
Continue...
- When figuring the length of your SCSI-2 bus, make sure you countthe 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 SCSIaddresses!
8/2/2019 Addin a Disk
15/46
6/11/02
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 theperformance of a SCSI setup. In most cases, upgrading a
single-user workstation to SCSI will not increase the
systems perceived performance.
8/2/2019 Addin a Disk
16/46
6/11/02
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 SCSIprovides
8/2/2019 Addin a Disk
17/46
6/11/02
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.
8/2/2019 Addin a Disk
18/46
6/11/02
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.
8/2/2019 Addin a Disk
19/46
6/11/02
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 buss Plug and Play features
- Logical Block Addressing (LBA) - overcomes a problem thatprevented BIOSs from accessing more than the first 1024 cylinders of
a disk. The constraint formerly limited disk si e t0 504MB
8/2/2019 Addin a Disk
20/46
6/11/02
Continue...
ATA-3
- Additional reliability, more sophisticated powermanagement, 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 towork 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.
8/2/2019 Addin a Disk
21/46
6/11/02
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
8/2/2019 Addin a Disk
22/46
6/11/02
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 using3) new SCSI target does not conflict with the controller or
another device on the bus
8/2/2019 Addin a Disk
23/46
6/11/02
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 checkingthe integrity of filesystems.
8/2/2019 Addin a Disk
24/46
6/11/02
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 .
8/2/2019 Addin a Disk
25/46
6/11/02
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 manufacturers 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 canoften send the command from the SCSI controllers BIOS.(format command on Solaris; mediainit command on HP-UX)
8/2/2019 Addin a Disk
26/46
8/2/2019 Addin a Disk
27/46
6/11/02
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.
8/2/2019 Addin a Disk
28/46
6/11/02
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 others disk space.
4. Partitions can improve performance of the entire system.
5. Partitions confine potential damage from runaway
programs.
8/2/2019 Addin a Disk
29/46
6/11/02
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.
8/2/2019 Addin a Disk
30/46
6/11/02
Continue...
Some systems allow users to define multiple overlappingsets 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 theirpredecessor. Most systems will have at least the following
three partition
- The root partition
- The swap partition- The user partition
8/2/2019 Addin a Disk
31/46
6/11/02
Continue...
The root partition :everything needed to bring the
system up to single user mode is kept here. A second copyof this partition is often stored on another disk for
emergencies.
8/2/2019 Addin a Disk
32/46
6/11/02
Continue...
The swap partition : A swap area stores pages of virtual
memory when not enough physical memory is available tohold them. Every system should have at least one swap
partition.
8/2/2019 Addin a Disk
33/46
6/11/02
Continue...
The user partition : Home directories, data files, source
code libraries, and other random data files find a homehere.
8/2/2019 Addin a Disk
34/46
6/11/02
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, dont make it
bigger than the capacity of your backup device.
8/2/2019 Addin a Disk
35/46
6/11/02
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.
8/2/2019 Addin a Disk
36/46
6/11/02
Establishing logical volume
Some system have a logical volume manager that provide asort 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
8/2/2019 Addin a Disk
37/46
6/11/02
Continue...
Volume Manager and the supported vendors
Veritas..Solaris & HP-UXSolstice DiskSuite....Sun
Vinum(Open source volume manager)Free BSD
LinuxLVM &
implementation of kernel RAID..Linux
8/2/2019 Addin a Disk
38/46
6/11/02
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 adisk partition.
8/2/2019 Addin a Disk
39/46
6/11/02
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
8/2/2019 Addin a Disk
40/46
6/11/02
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 functionperformed automatically at boot time.
On most systems, swap areas can be listed in the fstab file.
8/2/2019 Addin a Disk
41/46
6/11/02
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 becomedamaged or inconsistent in a number of ways.
8/2/2019 Addin a Disk
42/46
6/11/02
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.
8/2/2019 Addin a Disk
43/46
6/11/02
Continue...
Solutions:
There are a couple of approaches to fixing this problem.
1) fsck command : can be used to solved minor damage. It
isnt 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 Solariss UFS
filesystem and VXFS for HP-UX.
8/2/2019 Addin a Disk
44/46
6/11/02
Continue...
If some form of journaling is not available, you must wait forfsck 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.
8/2/2019 Addin a Disk
45/46
6/11/02
Continue...
fsck -pbesides correct the errors, it also examines all localfilesystems listed in /etc/fstab. It can also be run on
particular filesystem
8/2/2019 Addin a Disk
46/46
6/11/02
Vendor Specifies
Adding a disk to different vendor systems:
SPARC-based Solaris system
Red Hat Linux
Free BSD
Top Related