UNIX System Administration Handbook - Evi Nemeth [88]
You can verify the size of a filesystem with the df command. Here’s a BSD example:
# df /usr
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/wd0s1f 810495 509516 236140 68% /usr
The units reported by df are 1K or 512-byte blocks, depending on the OS. df -k will force 1K blocks to be displayed on some systems.
On HP-UX, the df command is quite different. You can use the bdf command (“Berkeley df”) to get output like that shown above.
You will generally want to configure the system to mount local filesystems at boot time. A configuration file in /etc lists the device names and mount points of all the system’s disks (among other things). On most systems this file is called /etc/fstab (for “filesystem table”), but under older versions of HP-UX it is called /etc/checklist, and on Solaris it has been reformatted and renamed /etc/vfstab. For the rest of this section, we will refer to the file as “the fstab file” even though it might actually be named something different on your system.
An fstab file that included the filesystem above might look something like this:8
# Device Mountpoint FStype Options Dump Pass#
/dev/wd0s1b none swap sw 0 0
/dev/wd0s1a / ufs rw 1 1
/dev/wd0s1f /usr ufs rw 2 2
/dev/acd0c /cdrom cd9660 ro,noauto 0 0
proc /proc procfs rw 0 0
server:/export /server nfs rw 0 0
There are six fields per line, separated by whitespace. Each line describes a single filesystem. The fields are traditionally aligned for readability, but this is not required.
The first field gives the device name. The fstab file can include mounts from remote systems, in which case the first field contains an NFS path, as in the last line. The notation server:/export indicates the /export directory on the machine named server.
See Chapter 17 for more information about NFS.
In some cases, the first field can specify a virtual filesystem type instead of a device name. The proc filesystem above is an example; it exports kernel process information to user utilities. You might also see swap listed as the device for memory file-systems that use swap as a backing store, such as tmpfs on Solaris.
The second field specifies the mount point, and the third field indicates the type of filesystem. The exact type name used to identify local filesystems varies among machines: Solaris and FreeBSD use ufs; HP-UX uses vxfs or hfs; Linux uses ext2.
The fourth field lists the mount options (rw, for read/write, is the default). The fifth field specifies a “dump frequency” value which can theoretically be used by backup products but usually isn’t.
The sixth field specifies the pass in which fsck should check the filesystem. Filesystems with the same value in this field are checked concurrently, if possible. Do not set two filesystems on the same disk to the same value or you will cause the disk head to seek back and forth so much that performance will be significantly degraded. Only filesystems on separate disks should be checked in parallel.
fsck is described on page 136.
mount, umount, swapon, and fsck all read the fstab file, so it is important that the data presented there be correct and complete. mount and umount use the fstab file to figure out what you want done if you specify only a partition name or mount point on the command line. For example, using the fstab file just shown, the command
# mount /cdrom
would be the same as typing
# mount -t cd9660 -o ro,noauto /dev/acd0c /cdrom
The command mount -a mounts all regular filesystems listed in the fstab file; it is usually executed from the startup scripts at boot time. The -t or -F flag (-t for Red Hat and FreeBSD, -F for Solaris and HP-UX) constrains the operation to filesystems of a certain type. For example,
# mount -at ufs
would mount all local disk filesystems on a FreeBSD system. The mount command reads fstab sequentially; therefore, filesystems that are mounted beneath