Fstab is a file in Linux or Unix which lists all the available disks and disk partitions on your machine and indicates how they should be mounted. The full path of the fstab file in Linux is /etc/fstab. Ever wonder how Linux automatically mount any or all of your partitions at boot time ? It does so by reading the parameters from the /etc/fstab
file.
Syntax of fstab file
The following is the syntax of the /etc/fstab
file in Linux.
[Device name | UUID] [Mount Point] [File system] [Options] [dump] [fsck order]
Device Name - Denotes the unique physical node which is identified with a particular device. In Linux and Unix, every thing is considered to be a file. That includes hard disks, mice, keyboard et al. Possible values are /dev/hdaX
,/dev/sdaX
,/dev/fdX
, and so on. Where 'X' in /dev/hdaX
and other devices stand for numerals.
UUID - This is an acronym for Universally Unique IDentifier. It is a unique string that is assigned to your device. Some modern Linux distributions such as Ubuntu and Fedora use a UID instead of a device name as the first parameter in the /etc/fstab
file.
Mount Point - This denotes the full path where you want to mount the specific device. Note: Before you provide a mount point, make sure the folder exists.
File System - Linux supports lots of filesystems. Some of these options are ext2
,ext3
,reiserfs
,ntfs-3g
(For mounting Windows NTFS partitions),proc
(for proc filesystem),udf
,iso9660
and so on.
Options - This section contains the most number of options, simultaneously providing the highest flexibility to the user in mounting the devices connected to his machine. Check man page of fstab to know all the options. There are too many to list here.
Dump - The values dump option takes are 0 and 1. If this value is set to 0, then the dump
utility will not backup the file system. If set to 1, this file system will be backed up.
fsck order - This option also takes values 0,1 and 2. 0 denotes the fsck tool does not check the file system. If the value is 1, fsck tool checks the file system on a periodic basis or when it encounters physical errors in the device.
Contents of a typical /etc/fstab file in Ubuntu Linux
The following are the contents of the /etc/fstab
file on my Ubuntu machine.
proc /proc proc defaults 0 0
# /dev/sda1
UUID=dc2c5c36-3773-4627-8657-626f0ef8aa9e / ext3 relatime,errors=remount-ro 0 1
# /dev/sda2
UUID=57864470-a324-4c5c-ad49-ed1a05300b0d none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /mnt/floppy ext2 noauto,user 0 0
From the above listing, one can gather that the
proc
file system has been mounted in the /proc
directory. A UUID has been provided for /dev/sda1
and /dev/sda2
. The fsck order for the root node '/' has been set to 1; which means, it will be checked for any sector errors on a periodic basis.For more details on the contents of the /etc/fstab
file, check the man
page of fstab in Linux.
No comments:
Post a Comment