Level 1
0 / 100 XP

Creating Permanent Mounts with /etc/fstab

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.…