Sunday, 16 March 2014

Adding a disc drive.


7 Adding a disc drive.

There is never enough disk space. The minute a new disk is added to the system, it is half full, or so it seems. Getting users to clean up their disk space is as difficult as getting a teenage boy to clean up his room. Therefore, the system administrator will occasionally have to install new disk drives.

7.1 Disc drive terminology.

  • The circular plate coated with magnetic media is called a platter - drives usually have several platters
  • The heads ride on a microscopic film of air on the platter surface - all heads move together
  • The platters spin rapidly and the heads move in and out to position on a track - this action is called seeking
  • Each track is made up of a number of sectors
  • The collection of tracks under all of the heads is called a cylinder
  • When a head touches the surface of a platter, it is called a head crash - this is a Bad Thing (go buy a new disc and get out your last backup!)
  • Discs are logically divided up (by groupings of cylinders or sectors) into partitions -partitions usually overlap
  • File systems occupy entire partitions (not all partitions have file systems, e.g. the swap partition)
  • Every file system has a superblock which contains information such as the file system's label, size, and total number of inodes
This diagram shows an idealized disc drive. Here is an example of how several file systems on three disc drives might be mounted.

7.2 Steps in adding a disc drive.

  • Make a device entry in /dev for the new disc (use /dev/MAKEDEV)
  • Make an entry in /etc/disktab (4.2 BSD) or /etc/device.tab (System V.4) for your new disc
  • Set the SCSI address to a legal, unused SCSI id
  • Connect the drive to the SCSI bus
  • Make sure the disc is formatted/partitioned correctly
  • Make files systems using newfs or mkfs
  • Make an entry in /etc/fstab for the new partitions
  • Mount the new partitions
  • Transfer file systems (if necessary)
  • Do site specific configurations (e.g., BSD quotas)

7.3 Commands for determining device names/numbers

  • SunOS 4.x/5.x - dmesg
  • IRIX - hinv
  • OSF/1 (Digital Unix), Ultrix - uerf

7.4 Commands for partitioning/formatting drives

  • SunOS 4.x/5.x - format
  • IRIX - fx
  • OSF/1 - disklabel (gets partition information from /etc/disktab)
  • Ultrix - chpt, rzdisk
  • Linux - fdisk

7.5 Commands for examining partition information

  • SunOS 4.x - dkinfo
  • SunOS 5.x, IRIX - prtvtoc
  • Ultrix - chpt
  • Linux - fdisk

7.6 Example BSD partitioning.

BSD systems usually use 8 partitions (labelled "a" through "h")
Example Eagle disc partitions 
------------------------------------
Partition  Cylinders  Typical use     
------------------------------------
a          0-15       /               
b          16-86      Swap            
c          0-841      Entire disc     
d          391-407    Alternate Root  
e          408-727                    
f          728-841                    
g          391-841    /usr            
h          87-390                     
------------------------------------
There are several possible ways of creating file systems on these partitions. Here is a diagram of three alternatives.

7.7 Example System V partitioning.

System V systems number their partitions 0 through 7. (Example from IRIX system)
# prtvtoc c0t0d0s2
* c0t0d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 84 sectors/track
* 15 tracks/cylinder
* 1260 sectors/cylinder
* 1658 cylinders
* 1656 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
 0 2 00 0 103320 103319 /
 1 3 01 103320 132300 235619
 2 5 00 0 2086560 2086559
 5 6 00 235620 1106280 1341899 /opt
 6 4 00 1341900 437220 1779119 /usr
 7 4 00 1779120 307440 2086559 /usr/openwin

7.8 The Berkeley /etc/disktab file.

Here is an example of an /etc/disktab file used here in C&C for Ultrix systems. The descriptions of the entries can be found in the man pages for disktab (see "man disktab").

7.9 The SunOS format.dat file.

SunOS uses a file called format.dat. This example is from the sun-managers email list.

7.10 /etc/fstab file (System V).

blck-spcl-file mnt-loc [fstype] [options]
/dev/root / efs rw,raw=/dev/rroot 0 0
/dev/usr /usr efs rw,raw=/dev/rusr 0 0

7.11 /etc/fstab file (4.3 BSD).

blck-spcl-file mnt-loc fstype opts dump-freq passno
/dev/sd0a / 4.3 rw,noquota,noauto 0 1

7.12 /etc/fstab file (ULTRIX).

blck-spcl-file:mnt-loc:type:dump-freq:passno:fstype:options
/dev/ra0a:/:rw:1:1:ufs::

7.13 Partitioning considerations

  • When a file system approaches 100% full, fragmentation tends to occur in the newly created files. If they stick around, and are used frequently, this can have an adverse effect on disc I/O.
  • When a file system on a partition fills up, you can't create any more files. Period. The glass is full. This means that any programs that need to create files here will start to fail. This means you might want to put your Usenet news spool on a partition other than, say, / (where the operating system usually keeps /tmp) or /usr (where you may have home directories).
  • The inode table is fixed in size. It does not get bigger to accommodate more files. You may have plenty of space left, but with no more inodes available, you can't create any more files. (Same problem as disc filled.)
  • If a partition will have a high percentage of predominately large files, or a high percentage of predominately small files, the default block size may not efficiently allow the files to be organized on disc.

7.14 Remaking a disc partition

  • Dismount file system
# umount /data
  • Backup file system (assumes 6250 BPI tape density and length factor of 24000)
# dump 0ds 6250 24000 /dev/disk2g
  • Check to see the backup is good
# restore t
  • Remake the file system (assumes m2694esa 1.1gb 3.5" Fujitsu drive per disktab example)
# newfs -b 16384 /dev/rdisk2g M2694ESA
  • Mount the new file system
# mount /data
  • Restore files
# cd /data
# restore r

No comments:

Post a Comment