• 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. Configure Network Bonding in Ubuntu Server
  2. apktool – Reverse engineer APK files (Command Examples)
  3. ubuntu-drivers: command not found
  4. wifi-menu: command not found
  5. CentOS / RHEL 7 : How to specify command-line arguments and options when the dhcpd service is started
  6. CentOS / RHEL : How to add a null route in Linux
  7. nslookup: command not found
  8. How to Partition DM-Multipath Pseudo Devices in CentOS/RHEL
  9. nsxiv Command Examples
  10. gnome-terminal Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • glab Command Examples
  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright