# Fstab

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Fstab
> Markdown URL: https://mediated.wiki/source/Fstab.md
> Source: https://en.wikipedia.org/wiki/Fstab
> Source revision: 1353547919
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|System configuration file for disk partitions}}
{{Lowercase title}}
'''fstab''' (after ''[file system](/source/file_system)s table'') is a [system file](/source/system_file) commonly found in the directory [<code>/etc</code>](/source/%2Fetc) on [Unix](/source/Unix) and [Unix-like](/source/Unix-like) computer systems. The <code>/etc/fstab</code> file is used by utilities from the <code>util-linux</code> package (such as <code>mount</code> and <code>findmnt</code>), but it's not limited to them — it is also processed by <code>systemd</code> via <code>systemd-fstab-generator</code> for automatic mounting during boot. The fstab file typically lists all available disk [partition](/source/partition_(computing))s and other types of file systems and data sources that may not necessarily be disk-based, and indicates how they are to be initialized or otherwise integrated into the larger [file system structure](/source/Unix_directory_structure).

The fstab file is read by the <code>[mount](/source/mount_(Unix))</code> command, which happens automatically at boot time to determine the overall file system structure, and thereafter when a user executes the <code>mount</code> command to modify that structure. It is the duty of the [system administrator](/source/system_administrator) to properly create and maintain the fstab file.

While fstab is 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](/source/Unix); for example, it is found at <code>/etc/vfstab</code> on [Solaris](/source/Solaris_(operating_system)) 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.

Modern Linux systems use [udev](/source/udev) as an [automounter](/source/automounter) to handle the [hot swapping](/source/hot_swapping) of devices (such as MP3 players or digital cameras) instead of relying on fstab. Programs such as [pmount](/source/pmount) allow ordinary users to [mount](/source/Mount_(Unix)) and unmount filesystems without a corresponding fstab entry; traditional Unix has always allowed privileged users (the [root user](/source/Superuser) and users in the [wheel group](/source/wheel_group)) to mount or unmount devices without a corresponding fstab entry.

==Example==
The following is an example of an fstab file on a typical [Linux](/source/Linux) system.

<syntaxhighlight lang="sh">
# device-spec     mount-point     fs-type      options                                          dump pass
LABEL=/           /               ext4         defaults                                            1 1
UUID=7890abcd-x   none            swap         defaults                                            0 0
none              /dev/pts        devpts       gid=5,mode=620                                      0 0
none              /proc           proc         defaults                                            0 0
none              /dev/shm        tmpfs        defaults                                            0 0

# Removable media
/dev/cdrom        /mnt/cdrom      udf,iso9660  noauto,owner,ro                                     0 0

# NTFS Windows 11 partition
/dev/nvme0n1p7    /mnt/Windows    ntfs         quiet,defaults,locale=en_US.utf8,umask=0,noexec     0 0

# Partition shared by Windows and Linux
/dev/nvme0n1p8    /mnt/shared     vfat         umask=000                                           0 0

# Mounting tmpfs
tmpfs             /mnt/tmpfschk   tmpfs        size=100m                                           0 0

# Mounting cifs
//cifs_name/store /store/pingu    cifs         credentials=/root/smbpass.txt                       0 0

# Mounting NFS
nfs_name:/store   /store          nfs          rw                                                  0 0
</syntaxhighlight>

