Adding a Disk
This contains links to information used in the lectures.
SCSI
- Connectors (Centronics, DB-50, DB-25, Mini-micro)
- SCSI devices mostly female
- SCSI bus consists of a daisy-chain
- Most devices have 2 SCSI ports (in and out)
- Termination - external v internal
- SCSI device number 0 to 7 - set with thumbwheel, DIP switches or jumpers
- SCSI-2 : faster but bus limited to 2m
- "Fast" SCSI - 10 Megatransfers per sec
- Wide means each transfer is 2 or 4 bytes rather than 1
- "Ultra" - 20 megatransfers of 2 bytes
- Differential SCSI : 0 to 15 devices
- The controller takes one address
Problems with configuration
- Internal devices
- Duplicate addresses
- "auto-terminating" devices - some don't when should
- unannounced termination - later devices vanish
- faulty (backward) thumbwheels
- SCSI bus too long - cables inside add a lot
- SCSI controller has address
Disk Geometry
- Platter
- Surface
- Track/Cylinder
- Sector
- Head
Installing a Disk
- Connect disk
- Create device files using mknod or SAM (or insf under HP-UX)
- Format disk
SCSI preformatted but good to reformat in case more bad blocks created
during shipping. Use mediainit on HP and format on
SunOS.
- Label and partition disk
On SunOS format also partitions disks (menu driven).
HP-UX had only one partition and swap partition. Later versions permitted
software striping. HP-UX 10.XX has
logical volume manager.
Hints for partitions:
- Make a backup root partition on second disk
- Increase swap space with memory - 2 to 4 times memory
- Split (stripe) swap space across disks
- Make partitions smaller than backup device capacity
- Create separate partitions for files that are likely to go out
of control (/tmp, /usr/tmp, /var if used for logging, news)
- Create UNIX filesystems on partitions
Use mkfs or newfs, which is a user friendly front end.
Now usually can just do newfs partition.
- Verify filesystems
- Setup automatic mounting at boot time
This is done using a file which gives the partitions and mount points.
This is /etc/fstab under
SunOS and HP-UX 10.X and
/etc/checklist under HP-UX 9.XX, and
vftab under Solaris. The third field gives the filesystem type:
nfs for nfs mounted files, local files differ with vendor (ufs, 4.2 under SunOS,
hfs under HP-UX). The fourth gives mount options. The sixth specifies the
fsck pass. The fifth is a dump frequency which is mostly unused.
/etc/fstab is read by mount, umount, swapon, and
fsck commands. One can call mount with just the mount
point name :
mount /usr/local
mount -a mounts all the filesystems listed in /etc/fstab.
It is called at boot time.
Note that it will read the file sequentially so
filesystems must appear in the correct order of mounting.
- Setting up swapping
/etc/fstab file.
fsck : Check and Repair Filesystems
fsck is used to fix inconsistencies introduced into Unix filesystems during
a crash. It will automatically fix most minor damage.
The five most common types of damage are:
- Unreferenced inodes
- Large link counts
- Unused data blocks not recorded in block maps (free list)
- Data blocks listed as free that are also in files
- Incorrect summary information in superblock
At boot time fsck -p is run to check all filesystems in
/etc/fstab file. Newer systems only check "dirty" filesystems -
ones that had blocks buffered at crash time.
fsck -p checks the filesystems in ascending numeric order on the
sixth entry. Partitions which are on different disks can be given the
same number to have them checked in parallel.
Errors other than those above are deemed serious and fsck prints
a message and quits. You must then run fsck manually (without -p
option). Fixing the disk by hand requires extensive knowledge, extreme
bravery and the type of foolhardiness that led to the charge of the
Light Brigade. Lacking these give the default answer
to all the questions fsck
asks.
Note that there is an option to fsck that answers
yes to all the questions, but yes is not always the default !!
One should try to copy files fsck wishes to delete.
Files whose parent directory cannot be found will be copied to
lost+found under their inode numbers.
ncheck can sometimes be used to discover pathnames corresponding
to inodes, and clri can be used to clear inodes which fsck
will not fix.
Paul A. Farrell
Tue Feb 27 02:08:37 EST 1996