Fstab
Encyclopedia
The fstab (or file system
s table) file is a system configuration
file commonly found on Unix
systems. The fstab file typically lists all available disks and disk partitions, and indicates how they are to be initialized or otherwise integrated into the overall system's file system. fstab is still used for basic system configuration, notably of a system's main hard drive and startup file system, but for other uses has been superseded in recent years by automatic mounting.
The fstab file is most commonly used by the
to properly create and maintain this file.
The file has other names on some versions of Unix
; for instance, it is
.
Modern Linux
systems use udev
as an automounter
to handle hot swapping
devices instead of rewriting the fstab file on the fly, and thus fstab is less important than in the past. Programs such as pmount allow non-root users to mount and unmount filesystems without a corresponding fstab entry; traditional Unix has always allowed privileged users to mount
or unmount without an fstab entry.
system:
The columns are as follows:
A value of zero in either of the last 2 columns disables the corresponding feature. For the whitespace character in paths the character code "\040" is used.
The options common to all filesystems are:
More detailed information about the fstab file can be found in the man page
about Linux fstab; for other systems see below.
This 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 "
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...
s table) file is a system configuration
Computer configuration
In communications or computer systems, a configuration is an arrangement of functional units according to their nature, number, and chief characteristics. Often, configuration pertains to the choice of hardware, software, firmware, and documentation...
file commonly found on Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
systems. The fstab file typically lists all available disks and disk partitions, and indicates how they are to be initialized or otherwise integrated into the overall system's file system. fstab is still used for basic system configuration, notably of a system's main hard drive and startup file system, but for other uses has been superseded in recent years by automatic mounting.
The fstab file is most commonly used by the
mountMount (Unix)The Unix command line utility mount instructs the operating system that a file system is ready to use, and associates it with a particular point in the system's file system hierarchy . The counterpart umount instructs the operating system that the file system should be disassociated from its mount...
command, which reads the fstab file to determine which options should be used when mounting the specified device. It is the duty of the system administratorSystem administrator
A system administrator, IT systems administrator, systems administrator, or sysadmin is a person employed to maintain and operate a computer system and/or network...
to properly create and maintain this file.
The file has other names on some versions of Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
; for instance, it is
/etc/vfstab
on Solaris.Modern use
Traditionally, the fstab was only read by programs, and not automatically written (it is instead manually written by the sysadmin). 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 KDEKDE
KDE is an international free software community producing an integrated set of cross-platform applications designed to run on Linux, FreeBSD, Microsoft Windows, Solaris and Mac OS X systems...
.
Modern Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
systems use udev
Udev
udev is the device manager for the Linux kernel. Primarily, it manages device nodes in /dev. It is the successor of devfs and hotplug, which means that it handles the /dev directory and all user space actions when adding/removing devices, including firmware load.-History:udev was new in Linux...
as an automounter
Automounter
An automounter is any program or software facility which automatically mounts filesystems in response to access operations by user programs. An automounter system utility , when notified of file and directory access attempts under selectively monitored subdirectory trees, dynamically and...
to handle hot swapping
Hot swapping
Hot swapping and hot plugging are terms used to describe the functions of replacing computer system components without shutting down the system...
devices instead of rewriting the fstab file on the fly, and thus fstab is less important than in the past. Programs such as pmount allow non-root users to mount and unmount filesystems without a corresponding fstab entry; traditional Unix has always allowed privileged users to mount
Mount (Unix)
The Unix command line utility mount instructs the operating system that a file system is ready to use, and associates it with a particular point in the system's file system hierarchy . The counterpart umount instructs the operating system that the file system should be disassociated from its mount...
or unmount without an fstab entry.
Example
The following is an example of an fstab file on a typical LinuxLinux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
system:
The columns are as follows:
- The device name or other means of locating the partition or data source.
- The mount point, where the data is to be attached to the filesystem.
- The filesystem type, or the algorithm used to interpret the filesystem.
- Options, including if the filesystem should be mountMount (computing)Mounting takes place before a computer can use any kind of storage device . The user or their operating system must make it accessible through the computer's file system. A user can access only files on mounted media.- Mount point :A mount point is a physical location in the partition used as a...
ed at boot. (kudzu is an option specific to Red HatRed Hat LinuxRed Hat Linux, assembled by the company Red Hat, was a popular Linux based operating system until its discontinuation in 2004.Red Hat Linux 1.0 was released on November 3, 1994...
and Fedora CoreFedora (operating system)Fedora is a RPM-based, general purpose collection of software, including an operating system based on the Linux kernel, developed by the community-supported Fedora Project and sponsored by Red Hat...
.) - dump-freq adjusts the archiving schedule for the partition (used by dumpDump (program)dump is a Unix program used to back up file systems. It operates on blocks, below filesystem abstractions such as files and directories. Dump can back up a file system to a tape or another disk...
). - pass-num Controls the order in which fsck checks the device/partition for errors at boot time. The root device should be 1. Other partitions should be either 2 (to check after root) or 0 (to disable checking for that partition altogether).
A value of zero in either of the last 2 columns disables the corresponding feature. For the whitespace character in paths the character code "\040" is used.
Common options 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:
atime / noatime / relatime / strictatime (Linux-specific)
- The Unix statStat (Unix)stat is a Unix system call that returns useful data about a file inode. The semantics of stat vary between operating systems. As an example, the Unix command ls uses it to retrieve information on : time of last modification , time of last status change and time of last access .-stat functions and...
structure records when files are last accessed (atime), modified (mtime), and created (ctime). One result is that atime 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 (9 June 2009), relatime is the default.
auto / noauto
- With the auto option, the device will be mounted automatically at bootup or when the mount -a command is issued. auto is the default option. If you do not want the device to be mounted automatically, use the noauto option in /etc/fstab. With noauto, the device can be only mounted explicitly.
dev / nodev
- Interpret/do not interpret block special devices on the filesystem.
exec / noexec
- exec lets you execute binaries that are on that partition, whereas noexec does not let you do that. noexec might be useful for a partition that contains no binaries, like /var, or contains binaries you do not want to execute on your system, or that cannot even be executed on your system. Last might be the case of a Windows partition.
ro
- Mount read-only.
rw
- Mount the filesystem read-write. Again, using this option might alleviate confusion on the part of new Linux users who are frustrated because they cannot write to their floppies, Windows partitions, or other media.
sync / async
- How the input and output to the filesystem should be done. sync means it is done synchronously. If you look at the example fstab, you will notice that this is the option used with the floppy. In plain English, this means that when you, for example, copy a file to the floppy, the changes are physically written to the floppy at the same time you issue the copy command.
suid / nosuid
- Permit/Block the operation of suidSetuidsetuid and setgid are Unix access rights flags that allow users to run an executable with the permissions of the executable's owner or group...
, and sgid bits.
user / users / nouser
-
user
permits any user to mount the filesystem. This automatically implies noexec, nosuid, nodev unless overridden. Ifnouser
is specified, only root can mount the filesystem. Ifusers
is specified, every user in group users will be able to unmount the volume.
owner
(This is Linux-specific)
- Permit the owner of device to mount.
defaults
- Use default settings. Default settings are defined per file system at the file system level. For ext3 file systems these can be set with the tune2fs command. The normal default for Ext3 file systems is equivalent to
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 over ridden in /etc/fstab.
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}
- Sets the fsck checking level.
debug
- Print debugging info on each remount .
sb=n
- n is the block which should be used as the superblock for the fs.
fat
check={r[elaxed], n[ormal], s[trict]}
- Not the same as ext2, but rather deals with allowed filenames. See mount(8).
conv={b[inary], t[ext], a[uto]}
- Performs DOS <---> UNIX text file conversions automatically. See mount(8).
uid=n, gid=n
- Sets the user identifier, uidUser identifier (Unix)Unix-like operating systems identify users within the kernel by an unsigned integer value called a user identifier, often abbreviated to UID or User ID...
, and group identifier, gidGroup identifier (Unix)In Unix-like systems, multiple users can be categorized into groups. POSIX and conventional Unix file system permissions are organized into three classes, user, group, and others. The use of groups allows additional abilities to be delegated in an organized fashion, such as access to disks,...
, for all files on the filesystem.
umask=nnn, dmask=nnn, fmask=nnn
- Sets the user file creation mode mask, umaskUmaskumask is a command and a function in POSIX environments that sets the file mode creation mask of the current process which limits the permission modes for files and directories created by the process...
, the same for directories only, dmask and for files only, fmaskFmaskFmask is a unix command.The following is copy pasted from man mount. umask=value Set the umask . The default is the umask of the current process. The...
.
iso9660
norock
- Disables Rock RidgeRock RidgeThe Rock Ridge Interchange Protocol is an extension to the ISO 9660 volume format, commonly used on CDROM and DVD media, which adds POSIX file system semantics...
extensions.
More detailed information about the fstab file can be found in the man page
Manual page (Unix)
Man pages are the extensive documentation that comes preinstalled with almost all substantial Unix and Unix-like operating systems. The Unix command used to display them is man. Each page is a self-contained document.- Usage :...
about Linux fstab; for other systems see below.
Mounting 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.External links
- fstab man page via OpenBSDOpenBSDOpenBSD is a Unix-like computer operating system descended from Berkeley Software Distribution , a Unix derivative developed at the University of California, Berkeley. It was forked from NetBSD by project leader Theo de Raadt in late 1995...
- fstab man page by NetBSDNetBSDNetBSD is a freely available open source version of the Berkeley Software Distribution Unix operating system. It was the second open source BSD descendant to be formally released, after 386BSD, and continues to be actively developed. The NetBSD project is primarily focused on high quality design,...
- fstab man page via FreeBSDFreeBSDFreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...
- fstab man page from LinuxLinuxLinux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
- fstab (5) - on a Ubuntu Manpage Repository
- How to edit and understand /etc/fstab
- Getting to Know Your fstab
- Kfstab