The order of records in fstab is important because fsck(8), mount(8), and umount(8) sequentially iterate through fstab and mount in the order defined.<ref>[http://man7.org/linux/man-pages/man5/fstab.5.html#DESCRIPTION man 5  fstab]</ref>

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:
# ''device-spec'' – The device name, label, [UUID](/source/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 [mount](/source/Mount_(computing))ing; for [swap](/source/Paging) partitions or files, this is set to <code>none</code>.
# ''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 <code>defaults</code> refers to a pre-determined set of options depending on the file system type.
# ''dump'' – A number indicating whether and how often the file system should be [backed up](/source/Backup) by the [dump](/source/dump_(Unix)) program; a zero indicates the file system will never be automatically backed up.
# ''pass'' – A number indicating the order in which the [fsck](/source/fsck) program will check the devices for errors at boot time:
::{{ubl|0 - do not check
|1 - check immediately during boot
|2 - check after boot}}

Missing values in the last two fields are interpreted as zeros. If necessary, [space character](/source/space_character)s in the first, second, and fourth fields are indicated by {{unichar|40}}.

==Options common to all filesystems==

; <code>auto</code> / <code>noauto</code>
: With the <code>auto</code> option, the device will be mounted automatically at bootup or when the mount -a command is issued. <code>auto</code> is the default option. For the device not to be mounted automatically, the <code>noauto</code> option is used in /etc/fstab. With <code>noauto</code>, the device can be only mounted explicitly.
; <code>dev</code> / <code>nodev</code>
: Controls behavior of the interpretation of block special devices on the filesystem.
; <code>exec</code> / <code>noexec</code>
: <code>exec</code> lets binaries that are on the partition be executed, whereas <code>noexec</code> is the opposite. <code>noexec</code> might be useful for a partition that contains no binaries, like /var, or contains binaries the user may not want to execute on the system, or that cannot even be executed on the system, as might be the case of a Windows partition.
; <code>rw</code> / <code>ro</code>
: Mount the filesystem in either read write or read only mode. Explicitly defining a file system as <code>rw</code> can alleviate some problems in file systems that default to read only, as can be the case with floppies or [NTFS](/source/NTFS) partitions.
; <code>sync</code> / <code>async</code>
: How the input and output to the filesystem should be done. <code>sync</code> means it is done synchronously. Looking at the example fstab, this is the option used with the floppy. This means that when, for example, a file is copied to the floppy, the changes are physically written to the floppy at the same time copy command is issued.
; <code>suid</code> / <code>nosuid</code>
: Controls the behavior of the operation of [suid](/source/setuid), and [sgid](/source/setgid) bits.
; <code>user</code> / <code>users</code> / <code>nouser</code>
: <code>user</code> permits any user to mount the filesystem. This automatically implies <code>noexec</code>, <code>nosuid</code>, <code>nodev</code> unless explicitly overridden. If <code>nouser</code> is specified, only [root](/source/Superuser) can mount the filesystem. If <code>users</code> is specified, every user in group ''users'' will be able to unmount the volume.
; <code>defaults</code>
: Use default settings. Default settings are defined per file system at the file system level. For [ext3](/source/ext3) file systems these can be set with the ''tune2fs'' command. The normal default for [ext3](/source/ext3) file systems is equivalent to <code>rw,suid,dev,exec,auto,nouser,async</code>. Modern Red Hat based systems set [ACL](/source/Access-control_list) support as default on the root file system but not on user-created ext3 filesystems. Some file systems such as [XFS](/source/XFS) enable ACLs by default. Default file system mount attributes can be overridden in /etc/fstab.
; <code>owner</code> (Linux-specific)
: Permit the owner of device to mount.
; <code>nofail</code>
: Do not stop system boot if disk mount failed.
; <code>atime</code> / <code>noatime</code> / <code>relatime</code> / <code>strictatime</code> / <code>lazytime</code> (Linux-specific)
:The Unix [stat](/source/stat_(Unix)) structure records when files are last accessed (''atime''), modified (mtime), and changed (''ctime''). One result is that [atime](/source/atime_(Unix)) is written every time a file is read, which has been heavily criticized for causing performance degradation and increased wear. However, atime is used by some applications and desired by some users, and thus is configurable as atime ''(update on access)'', noatime ''(do not update)'', or (in Linux) relatime ''(update atime if older than mtime)''. Through Linux 2.6.29, ''atime'' was the default; as of 2.6.30, ''relatime'' is the default.<ref>[http://kernelnewbies.org/Linux_2_6_30 Linux 2 6 30] at Linux Kernel Newbies</ref>

==Filesystem-specific options==
There are many options for the specific filesystems supported by <code>mount</code>. 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](/source/Unix-like) systems have generally provided similar functionality but with slightly different syntax or forms.

===ext2===
; <code>check=[none, normal, strict]</code>
: Sets the fsck checking level.
; <code>debug</code>
: Print debugging info on each remount.
; <code>sb=n</code>
: <code>n</code> is the [block](/source/Block_(data_storage)) which should be used as the super-block for the filesystem.

===FAT-only===
; <code>check=[r(elaxed), n(ormal), s(trict)]</code>
: Policy for allowed filenames. See <code>mount(8)</code>.
; <code>conv=[b(inary), t(ext), a(uto)]</code>
: Performs DOS <=> UNIX text file conversions automatically. See <code>mount(8)</code>.

===FAT, NTFS===
; <code>windows_names</code>
: Linux filesystems have a larger set of allowed characters in filenames. <code>windows_names</code> restricts the set of allowed characters for the volume to only those acceptable by Windows; though FAT/NTFS are the most common use cases, this feature is not specifically restricted to those filesystem types.
; <code>uid=n</code>, <code>gid=n</code>
: Sets the user identifier ([uid](/source/User_identifier_(Unix))), and group identifier ([gid](/source/Group_identifier_(Unix))) for all files on the filesystem.
; <code>umask=nnn, dmask=nnn, fmask=nnn</code>
: Controls masking of filesystem nodes.
::{{ubl
|[umask](/source/umask) - user file creation
|dmask - directory creation 
|[fmask](/source/fmask) - for files only
}}

More detailed information about the fstab file can be found in the [man page](/source/Manual_page_(Unix)) for [http://www.die.net/doc/linux/man/man5/fstab.5.html Linux fstab]; for other systems see below.

===NFS===
; <code>addr=ip</code>
: <code>ip</code> is a valid [IP address](/source/IP_address).

==See also==
* [mount (computing)](/source/mount_(computing))
* [mount (Unix)](/source/mount_(Unix))
* [mtab](/source/mtab)

==References==
{{reflist}}
{{Refimprove|date=March 2010}}
{{refbegin}}
{{refend}}

==External links==
* {{man|5|fstab|OpenBSD}}
* {{man|5|fstab|NetBSD}}
* {{man|5|fstab|FreeBSD}}
* {{man|5|vfstab|Solaris}}
* [http://man.he.net/?topic=fstab&section=all fstab man page] from [Linux](/source/Linux)
* {{man|5|fstab|die.net}}
* [https://web.archive.org/web/20100507180415/http://manpages.ubuntu.com/manpages/karmic/en/man5/fstab.5.html fstab (5)] - on a [http://manpages.ubuntu.com/ Ubuntu Manpage Repository]
* [https://kfstab.sourceforge.net/ Kfstab]
{{unix commands}}

Category:Configuration files
Category:Unix file system technology

---
Adapted from the Wikipedia article [Fstab](https://en.wikipedia.org/wiki/Fstab) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Fstab?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
