From MEPIS Documentation Wiki
The fstab (file systems table) file is found in /etc, and lists disks, partitions and files, both permanent, pluggable and virtual (such as /proc) that need to 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. Open Konqueror and type in the address field:
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, and the new ext4. The filesystems vfat, msdos and ntfs allow 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.
- defaults : The default options rw, suid, dev, exec, auto, nouser, and async are used.
- dev : Interprets character or block special devices on the file system.
- exec : Execution of binaries is permitted.
- fscontext : SELinux security context is provided to file systems without it.
- group : Only users with access rights to that device's group can mount it.
- owner : The owner of the device is allowed to mount the system.
- nouser : The file system may be mounted by the root user only.
- noauto : The file system must be mounted explicitly, often found in the dynamic entries of fstab.
- nodev : No interpretation of special characters and block devices in the file system.
- noexec : No execution of binaries on mounted file systems.
- nosuid : The set user identifier and set group identifier bits can not be set.
- remount : Remounts an already mounted file system.
- ro : The file system is mounted as read only.
- rw : The file system is mounted as read/write.
- suid : This option allows set-user-identifier or set-group-identifier to activate.
- sync : All I/O to the filesystem is synchronous.
- user : Allows an ordinary user to mount the file system, also sets nodev,noexec and nosuid.
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.
If you have changed partition information on a hard drive or changed the connection point on the motherboard, a magic number error may occur. This may show up at boot, when fsk runs or when you try to access the partition.
Bad magic number in superblock could not find valid file system in superblock
The fix is simple # out the line in fstab pointing to the partition, then as root run
If the drive shows up in the list, then run
this will list the UUID for each partition, it will look like this
/dev/sdb1: UUID="7e719d7d-a637-426c-861f-60c65c6bf5e5" SEC_TYPE="ext2" TYPE="ext3
Cut the UUID info from the results and paste it into a line like this
UUID="7e719d7d-a637-426c-861f-60c65c6bf5e5" /mnt/sdb1 ext3 users,async,atime,auto,rw,exec,dev,suid 0 2
Save and reboot everything should now work.
An alternate and easier way to fix it is to run this command as root, which will remove devices from the cache /etc/blkid.tab that no longer exist: