Each line of /etc/fstab contains the necessary settings to mount one partition, drive or network share. The line has six columns, separated by whitespaces or tabs. The columns are as follows:
- The device file, UUID or label or other means of locating the partition or data source.
- The mount point, where the data is to be attached to the filesystem.
- The filesystem type.
- Options, including if the filesystem should be mounted at boot.
- Adjusts the archiving schedule for the partition (used by app-arch/dump). 0 disables, 1 enables the feature.
- Controls the order in which fsck checks the device/partition for errors at boot time. The root device should be 1. Other partitions should be either 2 (to check after root) or 0 (to disable checking for that partition altogether).
An example for the root device:
/dev/sda1 / ext4 defaults 0 1
For more detailed information see man 5 fstab.
UUIDs and labels
In the first column, a UUID can be used instead of a device file:
UUID=339df6e7-91a8-4cf9-a43f-7f7b3db533c6 / ext4 defaults 0 1
Alternatively, a LABEL can be used:
LABEL=Gentoo / ext4 defaults 0 1
Please read this for details on how to retrieve UUIDs and labels.
The following OpenRC services read the fstab to mount or manage the filesystems.
- localmount- Mount disks and swap according to fstab.
- netmount - Mount network shares according to fstab.
- fsck - Check and repair filesystems according to fstab.
- root - Mount the root filesystem read/write.
These services supplement the fstab, if the filesystems are not explicitly stated:
- sysfs - Mount the /sys filesystem.
- devfs - Mount system critical filesystems in /dev.
Check that they are enabled to start at boot time:
- Mounting partitions (Security Handbook)
- Disk Quotas (Security Handbook)
- mount - Manual mount.
- removable media - Mount at demand.
- AutoFS - Automatic mount on access.
- fstab (AMD64 Handbook)