FSTAB & MTAB

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

INTRODUCTION

These are some of those critical programs for your computer. Without these, your computer will not know where to find any of the partitions or drives on the computer. Goof this up and you can be dead in the water. Never make any changes without a good backup copy.

(1) /etc/fstab

In this file there is a description of the various file systems. Commands like ¨fsck¨ and ¨mount¨ consult this file for the actions they take.
This looks like a complicated description of the files on your computer, but it is really simple if you break it down into the parts of each entry. Take a look below.
In order for certain programs to be able to determine where certain partitions are supposed to be mounted by default, the /etc/fstab file is used

Understanding the /etc/fstab file in Linux

The file systems and their mount points in the directory tree are_configured in the file /etc/fstab. This file contains 1 line with 6 fields for each mounted file system. The lines look similar to the following:

Each field provides the following information for mounting the file system:


Field 1: Lists the name of the device file, or the file system label, or the UUID (Universally Unique Identifier). Also Use of LABEL=label or UUID=uuid has the advantage that the partition is mounted correctly even if the device file used changes, for instance or because you swapped hard disks on the IDE controller.


Field 2. Lists the mount point—the directory to which the file system should be mounted. The directory specified here must already exist. You can access the content on the media by changing to the respective directory.


Field 3. Lists the file system type (such as ext2, xfs, swap and ext4).


Field 4. Shows the mount options.Multiple mount options separated by commas (such as noauto, user,sync or defaults).


Field 5. Indicates whether to use the backup utility dump for the file system. 0 means no backup.


Field 6. Indicates the sequence of the file system checks (with the fsck utility) when the system is booted:

  • 0: file systems that aren’t be checked.
  • 1: the root directory.
  • 2: all other modifiable file systems; file systems which on different drives checked in parallel.

(2) /etc/mtab

The mtab (contraction of mounted file systems table) file is a system information file, commonly found on Unix-like systems.

This file handles the mounted devices and is automatically updated by the mount command.
And it looks a bit similar to fstab but not the 100% same ( notice rw and ro for read/write and read only ) And it does only lists the mounted devices !

Important Notes:

1– While /etc/fstab lists the file systems and where they should be mounted in the directory tree during startup, it does not contain information on the actual current mounts.

2– The /etc/mtab file lists the file systems currently mounted and their mount points. The mount and umount commands affect the state of mounted file systems and modify the /etc/mtab file.

3– The kernel also keeps information for /proc/mounts, which lists all currently mounted partitions. For troubleshooting purposes, if there is a conflict between /proc/mounts and /etc/mtab information, the /proc/mounts data is always more current and reliable than /etc/mtab.

View Currently Mounted File Systems:

You can view the file systems currently mounted by entering the command mount. Information similar to the following appears:

You can also view this information in the file /proc/mounts.

 cat /proc/mounts

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
MQ-Jr
MQ-Jr
unixcop Admin

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook