The fstab (or file systems table) file is a system configuration file commonly found at /etc/fstab
on Unix and Unix-like computer 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.
Contents
- Modern use
- Example
- Options common to all filesystems
- Filesystem specific options
- ext2
- fat
- fat ntfs
- nfs
- Mounting all filesystems
- References
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.
Modern use
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 system installation 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 (such as MP3 players or digital cameras) 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 (the root user and users in the wheel group) 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(8), mount(8), and umount(8) 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 (typically aligned in columns, as above, but this is not a requirement) 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 either2
(meaning check after root) or0
(do not check) for all other devices.
Missing values in the last two fields are interpreted as zeros. If necessary, space characters in the first, second, and fourth fields are indicated by the octal character code 040
.
Options common to all filesystems
As the filesystems in /etc/fstab
will eventually be mounted using mount(8) 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
user
permits any user to mount the filesystem. This automatically implies noexec, nosuid, nodev unless overridden. If nouser
is specified, only root can mount the filesystem. If users
is specified, every user in group users will be able to unmount the volume.defaults
rw,suid,dev,exec,auto,nouser,async
(no acl support). Modern Red Hat based systems set acl support as default on the root file system but not on user created Ext3 file systems. Some file systems such as XFS enable acls by default. Default file system mount attributes can be overridden in /etc/fstab.owner (Linux-specific)
atime / noatime / relatime / strictatime (Linux-specific)
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.
ext2
check={none, normal, strict}
debug
sb=n
fat
check={r[elaxed], n[ormal], s[trict]}
conv={b[inary], t[ext], a[uto]}
fat, ntfs
windows_names
windows_names
restricts the set of allowed characters for the volume to only those acceptable by Windows. Note: though FAT/NTFS are the most common use case, this feature is not specifically restricted to those filesystem types.uid=n, gid=n
umask=nnn, dmask=nnn, fmask=nnn
More detailed information about the fstab file can be found in the man page about Linux fstab; for other systems see below.
nfs
addr=ip
ip
' means IP addressMounting all filesystems
mount -aThis command will mount all (not-yet-mounted) 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.