Understanding the /proc/mounts, /etc/mtab and /proc/partitions files

Linux provides you with many tools for modifying file systems after applying them to storage devices. In this post, we will learn about many OS configurations file which holds the mount point information.

The /proc/mounts file

The /proc/mounts file lists the status of all currently mounted file systems in a format similar to fstab: the system’s name, mount point, file system type, etc. It is actually not a real file, but part of the virtual file system that represents the status of mounted objects as reported by the Linux kernel. Typically, you’d read this “file” using a command like cat in order to get the details you’re looking for.

Note that /proc/mounts lists all file systems, not just those on storage drives and partitions. It may not be the most readable tool to use in case you’re only looking for drive information.

The mtab file

The /etc/mtab file is very similar to the /proc/mounts file in that it reports the status of currently mounted file systems. However, /proc/mounts is typically more accurate and include more up-to-date information about the file systems.

The /proc/partitions file

The /proc/partitions file contains information about each partition that is currently attached to the system. Like /proc/mounts, it is not a real file but part of the virtual file system. The format of /proc/partitions contains columns, and each column is as follows:

  • major— Represents the class of device so that it can be mapped to an appropriate driver.
  • minor — Separates partitions into physical devices. This corresponds to the number at the end of the partition’s name.
  • #blocks — How many physical blocks the partition takes up.
  • name — The name of the partition.
  • The /proc/partitions file example:

    Related Post