GRABNOTES

Configuring fstab

Home

 

File System Table or fstab is the file that informs the OS of its various filesystems and their properties. The administrator can specify information in this file to allow user access to various file systems.


A typical fstab file is listed below.

fstab

<fs>

<mountpoint>

<type>

<opts>

<dump>

/dev/hda7

/boot

ext2

noauto,noatime

1 2

/dev/hda9

/

ext3

noatime

0 1

/dev/hda8

none

swap

sw

0 0

/dev/cdroms/cdrom0

/mnt/cdrom

iso9660

noauto,ro

0 0


<fs>: partition
/dev/hda7,8 and 9 - hard drive device partitions
/dev/cdroms/cdrom0 - cdrom device

<mountpoint>:
/boot - boot parition
/ - root partition
none
- no partition
/mnt/cdrom
- mount all contents(files and directories) from device cdrom to the directory /mnt/cdrom(this directory is created under root)

<type>: filesystem
ext2 - "is the tried and true Linux filesystem but doesn't have metadata journaling, which means that routine ext2 filesystem checks at startup time can be quite time-consuming. There is now quite a selection of newer-generation journaled filesystems that can be checked for consistency very quickly and are thus generally preferred over their non-journaled counterparts. Journaled filesystems prevent long delays when you boot your system and your filesystem happens to be in an inconsistent state."
ext3 - "is the journaled version of the ext2 filesystem, providing metadata journaling for fast recovery in addition to other enhanced journaling modes like full data and ordered data journaling. ext3 is a very good and reliable filesystem. It has an additional hashed b-tree indexing option that enables high performance in almost all situations. You can enable this indexing by adding -O dir_index to the mke2fs command. In short, ext3 is an excellent filesystem."
swap - is the swap partition
iso9660 - This file system is usually found in cdrom devices

<opts>: Mount options
noatime - for  faster  access of the file system(typically used in boot & root partitions)
noauto - do not load at boot (for example, use this option if you do not want your cdrom contents to be mounted at startup)
r0 - read only

<dump>

"The fifth field is used by dump to determine if the partition needs to be dumped or not. You can generally leave this as 0 (zero). The sixth field is used by fsck to determine the order in which filesystems should be checked if the system wasn't shut down properly. The root filesystem should have 1 while the rest should have 2 (or 0 if a filesystem check isn't necessary)."

You can check for the partitions on your file system using

#df -h

h: human-readable gives the capacity in Megabytes

However checking through fdisk will give you information on all partitions.

#fdisk /dev/hda
Command (m for help): p

The output should be something like this:

Device Boot

Start

End

Blocks

Id

System

/dev/hda1

1

1020

8193118+

7

HPFS/NTFS

/dev/hda2

1021

4864

30876930

f

W95 Ext'd (LBA)

/dev/hda5

1021

2040

8193118+

7

HPFS/NTFS

/dev/hda6

2041

3060

8193118+

7

HPFS/NTFS

/dev/hda7

3061

3077

136521

83

Linux

/dev/hda8

3078

3327

2008093+

82

Linux swap / Solaris

/dev/hda9

3328

4864

12345921

83

Linux


Here /dev/hda5 is my drive d: and /dev/hda6 is my drive e: on windows.

For example, if you need to allow all users to gain access to your ntfs partitions, the administrator has to include the following information on the fstab file.

fstab

<fs>

<mountpoint>

<type>

<opts>

<dump>

/dev/hda5

/mnt/d

ntfs

noatime,umask=000,users,ro

0 0

/dev/hda6

/mnt/e

ntfs

noatime,umask=000,users,ro

0 0


umask
is to unmask the files for all users in groupusers

Sample fstab file (to download the file, right click and choose 'save target as')that mounts ntfs and fat32 drives.


Reference: www.gentoo.org