• 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. “error: Bind to port 2222 on 0.0.0.0 failed: Permission denied” – error while starting sshd service on CentOS/RHEL
  2. CentOS / RHEL : How to add swap file
  3. CentOS / RHEL : Installing and Configuring ASMLib
  4. How To Create A SSH Banner in CentOS/RHEL Server
  5. Example of using getnstimeofday in Linux kernel
  6. CentOS / RHEL : How to install Open Virtual Machine Tools for Virtual machines Hosted on VMWare
  7. printk and console log level
  8. chown Command Examples in Linux
  9. lolcat: command not found
  10. How to create snapshot of LVM thin volumes using snapper command

You May Also Like

Primary Sidebar

Recent Posts

  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found
  • macof: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright