Linux FSTAB is important file which resides in the /etc directory on Linux. In Linux fstab stands for “File System Table”.
This Linux fstab file contains information regarding all the file system & defines the location “mount point location” it should get mounted along with different options. It contains six columns
[root@kalwa2 ~]# cat /etc/fstab
# Created by anaconda on Tue May 26 13:10:05 2015
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
UUID=79327f96-bd6d-4af8-adeb-06013733847d / ext4 defaults 1 1
UUID=4e8109a5-166a-49ff-a0fb-2a8d6003cb99 /boot ext4 defaults 1 2
UUID=d8ca57b1-99c8-4a92-8281-19ea319ec0db swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
Let’s discuss these six columns one by one.
1st Column of Linux fstab:
The first column contains the file system which is to be mounted on the Linux system.
2nd Column of Linux fstab :
The second column describes the mount point location where it should get mounted. For swap partitions, this field should be specified as `none’.
3rd Column of Linux fstab:
This column describes the filesystem type. Eg, ext3,autofs,ntfs etc.
4th Column of Linux fstab:
The fourth column defines the permissions for the file system.
Below are the different permissions you can give depending on your requirement.
1) ro - Read Only
2) rw - Read Write
3) auto - Mount on startup
4) noauto - Do not mount on startup
5) user - Any user can mount, but only unmount device mounted by him
6) nouser - Only root can mount & unmount the device
7) users - Every user can mount and also unmount the device mounted by others
8) owner - Same as user (above no. 5)
9) dev - User can use device driver to mount the device
10) nodev - User cannot use device driver to mount the device
11) exec - Users can execute binaries on the partition
12) noexec - Users cannot execute binaries on the partition
13) async - Asynchronous, whenever a file is saved it will be first saved in the RAM and after 30 seconds all the queued files will be written on the hard disk.
14) sync - Synchronous, whenever a file is saved it will be directly written to the hard disk
15) suid - Allow set-user-identifier for the device where users are allowed to run binaries even though they do not have execute permissions. These binaries are temporarily made available to them to perform certain tasks
16) nosuid - Do not allow set-user-identifier
17) defaults - auto, rw, dev, async, suid, exec & nouser
5th Column of Linux fstab:
This option is for taking the backup of the filesystem while booting.
0 -->No backup
1 --> will enable backup option.
6th column of Linux fstab:
This option is for fsck. This column defines the order in which the system should scan the partitions on start up. The / partition is assigned top priority i.e. 1 and the rest of the partitions are assigned second priority i.e. 2. If value is set to 0 means no scanning will be done at the time of startup.
You can learn how to create LVM volume and mount it using fstab here.