Understanding /etc/fstab

From Initq

Jump to: navigation, search

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 floppy 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.

Contents

/etc/fstab file

/dev/hda2  	/  	        ext2  	defaults  	        1 1
/dev/hdb1 	/home 	        ext2 	defaults 	        1 2
/dev/cdrom 	/media/cdrom 	auto 	ro,noauto,user,exec 	0 0
/dev/fd0 	/media/floppy 	auto 	rw,noauto,user,sync 	0 0
proc 	        /proc 	        proc 	defaults 	        0 0
/dev/hda1 	swap 	        swap 	pri=42 	                0 0

1st and 2nd columns: Device and default mount point

3rd column: Filesystem type

4th column: Mount options

5th and 6th columns: Dump and fsck options

Command line examples

Personal tools