Knowledge about Linux /etc/fstab file

In this article I would run over quickly on the linux file system table and configuration which I ran into recently.

Operating systems have come a long way in recent years. They have a smaller footprint, are more efficient with resource management, and have become much faster than early computing systems.

For all of the improvements made, there are still “old school” pieces of the puzzle that we simply can’t live without. Filesystems, and by necessity, filesystem tables, are one of these constants. These can be a bit tricky for a lot of users, so we will look at /etc/fstab (fstab) a little closer.

What is it?

Your Linux system’s filesystem table, aka fstab, is a configuration table designed to ease the burden of mounting and unmounting file systems to a machine. It is a set of rules used to control how different filesystems are treated each time they are introduced to a system.

Consider USB drives, for example. Today, we are so used to the plug and play nature of our favorite external drives that we may completely forget that operations are going on behind the scenes to mount the drive and read/write data.

In the time of the ancients, users had to manually mount these drives to a file location using the mount command. The fstab file became an attractive option because of challenges like this.

It is designed to configure a rule where specific file systems are detected, then automatically mounted in the user's desired order every time the system boots. Not only is it less work over time, but it also allows the user to avoid load order errors that could eat up valuable time and energy.

Table structure

The table itself is a 6 column structure, where each column designates a specific parameter and must be set up in the correct order. The columns of the table are as follows from left to right:

  • Device: usually the given name or UUID of the mounted device (sda1/sda2/etc).
  • Mount Point: designates the directory where the device is/will be mounted.
  • File System Type: nothing trick here, shows the type of filesystem in use.
  • Options: lists any active mount options. If using multiple options they must be separated by commas.
  • Backup Operation: (the first digit) this is a binary system where 1 = dump utility backup of a partition. 0 = no backup. This is an outdated backup method and should NOT be used.
  • File System Check Order: (second digit) Here we can see three possible outcomes. 0 means that fsck will not check the filesystem. Numbers higher than this represent the check order. The root filesystem should be set to 1 and other partitions set to 2.

Location and options

Obviously your table will be different depending on your environment, however, I want to look at an example using a virtual machine so that we can see what information is provided and break down what we are seeing. You will see my fstab below:

[root@xxxx ~]# cat /etc/fstab#
# /etc/fstab
# Created by anaconda on Mon Aug 15 15:08:11 2022
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
/dev/mapper/vg00-root / ext4 defaults,noatime,nodiratime,_netdev,_netdev 1 1
UUID=2987bce9-a48c-470c-bd98-787fe229b404 /boot ext4 defaults,_netdev,_netdev,x-initrd.mount 1 2
/dev/mapper/vg00-swap swap swap defaults 0 0

## If you are adding an iSCSI remote block volume to this file you MUST
## include the '_netdev' mount option or your instance will become
## unavailable after the next reboot.
## SCSI device names are not stable across reboots; please use the device UUID instead of /dev path.
## Example:
## UUID="94c5aade-8bb1-4d55-ad0c-388bb8aa716a" /folder xfs defaults,noatime,_netdev 0 2

tmpfs /tmp tmpfs nodev,nosuid,noexec 0 0
tmpfs /var/tmp tmpfs nodev,nosuid,noexec 0 0

# # /dev/mapper/vg00-swap none swap sw,_netdev,comment=cloudconfig 0 0

This table consists of six columns defining certain parameters around a given filesystem. The first thing that pops out at you is the comments in the header. For now, ignore the Created by section and move to the Accessible filesystems portion.

These directories and man pages are worth noting and can provide valuable information should you need it. Next, skip down to the After editing section and note the systemctl daemon-reload command used to update the systemd components after making changes to this file.

Now that we have looked at the comments, let’s break down the actual configuration that is present and look at the various bits of info that a user needs to note.

The first (and only, in this case) filesystem that you see is the root filesystem for this VM /dev/mapper/vg00-root. You also see that it is an ext4 filesystem. You may see any number of options here, such as xfs, ext4, fat file systems, etc. Directly below the root filesystem, you find the Universally Unique Identifier (UUID). The UUID remains persistently assigned to the filesystem. UUIDs are a great way to label filesystems, especially in smaller environments. However, they can lead to issues in larger environments where network-based drives are in use. I digress the UUID of my filesystem here is:

UUID = 2987bce9-a48c-470c-bd98–787fe229b404

You also see that there is a swap partition present at this location, as well as the mount point for the root filesystem /. Moving to the right, you see a pair of zero's. The first zero is a binary option (0=false and 1=true) for "dumping." This is an outdated backup method and should be set to zero or unused. The next number to the right tells the system to run a filesystem check or fsck. Here, an option of 0 = skip. The root filesystem should be set to 1 and any others you want to be checked assigned after that.

NOTE: These options must be listed in order if the configuration is to work correctly.

Advanced Usage

There are other options for more advanced users that I do not have configured here (therefore, there are no examples shown). However, there are some great resources on the web to explain these options. The ones that I would check out are as follows:

  1. auto/noauto: controls whether the partition is mounted automatically on boot (or not).
  2. exec/noexec: controls whether or not the partition can execute binaries. In the name of security, this is usually set to noexec.
  3. ro/rw: controls read and write privileges — ro = read-only, where rw= read-write.
  4. nouser/user: controls whether or not the user has mounting privileges. This defaults to noexec for all user accounts.


Hopefully, you now have a better grasp of the purpose of /etc/fstab and can make sense of what is shown on your system. Many casual users do not use this file.



Sr. SRE at Oracle, Ex-PayPal, Ex-RedHat. Professional Graduate Student interested in Cloud Computing and Advanced Big Data Processing and Optimization.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Hemant Jain

Sr. SRE at Oracle, Ex-PayPal, Ex-RedHat. Professional Graduate Student interested in Cloud Computing and Advanced Big Data Processing and Optimization.