Understanding The /etc/mtab File in Linux System

In this article, we will explore the /etc/mtab file on a Linux system and understand the various parameters and directives included therein.

What is /etc/mtab File in Linux

The /etc/mtab file is a file that contains a list of currently mounted filesystems. Any mounted filesystem will appear here. In case you have a disk or volume that is not mounted, it will not show up in this file.

The /etc/mtab file is similar to that of the /etc/fstab file but differs slightly. Also, the latter is applied on boot time whilst the /etc/mtab file displays what is currently mounted.

The file is common in UNIX-like systems and is used by the mount and umount commands to mount and unmount volumes.

You can view the /etc/mtab file using the cat command as shown.

$ cat /etc/mtab

Or access it using your favorite text editor. In this example, we have opened the file using the vim text editor.

$ vim /etc/mtab
View /etc/mtab File
View /etc/mtab File

You can display the same information by viewing the /proc/mounts file as shown.

$ cat /proc/mounts
Show Mounted File Systems on Linux
Show Mounted File Systems on Linux

Understand /etc/mtab File

The /etc/mtab file comprises 6 columns which are separated by white space. The fourth option comprises a list of comma-separated mount options.

Let’s take an example of the following entry.

sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
  • The first column represents the mount device name – In this case sysfs.
  • The second column represents the mount point or where the device is mounted. Here, /sys is the mount point for the sysfs device.
  • The third column shows the file system of the device. In this case, sysfs.
  • The fourth column displays the mount options, which in most cases are separated by commas. These options indicate the directives for mounting the partition. Here, the mount options are rw,nosuid,nodev,noexec,relatime.
  • The fifth and sixth columns are the dump and fsck options respectively.

The dump command uses the dump option to back up a filesystem. This value is redundant and does not hold any meaning in the /etc/mtab file. The option is always 0 and is only included as a formality to make the mtab file congruent with the /etc/fstab file.

The fsck command leverages the last option to probe the filesystem for errors. And just like the dump option, the value is always 0 and holds no meaning. It’s present only for formality’s sake.

Conclusion

In this guide, we have looked at the /etc/mtab file and its purpose. We have further seen the various columns and options present in every line or entry.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Winnie Ondara
My name is Winnie, a Linux enthusiast and passionate tech writer in Linux and DevOPs topics. I enjoy keeping abreast with the latest technologies in the Linux ecosystem and trying out new tools provided by the FOSS community.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

2 Comments

Leave a Reply
  1. Would have been nice if you went one extra and discussed the different types of filesystems. Like, proc, sysfs, cgroup, debugfs, devpts, tmpfs…

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.