Friday, 14 October 2016

Describing Linux fstab filesystem table file



When using Linux you will needed to change some options on your file systems. Getting acquainted with fstab can make the whole process a lot easier, and it’s much easier than you think.

The configuration file /etc/fstab contains the necessary information to automate the process of mounting partitions. In a nutshell, mounting is the process where a raw (physical) partition is prepared for access and assigned a location on the file system tree (or mount point).

The file FSTAB contains descriptive information about the various file systems. fstab is only read by programs, and not written; it is the duty of the system administrator to properly create and maintain this file. Each filesystem is described on a separate line; fields on each line are separated by tabs or spaces. Lines starting with ‘#’ are comments. The order of records in fstab is important because fsck, mount, and umount sequentially iterate through fstab doing their thing.

This is an example of a fstab content
There are total six columns in the fstab file separated by spaces or tabs. Each column holds different information about the device. For adding any new device add a fresh row. Each row stands for a partition or removable device in the system.
<file system>    
   Device driver’s path tells the system to mount the device with the mentioned identifier.
<mount point>
     Shows the mount point specified for a device in the fstab file. The mount points actually is the directory where that particular device (mentioned in the first column) will be mounted and through which we can view and modify the content of that partition.
<type>
  The third column in the file specifies the file system type of the device or partition.
<option>          
Holds values such as :
  •               strictatime(updates the access time of the files every time they are accessed)
  •               noatime(disables writing file access times to the drive every time you read a file)
  •               nodiratime(disables the writing of file access times only for directories while other files still get access times written)
  •               relatime(updates the access time only if the previous access time was earlier than the current modify or change time).
  •               lazytime(reduces writes to disk by maintaining changes to inode timestamps (access, modification and creation times) only in memory)
<dump>        
   Column is for backup option. This column contains either 0 or 1. Where “0” stands for “NO” and “1” stands for “YES”. The system checks it at the time of booting, if it’s “0”,dump will ignore that filesystem but if its “1” then it will enable backup option. Backup is supported on only ext3 file system, hence only for ext3 file system it should be enabled and for rest of the file systems it should be disabled.
<pass>  
  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. If same number is given to different partitions then the partitions are scanned together with equal priority.

Now we can edit and manage your /etc/fstab file without having any problems. 
Note:
Always remember to make a backup in case something goes wrong, but have fun, and be sure to leave your experiences in the comments!

No comments: