17.3 About the File System Mount Table

The /etc/fstab file contains the file system mount table, and provides all the information that the mount command needs to mount block devices or to implement binding of mounts. If you add a file system, create the appropriate entry in /etc/fstab to ensure that the file system is mounted at boot time. The following are sample entries from /etc/fstab:

/dev/sda1         /boot   ext4     defaults  1 2
/dev/sda2         /       ext4     defaults  1 1
/dev/sda3         swap    swap     defaults  0 0

The first field is the device to mount specified by the device name, UUID, or device label, or the specification of a remote file system. A UUID or device label is preferable to a device name if the device name could change, for example:

LABEL=Projects    /var/projects  ext4  defaults  1 2

The second field is either the mount point for a file system or swap to indicate a swap partition.

The third field is the file system type, for example ext4 or swap.

The fourth field specifies any mount options.

The fifth column is used by the dump command. A value of 1 means dump the file system; 0 means the file system does not need to be dumped.

The sixth column is used by the file system checker, fsck, to determine in which order to perform file system checks at boot time. The value should be 1 for the root file system, 2 for other file systems. A value of 0 skips checking, as is appropriate for swap, file systems that are not mounted at boot time, or for binding of existing mounts.

For bind mounts, only the first four fields are specified, for example:

path         mount_point    none     bind

The first field specifies the path of the file system, directory hierarchy, or file that is to be mounted on the mount point specified by the second field. The mount point must be a file if the path specifies a file; otherwise, it must be a directory. The third and fourth fields are specified as none and bind.

For more information, see the fstab(5) manual page.