Upload
hephzibah-a
View
80
Download
2
Embed Size (px)
Citation preview
What is fstab?
File System TABle (FSTAB).
File System organizes the files in harddisk.
Fstab contains the information of where and how to mount the partitions.
It is a configuration file.
Can edit this file in text editor.
$ whatis fstabfstab (5) - static information about the filesystems
Where is fstab?
Located in /etc/fstab.
$ whereis fstabfstab: /etc/fstab /usr/include/fstab.h /usr/share/man/man5/fstab.5.gz
When is fstab called?
init
In init somewhere mount -a is called which mounts all filesystems in the same order as mentioned infstab.
If /etc/fstab contains the instructions for mounting the file systems, including the root partition, then how doesthe OS read that file in the first place?
The root partition is initially mounted read-only by the kernel.
init process then mounts the file system in the order as in fstab.
/ is again described in fstab to change its mounting option.
fstab
# → comments.
There are six fields.
fs_spec → <file system>.1.
fs_file → <mount point>.2.
fs_vfstype → <type>.3.
fs_mntops → <options>.4.
fs_freq → <dump>.5.
fs_passno → <pass>.6.
1. File system
Describes the filesystem that needs to be mounted.
The file system to be mounted can be specified by its UUID - Universal Unique IDentifier.
Whenever a hard disk is manufactured or formated, a UUID for it is generated which it carries till itsgrave.
block node eg., /dev/sr0/.
2. Mount point
Mount point is the point where the partition is attached to the filesystem.
It describes point for the filesystem to be mounted.
3. Type
Specifies the type of the filesystem.
ext41.
NTFS2.
FAT etc3.
What is swap?
It is a partition in hard disk. Whenever the memory in RAM needs to be freed, process from RAM aretransfered to Swap partition. Process are retrived when it is needed. eg., Hibernation in linux os.
4. Option
File system mount options.
rw → read write only.
exec → Allows the execution of binary files on the particular file system.
nouser → Disallows an ordinary user (that is, other than root) to mount and unmount the file system.
defaults : rw, suid, dev, exec, auto, nouser, and async.
To see various mount and swap options see man page of mount and swapon respectively.
5. Dump
This field is used by the dump command.
1 → dump the Filesystem.
space / 0 (zero) → donot dump the filesystem.
6. Pass
Order in which fsck checks are done.
NOTE : fsck (File System ChecK) checks and repairs filesystem at reboot time.
root must be 1.
other than root must be 2.
If space or 0(zero) is entered fsck assumes that the filesystem need not be checked.
Let’s check out the fstab file!
$ vi /etc/fstab
open /etc/fstab in any text editor.
You could see its various fields.
Step 1
Step 2
Demo
Note: To try this demo you need to be superuser or have the permission to edit the fstab file.
Open the /etc/fstab in text editor
Create a swap partition if it doesnot exist and reboot and goto step2
If it exist goto step2
Goto System Monitor → Resources
You can see swap is available.
Step 3
Step 4
Comment the swap partition related lines in fstab. Reboot.
Goto System Monitor → Resources
You can see swap is not available