Fstab
fstab is a system file commonly found in the directory
/etc on Unix and Unix-like computer systems. The /etc/fstab file is used by utilities from the util-linux package, but it's not limited to them — it is also processed by systemd via systemd-fstab-generator for automatic mounting during boot. The fstab file typically lists all available disk partitions 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.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 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.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 a corresponding fstab entry.
Example
The following is an example of an fstab file on a typical Linux system.- device-spec mount-point fs-type options dump pass
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
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,ro 0 0
- NTFS Windows 11 partition
- Partition shared by Windows and Linux
- Mounting tmpfs
- Mounting cifs
- Mounting NFS
The order of records in fstab is important because fsck, mount, and umount sequentially iterate through fstab and mount in the order defined.
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, 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
defaultsrefers 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 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:
Options common to all filesystems
;auto / noauto;
dev / nodev;
exec / noexec;
rw / ro;
sync / async;
suid / nosuid;
user / users / nouser;
defaults;
owner ;
nofail;
atime / noatime / relatime / strictatime / lazytimeFilesystem-specific options
There are many options for the specific filesystems supported bymount. 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 or forms.ext2
;check=;
debug;
sb=nFAT-only
;check=;
conv=FAT, NTFS
;windows_names;
uid=n, gid=n;
umask=nnn, dmask=nnn, fmask=nnnMore detailed information about the fstab file can be found in the man page for ; for other systems see below.
NFS
;addr=ip