The “fstab” is known as the “File System Table” configuration file located in the “etc” directory. It holds the information on the mounted storage devices and partitions during boot time. The fstab configuration file is changed by adding and manipulating its entry. This entry assists in auto-mounting and unmounting the filesystem on Linux.
This post will explain the components of an entry in a fstab config file in Linux.
How to Understand an Entry in fstab in Linux?
The “fstab” file can be easily accessed through the following “sudo” command in the default “nano” text editor:
$ sudo nano /etc/fstab
The output shows that the entry syntax contains six entries for each file system. Let’s look at the details of each entry field highlighted in the above table.
First Field: File System
The first field in each “fstab” entry shows the local/remote mounted block devices’ “UUID” and “Label”.
- UUID: It stands for “Universal Unique Identifier”, which denotes the “36-character alphanumeric” string. It can be used to identify the disk partition information uniquely.
- Label: The partition label(optional) assigns to the partition for identification purposes. In most cases, it is nameless.
To get the “UUID” and “Label” of all the partitions of the “sda” block device, execute the “lsblk” command with the “fs” flag:
$ lsblk -fs /dev/sda1 $ lsblk -fs /dev/sda2 $ lsblk -fs /dev/sda3
The output contains the “UUID” and the “LABEL” fields of the disk partitions.
Second Field: Mount Point
The second field corresponds to the “Mount point”, which shows the absolute path of the mounted devices. Execute the “lsblk” command with the combination of “-fs” flags:
$ lsblk -fs
Third Field: Type
The third field of the “fstab” specifies the “Filesystem Type”. There are different “types” of Linux file systems, such as “ext3”, “ext4”, “FAT”, “XFS”, and much more. The “FSTYPE” column of the following command represents the filesystem type in Linux:
$ lsblk -fs
In the output, the highlighted “vfat”, and the “ext4” denotes the file type of partition “/dev/sda2”, and “/dev/sda3”.
The user can also view the partitions file system type by just running the following “lsblk” command:
$ lsblk -f -e7
Fourth Field: Options
The fourth field, the “options”, corresponds to the “mount” command option while mounting the filesystem. To list these options, use the command:
$ man mount
Scroll down the page for more options.
Note: Some of the options of mount commands come by default, such as “rw”, “dev”, “exec”, “auto”, “nouser”, and “async”. To assign these options, type the “default” keyword as a value in the “options” field.
Fifth Field: Dump
The fifth “dump” field is used for checking which file system is needed to be dumped. It is mostly used for backup options. Its value is denoted by binary digits “0” and “1”, which refer to the “No backup” and “backup” of the partition.
Sixth Field: Pass
The sixth field, “pass”, corresponds to the “fsck order” used by the “fsck” utility to build up an order to check the file system at rebooting. This checking procedure is done sequentially within the drive using three values “0”, “1”, and “2”:
- “0” denotes that the file system is checked and passed.
- “1” specifies the root filesystem.
- “2” identifies the other filesystem partitions.
Note: If its value is not set, it will default select the “0” value, and the file system will not be checked.
In Linux, an entry of the “fstab” file comprises six different columns, that are, “file system”, “mount point”, “type”, “options”, “dump”, and “pass”. Each entry performs a specific task and has its own value in the “fstab” file structure. This post has briefly demonstrated each column/filed of an entry in the “fstab” file.