The fstab file is a system configuration file commonly found at /etc/fstab on Unix and Unix-likecomputer systems. In Linux, it is part of the util-linux package. The fstab file typically lists all available disk partitions and other types of file systems and data sources that are not necessarily disk-based, and indicates how they are to be initialized or otherwise integrated into the larger file system structure. The fstab file is read by the mount command, which happens automatically at boot time to determine the overall file system structure, and thereafter when a user executes the mount command to modify that structure. It is the duty of the system administrator to properly create and maintain the fstab file. While fstab is still used for basic system configuration, for other uses, it has been superseded by automatic mounting mechanisms. The file has other names on some versions of Unix; for example, it is found at /etc/vfstab on Solaris systems.
The fstab file is read by programs that work with disk partitions and other file systems and is not automatically maintained. Instead it is written by the system administrator or sometimes by an operating systeminstallation program. However, some administration tools can automatically build and edit fstab, or act as graphical editors for it, such as the Kfstab graphical configuration utility available for KDE. Modern Linux systems use udev as an automounter to handle the hot swapping of devices instead of relying on fstab. Programs such as pmount allow ordinary users to mount and unmount filesystems without a corresponding fstab entry; traditional Unix has always allowed privileged users to mount or unmount devices without an fstab entry.
Example
The following is an example of an fstab file on a typical Linux system.
The order of records in fstab is important because fsck, mount, and umount sequentially iterate through fstab doing their thing. Blank lines and comment lines beginning with a "#" are ignored. The space- or tab-separated fields within each row must appear in a specific order, as follows:
device-spec – The device name, label, UUID, or other means of specifying the partition or data source this entry refers to.
mount-point – Where the contents of the device may be accessed after mounting; for swap partitions or files, this is set to none.
fs-type – The type of file system to be mounted.
options – Options describing various other aspects of the file system, such as whether it is automatically mounted at boot, which users may mount or access it, whether it may be written to or only read from, its size, and so forth; the special option defaults refers to a predetermined set of options depending on the file system type.
dump – A number indicating whether and how often the file system should be backed up by the dump program; a zero indicates the file system will never be automatically backed up.
pass – A number indicating the order in which the fsck program will check the devices for errors at boot time; this is 1 for the root file system and either 2 or 0 for all other devices.
As the filesystems in /etc/fstab will eventually be mounted using mount it is not surprising that the options field simply contains a comma-separated list of options which will be passed directly to mount when it tries to mount the filesystem. The options common to all filesystems are: ; auto / noauto ; dev / nodev ; exec / noexec ; rw / ro ; sync / async ; suid / nosuid ; user / users / nouser ; defaults ; owner ; atime / noatime / relatime / strictatime
Filesystem-specific options
There are many options for the specific filesystems supported by mount. Listed below are some of the more commonly used. The full list may be found in the documentation for mount. Note that these are for Linux; traditional UNIX-like systems have generally provided similar functionality but with slightly different syntax.
- user file creation dmask - directory creation fmask - for files only More detailed information about the fstab file can be found in the man page about ; for other systems see below.
nfs
; addr=ip
Mounting all filesystems
mount -a This command will mount all filesystems mentioned in fstab and is used in system script startup during booting. Note that this command will ignore all those entries containing "noauto" in the options section.