• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL : How to mount filesystems using UUID

by admin

The device can be identified by a full path to a block device (for example, /dev/sda3) , a universally unique identifier (UUID; for example, UUID=3bf2d836-be7d-4e69-a1ff-4ffd2661edcf) , or a volume label (for example, LABEL=home). The device node name of a disk (/dev/sda, /dev/hda, /dev/vda, etc.) may change in some situations. For example, after switching cables around or upgrading certain packages, sda & sdc could swap places. This causes problems when /etc/fstab references filesystems by the disk names.

Note : UUIDs and labels are not required if a filesystem resides on an LVM logical volume, as in default RHEL installations.

1. Determine the UUID of a Particular Device.

# blkid /dev/sdb1
/dev/sdb1: UUID="3bf2d836-be7d-4e69-a1ff-4ffd2661edcf" TYPE="ext4"

2. Edit the /etc/fstab file and change the device path with the UUID of the file system, for example:

# vi /etc/fstab
UUID=3bf2d836-be7d-4e69-a1ff-4ffd2661edcf    /home                   ext4    defaults        1 2

3. During the next reboot of the computer, the filesystem will be mounted using the UUID.

Conclusion

It is not safe to use block device node names like /dev/sda1 and /dev/vdb2 to refer to filesystems in /etc/fstab. Instead, use filesystem UUIDs (universally unique identifiers) or labels. Either of these allow for identifying a filesystem without resorting to ephemeral block device names.

Filed Under: Linux

Some more articles you might also be interested in …

  1. “git standup” Command Examples
  2. “go clean” Command Examples
  3. bfg Command Examples (Remove large files or passwords from Git history like git-filter-branch)
  4. blackfire: A command-line profiling tool for PHP (Command Examples)
  5. udisksctl: command not found
  6. linkchecker Command Examples
  7. 18 Practical tcpdump Command Examples – A Network Sniffer Tool Primer
  8. How to Lock and Unlock Zimbra Accounts from Command Line
  9. caja Command Examples in Linux
  10. rsyslogd Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright