0/1 Lessons

Introduction to Linux Server Operating Systems

• 30min

0 / 3 lessons complete

Linux Server Installation and Lab Setup

• 23min

0 / 6 lessons complete

Working with the Linux Command Line Interface

• 1hr 30min

0 / 12 lessons complete

User and Group Management

• 44min

0 / 7 lessons complete

Linux Storage

• 30min

0 / 6 lessons complete

Linux Administration Basics

• 53min

0 / 8 lessons complete

Linux Networking

• 47min

0 / 8 lessons complete

Course Conclusion

• 5min

0 / 1 lessons complete

Creating Permanent Mounts with /etc/fstab


Q&A (0)

Resources (0)

Saving Progress...


There are no resources for this lesson.

In this lesson, we will explore how to create permanent mounts in Linux using the /etc/fstab file. This is an essential skill for managing Linux systems, particularly in server environments, where stable and reliable access to different storage volumes is crucial. We'll specifically focus on making the mount of our 25GB disk (sdb) permanent on our "Ubuntu Server" VM.

Understanding the /etc/fstab File

The /etc/fstab file in Linux is used to define how disk partitions, various other storage devices, or remote file systems should be mounted into the filesystem. Each line in the fstab file represents a device or partition and its associated mount point, along with other mount options. Making an entry in this file ensures that the device is mounted automatically at every system startup.

Steps to Create a Permanent Mount

  1. Identify the UUID of the Device: Using UUIDs (Universally Unique Identifiers) is preferable over device names like /dev/sdb because UUIDs remain constant regardless of the state of the system. To find the UUID of your 25GB drive, use:bash
sudo blkid

Locate the line for /dev/sdb and note down its UUID. In my example it is the following:

/dev/sdb: UUID="5e43d35b-acb2-4f7e-a02e-b53b1fe7233a" BLOCK_SIZE="4096" TYPE="ext4"

So I will copy the UUID for future use.

Backup the Existing fstab File: Before editing the fstab file, it's a good practice to create a backup. This way, if something goes wrong, you can restore the original state.

sudo cp /etc/fstab /etc/fstab.backup

Edit the fstab File: Open the fstab file with a text editor. For beginners, nano is a user-friendly option:

sudo nano /etc/fstab

Add Your Mount Entry: In the fstab file, add a line for the new drive. The format should be as follows:

The /mnt/newvolume path assumes you completed the previous lecture where you created this directory.

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
UUID=your-UUID-here /mnt/newvolume ext4 defaults 0 2

Replace your-UUID-here with the actual UUID, and make sure the mount point (/mnt/newvolume) and the filesystem type (ext4) are correct.

You might be wondering what options, dump and pass are used for in the fstab file:

  • Options (<options>): This field defines how the filesystem is mounted. It includes parameters like rw for read-write, ro for read-only, noexec to prohibit executable files, nosuid to block set-user-ID or set-group-ID bits, and nodev to prevent the use of device files. Multiple options can be combined and are often set to defaults for standard settings.
  • Dump (<dump>): Used by the dump backup program to determine whether a filesystem should be backed up. If set to 0, the filesystem is ignored by dump. Most modern systems set this to 0 as they use more advanced backup tools.
  • Pass (<pass>): Dictates the order in which filesystem checks are performed during boot-up by fsck. A setting of 0 means no checks, 1 is typically for the root filesystem (and should be unique), and numbers 2 or higher are for other filesystems, dictating the sequence of checks.

Save the fstab File: After adding the new line, save and exit the editor. In nano, press Ctrl + O, Enter, and then Ctrl + X to do this.

Test the Configuration: To ensure there are no errors in the fstab entry, test it by mounting all filesystems:

sudo mount -a

If there are no error messages, your entry is likely correct.

Reboot and Verify: Reboot the system to ensure the new mount works correctly:

sudo reboot now

Server Academy Members Only

Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.

0 0 votes
Lesson Rating
Notify of
profile avatar
Inline Feedbacks
View all comments