Configuring+Understanding ‘/etc/fstab’

             If there are any Linux users who still have difficulties in accessing and mounting their hard drives and other storage media, hope this post will help them. fstab contains some of configuration info about your hard drives and partitions such as file system types and mount points. Sometimes because of its mis-configuration it gives headaches to user. So in a moment like that you should have to know to configure by our own. Before editing any of your configuration files remember to backup them as a habit. You can edit this file using any of your text editors but you need to have root privileges. Here I’m opening ‘fstab’ config file using nano.

nano /etc/fstab

nano /etc/fstab

This is what I got….. yep it seems like a shuffled puzzle for the first time!

 

My fstab looks shit!

My fstab looks shit!

 

 Let’s take a hand written example to make it clear. Then follow its explanation.

#etc/fstab: static file system information

#

#<file system> <mount point> <type> <options> <dump> <pass>

proc                  /proc                proc      defaults    0                0           #line1

/dev/hdb4         /                       ext3      defaults     1                1           #line2

/dev/hdb2         swap                swap     defaults    0                0            #line3

/dev/hdb3         /home              ext3      defaults     1                1            #line4

/dev/hdb1        /media/hdb1     ext3       auto          0                0           #line5

/dev/hda1        /media/hda1     ntfs        defaults     0               0           #line6

/dev/scd0        /media/cdrom0 auto       ro,noauto,user,exec 0 0          #line7

/dev/fd0          /media/flopp0   auto      ro,noauto,user,sync 0 0          #line8

 

::::::::::::: Explanation ::::::::::::

1st and 2nd columns :: Its easy 1st explains the device and 2nd explains the mount point.

 

3rd column :: exlapins the ‘file system.’

                   As mentioned about it can be ext3, swap, ext2, reiserfx, vfat, ntfs or any other file system. Did you notice line two? Its something different. “proc” file system is a special file system used by the kernel to store hardware information. Some programs retrieve hardware info from this system. Most of the time proc file system will be a small space in your root partition.

                        auto” option is also used. Its not a file system. It simply means that the file system type is detected automatically. Media devices which vary its file system like cdroms and floppies can have this “auto” option.

4th column :: list all the mount options for the device or partition.

            Options should explain in detail. User can define more than one option using “,” to separate them. Here I m considering about only the most common options,

 

user and nouser “user” option allows normal users to mount the device. If you use “nouser” you should have to be root to mount it.

***Most of new Linux users tell that they can’t mount their windows partitions and other media types. The reason for that is “nouser” come in default. So new users, if you  have mounting problems feel free to open fstab and change the “nouser” option to “user”.

 

auto and noauto “auto” option allows the device to mount automatically at the bootup. “noauto” option stops mounting the devices at the startup. But allows, mounting it manually after logged in.

***If you are new to Linux mint5 Elyssa, you would be facing to this problem. Some of your media devices are not mounted at the startup and if you want them to be, check your fstab file. Most of the times you want find any record/entries for this troublesome drives. So you should have to write them manually. And remember to set its mount option as “auto”.

 

ro mount the file system read-only

rw mount the file system read-write

***”ro” and “rw” can also give probs to new users because some times they cant writ into windows partitions and some times even into Linux partitions. So now you can understand how to solve that problem.

 

sync and async defines how the input and output to the file system should be done. If it is “sync” it is done synchronously. If its “async” inputs and outputs are done asynchronously.

            Think about a file operation like coping some data into a floppy. If its set to “sync” the physical changes are made to the floppy at the same time. But if its “async” the physical changes are done after some time when copping commands are executed. Maybe changes will occur when you’re trying to unmount the floppy.

 

 

 defaults uses all the default options.

exec and noexec exec” allows the user to execute binaries which contains in that partition. “noexec” stops it.

 

5th column :: It is for back utility (dump). If its set to ‘0’ dump will ignore the file system. If ‘1’  backup the file system.

6th column :: This is for fsck (file system check utility). if it is ‘1’ fsck checks the file system. If not dont check( fsck is explained very shortly. I ll put a new post about ‘fsck’ in future).

Finally remember to place your root partition’s record/entry at top of the fstab. Do what ever modifications after the root partition’s entry. So it want change its level. Because the order which they are arranged is important. Before every thing, system should find the root partition and mount it. Then others will be mounted inside the root.

            If your still have questions, doughs or problems with fstab+ mounting feel free to leave them as comments.

Advertisements

4 Responses to “Configuring+Understanding ‘/etc/fstab’”

  1. narendra pratap singh Says:

    sir
    i want to merg nfs mounted home dir with the local user home dir in case of nfs failure so that when nfs is up user can get both the data the one which created when nfs was down and one from nfs mounted home directory together

    thanks in advance

  2. tes Says:

    thanks

  3. google Says:

    Hi there it’s me, I am also visiting this web page regularly, this web site is truly pleasant and the users are genuinely sharing fastidious thoughts.

  4. Aileen Says:

    I every time used to read article in news papers but now as I am a user of web therefore from now I am using neet for posts, thanks to web.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: