fstab is a configuration file in Unix-like operating systems, located at /etc/fstab
. It contains a table of filesystems, where they get mounted, and more information. init uses it to automatically mount partitions on boot.
the format for each line in an fstab is the following.
[Device] [Mount Point] [Filesystem] [Options] [Dump] [Fsck]
here's an example of what an fstab could look like.
/dev/hda3 none swap sw # the system's swap. /dev/hda2 / xfs defaults 1 1 # root filesystem, formatted with XFS. /dev/hda1 /boot ext4 defaults 0 0 # boot partition. /dev/cdrom /mnt/cdrom iso9660 noauto,ro,user 0 0 # cdrom mounted with options that make the device read-only, allow it to be mounted by the user, and disable automatic mounting on boot. /dev/fd0 /mnt/floppy ext2 noauto,user 0 0 # floppy device mounted with similar options to the cdrom.
the physical location of the block device.
a filesystem's volume label or UUID can also be specified. if possible, use a UUID, as the kernel's names for the devices (“/dev/sda”) is subject to change and can lead to a wrong partition being mounted or none at all.
the mount point specifies where the filesystem is to be mounted; where it can be accessed from.
directories will not be automatically created, so ensure they exist.
this allows you to tell the mounter what filesystem the device is formatted as.
this describes tells the kernel how it should handle the filesystem. for example, if it's writable or readonly.
see mount(8) for options and more information.
tells the backup utility whether or not to backup the filesystem. 0 for no, 1 for yes.
this tells fsck(8) what order to check the filesystems.