/etc/fstab :: Explained

/etc/fstab :: Explained

by -
0 1904

fstab is a configuration file that contains information of all the partitions and storage devices in your computer. The file is located under /etc, so the full path to this file is /etc/fstab.

/etc/fstab contains information of where your partitions and storage devices should be mounted and how. If you can’t access your Windows partition from Linux, aren’t able to mount your CD or write to your disk as a normal user, or have problems with your CD-RW, you probably have a misconfigured /etc/fstab file. So, you can usually fix your mounting problems by editing your fstab file.

/etc/fstab is just a plain text file, so you can open and edit it with any text editor you’re familiar with. However, note that you must have the root privileges before editing fstab. So, in order to edit the file, you must either log in as root or use the su command to become root.

/etc/fstab explained

/etc/fstab explained

LABEL=/                         /                             defaults     ext3           1 1

LABEL=/home                /home                    defaults,noexec       1 2

LABEL=/boot                 /boot                      ext3   defaults       1 2

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

LABEL=SWAP-hda3         swap                 swap   defaults       0 0


Device Mount Point    File System Options Dump FSCK
LABEL=/ / ext3 defaults 1 1
LABEL=/home /home ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
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
LABEL=SWAP-hda3 swap swap swap 0 0

Please select a title

There are 6 fields:


<device>   <mount point>     <filesystem type>   <options>     <dump>     <fsck order>

1                         2                                     3                           4                      5                          6


  1. Device name (e.g., /dev/sda)


  1. Mount point


  1. Filesysem type (ext2,ext3, reiser, iso9660, msdos, vfat, proc, tmpfs, nfs , smb etc.)


  1. Options (ro, noauto, auto,user, usrquota)


  1. Dump should backup this filesystem (0=no, 1=yes)


It should be either 0 or 1. A value of 1 means that data is automatically saved to disk by the dump command when you exit Linux. data should be backed up (also called dumping) before a system shutdown or reboot occurs. This field commonly uses a value of 1. A value of 0 might be used if the file system is a temporary storage space for files, such as /tmp.


  1. Fsck order on reboots (0=dont check, 1=root filesystem,2=other filesystems)


Filesytem check order – It determines the order that filesystem are checked by fsck during the boot process. The root directory (/) filesystem should be set to 1, and other local filesystems should be set to 2. Removable filesystems such as /mnt/cdrom should be set to 0, which means that they are not checked during the linux boot process


Could I add an item in `/etc/fstab` to bind an old directory with a new one?


As I can mount any directory into another using “–bind”ption with “mount” command.

mount –bind old-dir new-dir


/etc/fstab syntax will be


/path/old-dir /path/new-dir none   bind   0 0


Is very useful in industrial implementation.

How to mount a remote directory in Linux using sshfs ?

Install fuse-sshfs package for the task  

# wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/fuse-sshfs-1.8-1.el5.rf.i386.rpm

 # rpm -ivh fuse-sshfs-1.8-1.el5.rf.i386.rpm  

Make a mount point: 

# mkdir /mnt/ssh  

Mount remote machine i.e. into this mount point using command

#sshfs [email protected]:/ /mnt/ssh/ 

# cd /mnt/ssh  

Now go for permanent mount by making entry in /etc/fstab

sshfs#[email protected]:/ /mnt/ssh   fuse     defaults 0 0  

# mount –a  

It will ask for root password for remote pc i.e.

Note: Its not advisable to write passwords in human readable files like /etc/fstab.

Let me explain what entry in fstab indicates. We are mentioning mount user root data which is located on server on to /mnt/ssh using fuse file system with default settings.

What about unmounting this drive?

#umount /mnt/ssh

Enjoy new learning of mounting a folder using SSH protocol.

How to mount FTP share locally in Linux using ftpfs ?

Step 1: Installing package on Linux


#wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/fuse-curlftpfs-0.9.1-1.el5.rf.i386.rpm

# rpm –ivh fuse-curlftpfs-0.9.1-1.el5.rf.i386.rpm


Step 2:

Once the package installed we have to create a mount point and mount our ftp server data using curlftpfs command, for which we must have ftp username/password. Here are my details..


  • My ftp User: username
  • My ftp password: password
  • My ftp Server:
  • My mount point: /ftp


Note: Anonomyous FTP not required any User name or Passowrd


# mkdir /ftp

# curlftpfs -o allow_other username:password@ /ftp

For Anonomyous FTP

# curlftpfs -o allow_other   /ftp


Here option allow_others is used to Allow access to other users. By default the mount point is only accessible to the user who mounted it and not even to root. The remaining command is self explanatory.


Step 3: Testing our set-up

Check if you are able to see the ftp data

#cd /ftp



Step 4: So what about mounting it permanently?. We can do it by editing fstab file in /etc folder

#vi /etc/fstab

go to last line and type below line

curlftpfs#ftp://username:[email protected]/  /ftp     fuse   defaults   0   0

Let me explain what the above line indicates..

We are mentioning mount user username data which is on server on to /ftp using fuse file system with default settings.

Step 5:What about unmounting this drive?

#umount /ftpmount

Enjoy new learning of mounting ftp server.





LABEL=/                 /                       ext3   defaults       1 1

LABEL=/home             /home                   ext3   defaults       1 2

LABEL=/boot             /boot                   ext3    defaults       1 2

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

LABEL=SWAP-hda3         swap                   swap   defaults       0 0

/home                   /newhome               none   bind           0 0

sshfs#[email protected]:/ /mnt/ssh             fuse     defaults 0 0

curlftpfs#ftp://vikas:[email protected]/ /vikas-ftp   fuse   defaults   0   0

curlftpfs#     /ftp                 fuse   defaults   0   0



Making   /boot partition readonly



Make entry in /etc/fstab


LABEL=/boot             /boot                   ext3   defaults,ro       1 2



 # mount –o remount /boot

It will work now !!

Download PDF

CEO, KV IT-Solutions Pvt. Ltd. | [email protected] | 9810028374|
Linux Professional and an Industrial Trainer | 20 + years Experience in IT Industry

” We are born free, No Gate and Windows can snatch our freedom “


0 1672

0 1328

0 1188


Leave a Reply