Linux operating system relies on files. File systems should be mounted in order to be used. Mounting a file system can be with the
mount command. In order to mount single or multiple file systems, we need some configuration. There is default configuration while using
mount. But if we want to provide different options about mount we can use
/etc/fstab file. In
fstab we can provide information about the mount and automatically mounted files with during boot.
fstab file is stored under the
/etc/fstab file is a simple column based configuration file where configurations are stored as column based. We can open
fstab with the text editors like
Gnome Text Editor,
Kwrite etc. but if we want to save the changes we made we require to get
root privileges with the
$ sudo nano /etc/fstab
After providing the password for the user
ismail to get
root privileges with
sudo command we will see following
fstab file content
Before starting the detailed configuration about
fstab we need to learn comment. In the previous screenshot, we see the turquoise lines those are comments. So lines starting with the
# are comments. We can provide comments about newly created or changes configurations between configuration lines.
# This is comment
As stated previously
fstab file consists of columns which stored configuration options. Each row contains a single configuration record to mount and each column in this row contains different configuration options.
Here is sample configuration row or record.
UUID=e1ea69a0-7566-4002-a47d-3a93d1ebfb96 / ext4 errors=remount-ro 1
Each configuration columns is defined in the comment line which starts
We can see that the following configuration column is provided where we will explain them in detail.
File Systemis the source which we want to mount
Mount Pointis the destination we want to mount
Typeis the file system type of the
Optionis used to specify the behavior of the mount
Dumpspecifies whether the file system will be dumped in the error case
Passsets whether the file system check will be performed
File System Column
We will start with the first column which is used to specify the source file system device. Source file system device can be expressed in 2 different ways. The first way is specifying the path of the partition like
dev path is used to store device information. Another way to specify the source file system is providing the UUID information like
We can see that
/dev/fd0 is the floppy disk.
We can find the UUID of a disk with the following
blkid command which is shot form of
Block ID. We should run with the
$ sudo blkid
Mount Point or Dir Column
The second column specifies the path the source will be mounted. Generally, ile system root is specified as
/ . In this following screenshot, we can see that
/dev/sda1 is mounted to the
We can see that
/dev/fd0 is mounted to the
/media/floppy0. The following mounts are also popular in the Linux world.
/mntis used to mounted external hard disk drives or USB.
/bootis used to mount boot partition and the kernel.
/homeis used to mount users home directories
File System Type Column
Up to now, we have specified the source and destination partitions and locations. But as we know there are a lot of different file system types which is supported by Linux.
ntfs are some of them. In the file system type column, we can specify the file system with a single word.
We can see that in this example we are using
auto is used to find source partition file system type automatically which can be used in some cases or different file systems like CDROM.
Options column is the most comprehensive part of a fstab record. We can specify different behavior options int this part like automount, read-only, noatime etc.If there are multiple options we can delimit them with a comma. Here is an example of options column.
We can see that
errors=remounte-ro is provided in the first line. Also
utf8 is provided with comma delimiter.
auto/noautois used to specify automatically mount given file system on boot. We can also block automount with the
noautooption during boot.
exec/noexecis used to set mounted file system files to be executable. If we set to
noexecthe executables in the given file system will not be executed. This can be used to make user home directories
ro/rwis another useful option where we can make file system read-only or read-write. If we do not want to enable file, folder changes and removal we can mount read-only with the
ro. But in most cases
rwwill be the best solution where we can change file system contents.
sync/asyncoption is used to specify file system and disk synchronization. This option generally used to make file system more performative. If we select
syncthe changed content will be saved to the disk immediately which create some overload but will be more reliable.
asyncwill make write operation to the disk more flexible and more performative.
nouser/useris another important option. By default, normal users cannot mount a file system with the
mountcommand and needs
rootprivileges to mount. This is depicted with the
nouser. If we want to normal user mount given file system we should provide
useroption which will enable a normal user to mount given file system.
defaultsis a generic options wich is used in most of the cases which provides default options like
noatimeoption is used to disable access time information to be written to the file system. Disabling access time will boost the disk performance.
suid/nosuidoption is used to allow
Dump column is used to specify whether the there will a dump in an error event. This is designed in the old times and should be set to
1 means enable dumping.
File systems can be corrupted in different situations like disk hardware problem, electricity problem or software bug. This requires a file system check. We can enable an automatic
fsck by setting
1. We should enable
fsck for the root
/ file system. But we can skip for file systems like
FATautomatic file system check during reboot which can be accomplished after the start.
Mounting All File Systems In fstab
mount command is used to mount file systems in
fstab. We can mount all filesystems given in
--all option. Only the
noauto file systems will be skipped and not mounted. Mount command will skip already mounted file systems too.
$ sudo mount -a
Umount File System
We can also mount an already mounted file system with the
umount command. We just need to provide the file system or mounting point. In this example, we will umount
$ sudo umount /mnt
uid or UUID Identifier
Harddisks or Partitions can be specified with the UUID or Unified Unique Identifier. This makes mount operations more stable because as its name suggests every disk or partition on the each will have a unique UUID. So they can not overlap accidentally. We can list uid with the following command.
$ sudo blkid
We can see that partition named
e1ea69a0-7566-4002-a47d-3a93d1ebfb96 as UUID.
noatime Mount Option
Performance is a very important factor in computer usage. The disk is one of the most important parts of computer performance. We can increase the performance of the file system or disk by skipping unnecessary disk operations like metadata storage.
noatime will disable to store access time about file and folders in a file system.