Both /etc/mtab
and /etc/fstab
contain data about mounted volumes, for example:
/etc/mtab
/dev/xvda1 / ext4 rw,discard 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
...
/etc/fstab
LABEL=cloudimg-rootfs / ext4 defaults,discard 0 0
/dev/xvdf /home/ubuntu/logs ext4 rw 0 0
What is the difference between the files?
/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./etc/mtab
to/etc/fstab
so that it will be auto-mounted after boot or when callingmount -a
.Quotes from the
mount
manualThe
/etc/fstab
,/etc/mtab
and/proc/mounts
filesmount -a