Skip to main content
Linux attaches storage devices to the directory tree by “mounting” them on existing folders. In this guide, you’ll learn how to:
  • Manually mount and unmount filesystems
  • Configure automatic mounts at boot using /etc/fstab
  • Enable swap partitions at startup
  • Use UUIDs for stable device identification

1. Manual Mounting and Unmounting

1.1 Verify an Empty Mount Point

A common temporary mount directory is /mnt. Confirm it’s empty:

1.2 Mount an XFS Filesystem

Assuming you created an XFS filesystem on /dev/vdb1, mount it to /mnt:
Now /mnt is the root of that filesystem. Create a test file and verify:
Use lsblk to confirm the mount point:

1.3 Unmount the Filesystem

To detach the filesystem:
Then verify it’s no longer mounted:

2. Automatic Mounting at Boot with /etc/fstab

The /etc/fstab file defines filesystems to mount automatically during system startup.

2.1 Create the Mount Point

2.2 Understand /etc/fstab Fields

2.3 Add an XFS Entry

Open /etc/fstab in your editor:
Append:
If you don’t plan to reboot immediately, apply the new mounts with:

2.4 Verify and Reboot

Confirm /mybackups is not yet mounted:
Reboot the system:
After login, verify the mount:

3. Enabling Swap at Boot

If you created a swap partition on /dev/vdb3, add it to /etc/fstab so it’s activated at startup.

3.1 Add Swap Entry

Edit /etc/fstab and append:
Here, the mount point is none, and 0 0 disables dump and fsck.

3.2 Verify Swap

Reload systemd (or reboot) and check:

4. Using UUIDs Instead of Device Names

Device names can change if hardware is reconfigured. UUIDs remain constant.

4.1 Retrieve a Device’s UUID

4.2 Example /etc/fstab Entry with UUID


Watch Video