Skip to content
Search

Fstab

lastmod 2025-12-15created 2017-01-1711 edits

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.

You can configure automatic mount and umount at boot. Be careful: an incorrect edit may cause the boot to fail. Just edit the /etc/fstab file.

Field

If you open the /etc/fstab file, it looks something like this:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=a607ddf7-4cfe-4e93-8574-0a5dd7613a4b /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=1234-5678  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

FileSystem Device Name

The file system device name is the location of the partitions. If you look at the output of fdisk -l above, you will see the locations, i.e. addresses, of the partition devices from /dev/sdb1 to /dev/sdb6. This field is where you write such a device name. You can write it as is, like /dev/sdb1, but you can also use a label (Label). After introducing the other fields, I'll give an example that uses both labels and device names.

Mount Point

This field sets which directory the partition being registered is attached to. Just write the path of the directory to mount it on.

FileSystem Type

This field holds the file system type you chose when creating the partition.

  • ext - The type used in early Linux; no longer used.
  • ext2 - Still in use; notable for supporting long file names.
  • ext3 - A journaling file system that greatly improves file system recovery/security over ext2; currently used as the default file system.
  • ext4 - Unlike ext3, which supported only up to 16TB, it supports larger capacities, and has faster recovery of deleted files and file system checks.
  • iso9660 - The standard file system for DVD/CD-ROM; read-only.
  • nfs - The system used to mount file systems from a remote server (Network File System)
  • swap - Swap file system; used for file systems used as swap space.
  • ufs - Used as the standard file system on Unix systems. (Unix File System)
  • vfat - Used for file systems that support ntfs for Windows 95/98, etc.
  • msdos - Used for file systems that use MS-DOS partitions.
  • ntfs - Used for file systems that support nfts of Windows NT/2000.
  • hfs - Used for file systems that support hfs of MAC computers.
  • hpfs - Used for file systems that support hpfs.
  • sysv - Used for file systems that support Unix system v.
  • ramdisk - Used for file systems that support RAM.

Mount Option

This field sets the options used for the file system. The options are as follows.

  • default - Sets all of the rw, nouser, auto, exec, and suid attributes
  • auto - Mount automatically at boot
  • noauto - Do not mount automatically at boot
  • exec - Allow executables to run
  • noexec - Do not allow executables to run
  • suid - Allow use of SetUID and SetGID
  • nosuid - Do not allow use of SetUID and SetGID
  • ro - Set as a read-only file system
  • rw - Set as a read/write-only file system
  • user - Regular users can mount
  • nouser - Regular users cannot mount; only root can
  • quota - Quota can be configured
  • noquota - Quota cannot be configured

Dump

This field sets whether the file system should be dumped (backed up). The dump option has only 0 and 1.

  • 0 - Disable dump
  • 1 - Enable dump

File Sequence Check Option

Option that sets the priority of integrity checks by fsck. There are three options in total: 0, 1, and 2.

  • 0 - No integrity check.
  • 1 - Priority 1; usually set on the root.
  • 2 - Priority 2; checked after priority 1.

Example

First, check the disk's UUID.

You can check it with the sudo blkid command:

...
/dev/sdb1: UUID="2eb05ca0-7da7-41be-a6bf-a8870e8acd55" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3150b7c0-95d9-41cf-a565-be595420f944"
...

Note the UUID value here. (Not the PARTUUID that follows!)

Then add it to the /etc/fstab file, applying the default options used when adding with gnome-disks.

UUID=2eb05ca0-7da7-41be-a6bf-a8870e8acd55  /mnt/2eb05ca0-7da7-41be-a6bf-a8870e8acd55       ext4    nosuid,nodev,nofail,x-gvfs-show      0       2
  • UUID=2eb05ca0-7da7-41be-a6bf-a8870e8acd55 - Disk identifier (Identify As)
  • /mnt/2eb05ca0-7da7-41be-a6bf-a8870e8acd55 - Mount point (Mount Point). It doesn't have to be the UUID; any name you like will do.
  • ext4 - The Filesystem Type checked with blkid above. If you're not sure, set it to auto (auto-detect).
  • nosuid,nodev,nofail,x-gvfs-show - Mount options
    • nosuid - Ignore setuid bits (security)
    • nodev - Ignore device files (security)
    • nofail - Continue booting even if the mount fails
    • x-gvfs-show - Show in the GNOME file manager
  • 0 - Disable dump backup
  • 2 - fsck check order (1 for root, 2 for the rest)

Troubleshooting

Boot error

If an error occurs after editing the /etc/fstab file to mount automatically at boot, try setting only auto in the mount options.

Also, if the mount point Directory does not exist, create it.

See also

See also

Favorite site

author Zer0 sitemap