======fstab======
**fstab** is a configuration file in [[Unix]]-like operating systems, located at ''/etc/fstab''. It contains a table of filesystems, where they get [[mount]]ed, and more information. [[init]] uses it to automatically [[mount]] partitions on [[boot]].
=====format=====
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.
=====device=====
the physical location of the block device.
a [[filesystem]]'s [[volume label]] or [[UUID#Block_Devices|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.
=====mount point=====
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.
=====filesystem=====
this allows you to tell the mounter what filesystem the device is formatted as.
=====options=====
this describes tells the kernel how it should handle the filesystem. for example, if it's writable or readonly.
see [[https://www.man7.org/linux/man-pages/man8/mount.8.html|mount(8)]] for options and more information.
=====dump=====
tells the backup utility whether or not to backup the filesystem. 0 for no, 1 for yes.
=====fsck=====
this tells [[https://man7.org/linux/man-pages/man8/fsck.8.html|fsck(8)]] what order to check the filesystems.
======see also======
* [[https://man7.org/linux/man-pages/man5/fstab.5.html|fstab(5)]]
* [[https://man7.org/linux/man-pages/man8/mount.8.html|mount(8)]]
* [[https://wiki.archlinux.org/title/Fstab|fstab - ArchWiki]]
{{tag>linux unix configuration}}