Host management
4.5 Installing a Unix disk
It is easy to make a copy of these few files in a location which is independent of the locations where the files actually need to reside, according to the rules of the operating system.
A good solution to this issue is to make master copies of files like /etc/group, /etc/services, /etc/sendmail.cf etc., in a special directory which is separate from the OS distribution. For example, you might choose to collect all of these in a directory such as /local/custom and to use a script, or cfengine to make copies of these master files in the actual locations required by the operating system. The advantages to this approach are
• RCS version control of changes is easy to implement
• Automatic backup and separation
• Ease of distribution to other hosts.
The exception to this rule must be the password database /etc/passwd which is actually altered by an operating system program /bin/passwd rather than the system administrator. In that case the script would copy from the system partition to the custom directory.
Keeping a separate disk partition for software that you install from third parties makes clear sense. It means that you will not have to reinstall that software later when you upgrade your operating system. The question then arises as to how such software should be organized within a separate partition.
Traditionally, third party software has been installed in a directory under /usr/localor simply /local. Software packages are then dissected into libraries, binaries and supporting files which are installed under /local/lib, /local/bin and /local/etc, to mention just a few examples. This keeps third party software separate from operating system software, but there is no separation of the third party software. Another solution would be to install one software package per directory under /local.
• IEEE 1394 disks: Implementations include Sony’s iLink and Apple Com-puter’s FireWire brandnames. These disks use a superior technology (some claim) but have found limited acceptance due to their expense.
In order to connect a new disk to a Unix host, we have to power down the system.
Here is a typical checklist for adding a SCSI disk to a Unix system.
• Power down the computer.
• Connect disk and terminate SCSI chain with proper terminator.
• Set the SCSI id of the disk so that it does not coincide with any other disks.
On Solaris hosts, SCSI id 6 of controller zero is typically reserved for the primary CD-ROM drive.
• On SUN machines one can use the ROM command probe-scsi from the monitor (or probe-scsi-all, if there are several disk interfaces) to probe the system for disks, This shows which disks are found on the bus. It can be useful for trouble-shooting bad connections, or accidentally overlapping disk IDs etc.
• Partition and label the disk. Update the defect list.
• Edit the /etc/fstab filesystem table or equivalent to mount the disk. See also next section.
4.5.1 mount and umount
To make a disk partition appear as part of the file tree it has to be mounted.
We say that a particular filesystem is mounted on a directory or mountpoint. The command mount mounts filesystems defined in the filesystem table file. This is a file which holds data for mount to read.
The filesystem table has different names on different implementations of Unix.
Solaris 1 (SunOS) /etc/fstab Solaris 2 /etc/vfstab
HPUX /etc/checklist or /etc/fstab
AIX /etc/filesystems
IRIX /etc/fstab
ULTRIX /etc/fstab
OSF1 /etc/fstab
GNU/Linux /etc/fstab
These files also have different syntax on different machines, which can be found in the manual pages. The syntax of the command is
mount filesystem directory type (options)
There are two main types of filesystem – a disk filesystem (called ufs, hfs etc.) (which means a physical disk) and the NFS network filesystem. If we mount a 4.2 filesystem it means that it is, by definition, a local disk on our system and is described by some logical device name like /dev/something. If we mount an NFS filesystem, we must specify the name of the filesystem and the name of the host to which the physical disk is attached.
Here are some examples, using the SunOS filesystem list above:
mount -a # mount all in fstab
mount -at nfs # mount all in fstab which are type nfs mount -at 4.2 # mount all in fstab which are type 4.2
mount /var/spool/mail # mount only this fs with options given in fstab (The -t option does not work on all Unix implementations.) Of course, we can type the commands manually too, if there is no entry in the filesystem table. For exam-ple, to mount an nfs filesystem on machine ‘wigner’ called /site/wigner/local so that it appears in our filesystem at /mounted/wigner, we would write
mount wigner:/site/wigner/local /mounted/wigner
The directory /mounted/wigner must exist for this to work. If it contains files, then these files will no longer be visible when the filesystem is mounted on top of it, but they are not destroyed. Indeed, if we then unmount using
umount /mounted/wigner
(the spelling umount is correct) then the files will reappear again. Some imple-mentations of NFS allow filesystems to be merged at the same mount point, so that the user sees a mixture of all the filesystems mounted at the same point.
4.5.2 Disk partition device names
The convention for naming disk devices in BSD and system 5 Unix differs. Let us take SCSI disks as an example. Under BSD, the SCSI disks have names according to the following scheme:
/dev/sd0a First partition of disk 0 of the standard disk controller. This is normally the root file system /.
/dev/sd0b Second partition of disk 0 on the standard disk controller. This is normally used for the swap area.
/dev/sd1c Third partition of disk 1 on the standard disk controller. This partition is usually reserved to span the entire disk, as a reminder of how large the disk is.
System 5 Unix employs a more complex, but also more general naming scheme.
Here is an example from Solaris 2:
/dev/dsk/c0t3d0s0 Disk controller 0, target (disk) 3, device 0, segment (partition) 0 /dev/dsk/c1t1d0s4 Disk controller 1, target (disk) 1,
device 0, segment (partition) 4
Not all systems distinguish between target and device. On many systems you will find only t or d but not both.