What is the difference between /etc/fstab and /etc/mtab?
/etc/fstab
is a list of filesystems to be mounted at boot time. If you want your Windows or file-storage partitions mounted once your computer boots, you'll need to put appropriate entries into /etc/fstab
.
/etc/mtab
is a list of currently mounted filesystems. If you have a disk connected but not mounted, it won't show up in the /etc/mtab
file. Once you mount it, it will show up there.
Note also, that with systemd (to which Ubuntu switched beginning from 15.04 release) it is possible to declare filesystems that need to be mounted at boot via *.mount
files. See James Oguya's tutorial on the topic.
For more info, read mount
manual.
TL;DR
/etc/fstab
is a created by the user. It contains list of volumes to be mounted bymount
./etc/mtab
is a created by the system. It contains a list of currently mounted devices.- The format of the files is similar. After mounting a new device, copy the relevant line from
/etc/mtab
to/etc/fstab
so that it will be auto-mounted after boot or when callingmount -a
.
Quotes from the mount
manual
The /etc/fstab
, /etc/mtab
and /proc/mounts
files
The file
/etc/fstab
, may contain lines describing what devices are usually mounted where, using which options.The programs
mount
andumount
maintain a list of currently mounted filesystems in the file/etc/mtab
.When the proc filesystem is mounted (say at
/proc
), the files/etc/mtab
and/proc/mounts
have very similar contents. The former has somewhat more information, such as the mount options used, but is not necessarily up-to-date.
mount -a
mount -a [-t type] [-O optlist]
(usually given in a bootscript) causes all filesystems mentioned in fstab (of the proper type and/or having or not having the proper options) to be mounted as indicated, except for those whose line contains the noauto keyword. Adding the -F option will make mount fork, so that the filesystems are mounted simultaneously.