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.

Two small things before you go

If something didn’t work on your setup, leave a comment and tell me which distro and version you’re on. I read every one, and most of these articles got better because a reader pointed out what was missing.

And if it did work, share it. TecMint has stayed free for 14 years because people pass these articles around, and that traffic is what pays for writing the next one.

Leave a comment
Get two free Linux courses

Learn the Linux basics with two free courses and join 34,000+ readers getting practical TecMint tutorials and selected Pro TecMint articles every week.

Pro TecMint
Get lifetime access for $99

If you want to go beyond the free tutorials, Pro gives you 18 courses, 5 ebooks, and every future course I add. One payment, lifetime access, no renewals.

Winnie Ondara
Winnie Ondara
Contributor
About the author

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.

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.