These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX02/The Fstab File

Classnotes | UNIX02 | RecentChanges | Preferences

Difference (from prior major revision) (no other diffs)

Changed: 1c1,18
Describe the new page here.
/etc/fstab (think filesystem table) contains descriptive information about the various file systems on your computer. Many programs (such as mount) use refer to this table when they need information about what partition is supposed to be mounted where, what filesystem is on it, etc., so it is imperative that this file is properly maintained. In addition to containing information about the partitions (and mount points) on your hard drive, it also contains information used when mounting other devices, such as a CD-ROM or floppy disk.

An example /etc/fstab file is listed below:

/dev/hda5 / ext2 defaults 1 1
/dev/hda1 /boot ext2 defaults 1 2
/dev/hda6 /home ext2 defaults 1 2
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
/dev/fd0 /mnt/floppy ext2 noauto 0 0
none /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
/dev/hda7 swap swap defaults 0 0

As you can see, this file has six fields (columns). The first field defines the device or partition to be mounted (/dev/cdrom = first CD-ROM device, /dev/hda1 = 1st partition on primary master IDE device, etc.) The second field defines the mount point (where, in your filesystem layout, the contents of the device or partition will be located). The third field lists the filesystem type. The fourth field describes the mount options (for details, see the mount man page). Finally, the fifth and sixth fields contain information used by certain filesystem utilities.

/etc/fstab is referenced by the mount command when performing any operations, such as mounting the filesystems at bootup. mount can also be used to mount and unmount (using umount) filesystems while the computer is being used. When a mount command is issued, it first refers to /etc/fstab to see if operation is defined - if so, it uses the information there. If the operation is not already defined in /etc/fstab, then the user must specify the necessary information from the command line, such as the device to be mounted, where to mount it, etc.

Although users can be allowed to mount devices, they can only do so if it's specified in /etc/fstab. In order to have mount use the information in /etc/fstab, issue the mount command with only the physical device as a parameter. Adding any additional parameters to the command, such as specifying the mount point, the filesystem type, etc., will override the /etc/fstab entry will therefore be denied.

/etc/fstab (think filesystem table) contains descriptive information about the various file systems on your computer. Many programs (such as mount) use refer to this table when they need information about what partition is supposed to be mounted where, what filesystem is on it, etc., so it is imperative that this file is properly maintained. In addition to containing information about the partitions (and mount points) on your hard drive, it also contains information used when mounting other devices, such as a CD-ROM or floppy disk.

An example /etc/fstab file is listed below:

 /dev/hda5   /            ext2     defaults         1 1
 /dev/hda1   /boot        ext2     defaults         1 2
 /dev/hda6   /home        ext2     defaults         1 2
 /dev/cdrom  /mnt/cdrom   iso9660  noauto,owner,ro  0 0
 /dev/fd0    /mnt/floppy  ext2     noauto           0 0
 none        /proc        proc     defaults         0 0
 none        /dev/pts     devpts   gid=5,mode=620   0 0
 /dev/hda7   swap         swap     defaults         0 0

As you can see, this file has six fields (columns). The first field defines the device or partition to be mounted (/dev/cdrom = first CD-ROM device, /dev/hda1 = 1st partition on primary master IDE device, etc.) The second field defines the mount point (where, in your filesystem layout, the contents of the device or partition will be located). The third field lists the filesystem type. The fourth field describes the mount options (for details, see the mount man page). Finally, the fifth and sixth fields contain information used by certain filesystem utilities.

/etc/fstab is referenced by the mount command when performing any operations, such as mounting the filesystems at bootup. mount can also be used to mount and unmount (using umount) filesystems while the computer is being used. When a mount command is issued, it first refers to /etc/fstab to see if operation is defined - if so, it uses the information there. If the operation is not already defined in /etc/fstab, then the user must specify the necessary information from the command line, such as the device to be mounted, where to mount it, etc.

Although users can be allowed to mount devices, they can only do so if it's specified in /etc/fstab. In order to have mount use the information in /etc/fstab, issue the mount command with only the physical device as a parameter. Adding any additional parameters to the command, such as specifying the mount point, the filesystem type, etc., will override the /etc/fstab entry will therefore be denied.



Classnotes | UNIX02 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited September 12, 2003 9:29 pm (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.