How to understand /etc/mtab?
/dev/mapper/VolGroup00-LogVol00 / ext3 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
/dev/sda1 /boot ext3 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
What does the 6 columns mean?
mtab lists currently mounted file systems and is used by the mount and unmount commands when you want to list your mounts or unmount all. It's not used by the kernel, which maintains its own list (in /proc/mounts
or /proc/self/mounts
). Its structure is the same as fstab (see manpage).
Separated by whitespace, its 6 columns are:
- Mount device if applicable or "none"
- Mount point
- File system
- Mount options
- Used by the dump command, 0 to ignore*
- Used by the fsck command (which order to check at boot), 0 to ignore*
*Note: mtab places a dummy value into the 5th and 6th columns so that the file retains the same structure as fstab. These columns do not have any meaning in mtab.
The /etc/mtab
file shares the same structure as /etc/fstab
. According to this site the 5th and 6th column in /etc/fstab
are used to store "Dump and fsck options". The 5th column is used to determine if dumping of the partition should be made, and the 6th to decide if an fsck must be processed on the partition.
In /etc/mtab
, however, this two options loose their sense. Indeed, these two options are used when mounting the partitions, and /etc/mtab
lists the partitions that are already mounted. If I understand it correctly, these option are not useful in /etc/mtab
. They may be here for compatibility reasons with /etc/fstab
, as the content of /etc/mtab
must be directly usable in /etc/fstab
The columns in /etc/mtab
are the same as /etc/fstab
, except they represent currently mounted filesystems instead of those configured to be mounted by the installation or sysadmin.
You used to be able to cat /etc/mtab > /etc/fstab
to save the current configuration of mounted filesystems for future boots. I wouldn't recommend this these says, asmtab
does not preserve mounts by label or UUID, such as UUID=
or LABEL=
in /etc/fstab, which is quite common in distros these days. This will cause problems for devices which may not boot in the same order, such as external USB or eSATA drives.
man fstab
will give you a description of the columns.
The /etc/mtab file is the list of mounted file systems it is maintained by the mount and unmount programs. It's format is similar to the fstab file The columns arw
- device the device or remote filesystem that is mounted.
- mountpoint the place in the filesystem the device was mounted.
- filesystemtype the type of filesystem mounted.
- options the mount options for the filesystem
- dump used by dump to decide if the filesystem needs dumping.
- fsckorder used by fsck to detrmine the fsck pass to use.
Check the fstab man page.