Pages

Tuesday, July 17, 2012

Exploring the /etc/fstab


Fstab file is one of the most important file in linux. The main use is that it maps devices to locations so that devices can be used. It contains information of all the partitions and storage devices in your computer. We need to have root privileges for modifying the file.

A basic structure and some contents of the file will look like this,



Device
/ root  
/home
swap    
mount_location       
/
/home
swap
fileSystem
ext3
ext3
ext3

Options
default
rw,suid,dev,noexec,auto,nouser,async 
default
Dump
1
1
0
Fsck
1
2
0


Device is the underlying device

Mount location, is nothing but a location where we mounted the file system for accessing.

File System defines the type of the current file system such as ext3, fat, ext2, ntfs, swap e.t.c.There is a Special option available called auto which simply means that the file system type is detected automatically.

Options: these are options available for a partition. This is the confusing part in the file. If we know some of the options and what they actually do, it is pretty easy.

auto and noauto With the auto option, the device will be mounted automatically at boot up and this is the default options. If you don't want the device to be mounted automatically, we can use noauto. When we use noauto it will not be available until explicitly mounted.
ro Mount the filesystem read-only.
rw Mount the filesystem read-write
defaults Uses the default options that are rw, suid, dev, exec, auto, nouser, and async
exec and noexec exec lets you execute binaries that are on that partition, whereas noexec doesn't let you do that. noexec might be useful for a partition that contains binaries you don't want to execute on your system, or that can't even be executed on your system

These are not only the available ones. There are some more options available.

Dump : the dump is nothing but a linux utility for taking a  backup.When started dump checks the entry and uses the number to decide if a file system should be backedup or not

O: dump will ignore the file system (most cases)
1: dump will back up

Fsck : this reads the number in identifies in which order the file system check should be done.
0: will not check
1: root
2: other file systems

Happy learning J