Managing the Filesystem Table

Since the Linux filesystem hierarchy is spread across separate partitions and/or multiple drives, it is necessary to automatically mount those filesystems at boot time. In addition, removable media and filesystems on remote NFS servers may be used regularly with recurring mount properties. All of this information is recorded in the /etc/fstab file. Filesystems defined in this file are checked and mounted when the system boots. Entries in this file are consulted for default information when users wish to mount removable media.

The /etc/fstab file (see Example 7-1) is plain text and consists of lines with six fields:

Device

This field specifies the device file of the partition holding the filesystem (for example, /dev/hda1). This may either be the device name (like /dev/hda1), the UUID of the device (like UUID=35f8a3e0-9257-4b71-913d-407bef4eeb90), or the partition label (like LABEL=/boot).

Mount point

This field specifies the directory on which the filesystem is to be mounted. For example, if /dev/hda1 contains the root filesystem, it is mounted at /. The root filesystem will contain additional directories intended as mount points for other filesystems. For example, /boot may be an empty directory intended to mount the filesystem that contains kernel images and other information required at boot time.

Filesystem type

Next, the type of filesystem is specified. These may include ext2 filesystems, swap, nfs, iso9660 (CD-ROM), and others.

Mount options

This field ...

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.