From MEPIS Documentation Wiki
The fstab (file systems table) file is found in /etc, and lists disks and partitions, both permanent and pluggable ones found during boot. The file also indicates how these disks and partitions fit into the file system.
Note : Devices plugged in after boot are handled by udev, and will appear in /etc/mtab.
The fstab man (manual) page gives a detailed breakdown of each column:
The file /etc/fstab has two parts: 1) permanently available devices, and 2) devices dynamically loaded by udev. Each entry contains information in a specific order:
[Device] [Mount Point] [Filesystem] [Options] [dump] [fsck order]
Thus, in this entry:
/dev/sda1 / ext3 defaults,noatime 1 1
Mount Point: / (=root directory)
Options: defaults, noatime
fsck order: 1
For details on these categories, follow the links below.
This refers to the specific partition or drive that is being referenced, if a device is referred to more than once in fstab the last line referring to it will take precedence.
The mountpoint is the directory in your file system where you want the storage device files attached.
This indicates the type of file system in use on this device, linux mostly uses ext3, however other file systems include ext2, reiser, also vfat, msdos and ntfs allows the mounting of windows OS's.
- async : All I/O to the filesytsem is asynchronous.
- auto : The file system is mounted automatically when the system boots.
- noauto : The file system must be mounted explicitly, often found in the dynamic entries of fstab.
- exec : Execution of binaries is permitted.
- ro : The file system is mounted as read only
- rw : The file system is mounted as read/write
The first integer value, determines whether the file needs to be dumped (backed up) it can have a value from 0 through to 9, with 0 being a complete backup and 9 being the lowest level. The value range used in fstab is generally 0 or 1.
The second integer value is used by fsck to see if the file needs checking at boot
- 0 tells fsck not to check the file
- 1 indicates a boot partition
- 2 indicates any other partition
Caution: always back up your current fstab file before attempting any changes.
At times it may be useful to alter the fstab file for your own purposes. For example, let's say you want to have a directory or partition mounted so that it is available when you boot up instead of having to go through the steps to mount it each time. Let it be a data partition on sda2 with an ext3 filesystem that you want to be able to access from the desktop or from any application. To do that, you will want to mount it during boot rather than dynamically during use.
1. Open a terminal, become root, and type:
2. Back up the file by saving the file as /etc/fstab_old (or any other name you will understand) 3. Create a new mountpoint, say a folder in /home/username called MyData 4. Add a line behind the first entry in the top (permanent) section like this:
/dev/sda2 /home/username/MyData ext3 defaults,noatime 1 2
5. Now save the file as /etc/fstab 6. You can test by going back to the terminal as root, and typing:
mount -a cd /home/username/MyData
If your new fstab entry is correct, you should now be able to see your data. If it doesn't work, you can always restore the previous setup with the file you backed up.