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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. qm Command Examples in Linux
  2. pacstrap: command not found
  3. gedit: command not found
  4. Getting info with the vsish command (esxi only)
  5. pactl: command not found
  6. atop Command Examples in Linux
  7. How to install zip/unzip package in Linux CentOS/RHEL 7 and 8
  8. How to configure interface in “Promiscuous Mode” in CentOS/RHEL
  9. rpcinfo: can’t contact rpcbind: : RPC: Authentication error; why = Client credential too weak
  10. CentOS / RHEL : How to setup session idle timeout (inactivity timeout) for ssh auto logout

You May Also Like

Primary Sidebar

Recent Posts

  • qmrestore Command Examples in Linux
  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright