In this vid I'm rambling on a bit about the fstab file. Click "Show More" to see the notes... :)
Linux fstab File Basics
The fstab file is used by the kernel to locate and mount file systems. It’s usually auto generated at install and users need not worry about it unless they plan on adding more storage to an existing system. The name fstab is a shortened version of File System Table; the format is actually quite simple and easy to manipulate. Entries are separated by white space.
1. Device
Drive/partition to be mounted. It is usually identified by UUID but you can do it with device names (ex. /dev/sda1) or labels (ex. LABEL=OS.)
2 Mount Point
The directory where the device/partition will be mounted (ex. /home.)
3. File System Type
Tells the kernel what file system to use when mounting the drive/partition.
(ex. ext4, xfs, btrfs, zfs, ntfs, etc…)
4. File System Options
Tells the kernel what options to use with the mounted device. This can be used to instruct the system what to do in the event of an error or turn on specific options for the file system itself.
5. Backup Operations/Dump
This is a binary system where 1 = dump utility backup of a partition. 0 = no backup. This is mostly disused today.
6. File System Check Order
Sets the order in which devices/partitions will be checked at boot. 0 means no check, 1 means first check and 2 means second check. The / file system should be set to one and following systems to 2.
Editing fstab
!!!WARNING!!! Editing any system file can be risky! Make backups and proceed carefully.
You can use fstab to add storage to a system or upgrade storage. Your entire /home directory can be broken out from the / file system and stored on separate devices/partitions. You can also breakout /boot, /tmp or /var to a separate device/partition. Network shared storage sometimes cannot be mounted with fstab as it is loaded at boot before network devices are initialized. If the system is unable to find a device listed in fstab it may not boot. USB or SD type drives should not be added to fstab!
You can find out what is already mounted using:
lsblk
Find UUID and labels with:
sudo blkid
Examples
Mount extra data drive:
LABEL=data_drive /data ext4 defaults 0 2
Mount more swap space:
/swapfile1 none sw 0 0
Testing Edits
One you have made your edit, you can test the system with:
sudo mount -a
Use lsblk to see if your changes took effect.