If you’re new to Linux, you may have encountered the term “fstab file” and wondered what it is and how to edit it. In this article, we’ll explain the fstab file, how to edit it, and how to reload it after making changes.
What is the fstab file in Linux?
The fstab file is a configuration file in Linux systems that specifies how the file system should be mounted at boot time. The file contains information about each file system, including the device name, mount point, file system type, and mount options. When the system boots, the fstab file is read and used to mount the file systems listed in the file.
How to edit the fstab file
Editing the fstab file requires root privileges. To edit the file, you can use a text editor such as vi, nano, or gedit. Here are the steps to edit the fstab file:
- Open a terminal window
- Type “sudo nano /etc/fstab” (without the quotes) and press Enter.
- Enter your root password when prompted.
- Use the arrow keys to navigate to the line you want to edit.
- Edit the line as desired. Each line in the file has six fields, separated by tabs or spaces. The fields are:
- Device: The device name or UUID of the file system.
- Mount point: The directory where the file system is mounted.
- File system type: The type of file system, such as EXT4, NTFS, or NFS.
- Mount options: Optional mount options, such as “defaults” or “noauto”.
- Dump: A value indicating whether the file system should be backed up.
- Pass: A value indicating the order in which file systems should be checked at boot time.
- Once you have made your changes, press Ctrl+X, then Y, then Enter to save the file.
How to reload the fstab file
After making changes to the fstab file, you must reload the file system table to apply the changes. You can do this by using the mount command with the -a option. Here are the steps to reload the fstab file:
- Open a terminal window
- Type “sudo mount -a” (without the quotes) and press Enter.
- If there are any errors in the fstab file, the system will report them. Fix the errors and save the file again.
- Once the file is reloaded without errors, your changes to the fstab file will take effect.
The fstab file is an important configuration file in Linux systems that specifies how file systems should be mounted at boot time. Editing the fstab file requires root privileges and can be done using a text editor. After making changes to the file, you need to reload the file system table using the mount command with the -a option. Remember to double-check your changes before saving the file and reloading the table to avoid any errors that could cause problems during boot time.