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. Instead, use filesystem UUIDs (universally unique identifiers) or labels. Either of these allow for identifying a filesystem without resorting to ephemeral block device names.
Note: UUIDs and labels are not required if a filesystem resides on an LVM logical volume, as in default RHEL installations.
Changing the UUID of VG or PV
The UUID of VG/PV can be re-generated with command
vgchange/pvchange. From the Man Page of pvchange and vgchange:
The UUID of VG/PV can be re-generated with command vgchange/pvchange. From the Man Page of pvchange and vgchange:
# man pvchange -u, --uuid Generate new random UUID for specified physical volumes.
# man vgchange -u, --uuid Generate new random UUID for specified Volume Groups.
1. Please make sure to deactivate the VG in question before changing the UUID. For this, we need to unmount the LVs on the VG and logical volumes too will be deactivated.
# vgchange -an vg-name
2. Once the logical volumes are inactive, change the UUID by using the command:
# vgchange --uuid [vg-name] # pvchange --uuid [pv-name]
3. Once the UUID is changed, you could activate the VG with:
# vgchange -ay vg-name
4. Make sure that all logical volumes and physical volumes are correctly reported:
# vgdisplay -v
5. When modifying existing UUIDs, make sure to update any references to the old labels in fstab. First, check for the new UUID and then make appropriate changes in the /etc/fstab file. For example:
# blkid | grep [ vg name or pv name ] [vg or pv]: UUID="d2c27808-f88f-44bc-bb1d-de3b03d133e4" TYPE="ext4"
# vi /etc/fstab UUID="d2c27808-f88f-44bc-bb1d-de3b03d133e4" /data ext4 defaults 0 2
6. Lastly, make sure that the filesystems stored on the logical volume can be successfully mounted.