Tuesday, 26 June 2018

Introduction and Working of Linux FSTAB File


Introduction and Working of Linux FSTAB File



FSTAB [FILE SYSTEM TABLE] :

FSTAB is a file which contains all the information about partitions and storage devices present on the system. This file is basically located under the “/etc/” directory.
This file gives you information of where your storage devices should be mounted.
FSTAB is very critical and important file present in “/etc” directory where all the configuration files stored. It is the responsibility of SysAdmin to properly create and maintain this file.
You need to understand the structure of this file before writing anything into this. Because if add something with wrong format or structure it will result in crashing your system. You need to handle this very carefully.

KEEP BELOW POINTS IN MIND WHEN YOU ADD SOMETHING TO THIS FILE.

$ Each filesystem is described or written on the seperate line.
$ Fields on each line to be separated by tabs or spaces.
$ Lines started with "#" are comments.
$ Most important are the order of records which is like fsck, mount, umount etc. explains further in deep.
FSTAB file looks like below shows in the image. We will go to understand each column one by one.
FSTAB
Total six columns are present in FSTAB file. Each column defines or performs a different role. To add or mount new device use new row.

LET’S UNDERSTAND THE WORKING OF EACH COLUMN.

1ST COLUMN:

The first column will define the “Label” of partitions. For eg. “LABEL=/boot” or driver’s path, eg. “/dev/cdrom”. Device driver’s path tells the system to mount the device with the mentioned device driver.

2ND COLUMN:

The second column describes the mount point for the filesystem. There is some filesystem should be specified as ‘none’ like swap partition. The mount point is actually a name of the directory where that device is mounted. Using this mount point we can be able to view and modify the content of that partition. You can modify the mount point according to your requirement.

3RD COLUMN:

The third column will be used to define the Filesystem type of partition or device. Several no. of filesystems supported by Linux and some of them listed below,
– ext2
– ext3
– iso9660
– autofs
– nfs
– swap
If you are not sure about the filesystem then use “auto” option. “auto” will help to determine the file system and mount the device with that filesystem.

4TH COLUMN:

The fourth column is for permissions to be given to the partition at the time of booting. There are many options which constitute the fourth column.
They are as follows : –
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- the 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 to 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:

This column is used as a backup option. It will contain two values either 0 or 1. Here 0 stands for “no” and 1 stands for “yes”. if option 1 used then system checks are enabled at the time of booting and if 0 used then system checks will be ignored. Backup option supported only ext3 filesystem which means for another filesystem this option should be disabled by default.

6TH COLUMN :

6th column is using for “fsck” option. Fsck stands for filesystem check. with this option system will scan the filesystem at time of start up. Here The / partition is assigned top priority i.e. 1 and the rest of the partitions are assigned second priority i.e. 2. If the value is set to 0 means no scanning will be done at the time of startup. If the same number is given to different partitions then the partitions are scanned together with equal priority. This minimizes error because if a link is present on one partition with higher priority and the source file in another partition with a priority lower than the link, it will give an error.

No comments:

Post a Comment