Unable to mount the filesystem due to duplicate UUID error.

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 7
  • XFS

Issue

  • Unable to mount the XFS filesystem. Duplicate UUID errors are logged in dmesg.
# dmesg | tail
Oct 16 03:29:22 hostname kernel: XFS (sdc1): Filesystem has duplicate UUID c4e2eef9-c744-4c64-8ebc-044373f84ddc - can't mount
Oct 16 03:29:27 hostname kernel: XFS (sdc1): Filesystem has duplicate UUID c4e2eef9-c744-4c64-8ebc-044373f84ddc - can't mount
  • How to change UUID of the XFS filesystem?
  • Unable to mount LVM snapshot of a XFS file-system
 # mount /dev/xfs_snap/snap snap
 mount: wrong fs type, bad option, bad superblock on /dev/xfs_snap/snap,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

Resolution

  • Generate unique and new UUID for the affected XFS filesystem using xfs_admin utility.
[ root@hostname ~ ]#  xfs_admin -U generate /dev/vg/lv
Clearing log and setting UUID
writing all SBs
new UUID = 9e1c84e4-b33f-4138-9992-c38b25b84237
  • It is possible to specify custom UUID using the xfs_admin utility.
[ root@hostname ~ ]# xfs_admin -U 9e1c84e4-b33f-4138-9992-c38b25b84237 /dev/vg/lv
  • If the UUID of boot or root partition is changed, rebuilding the grub is required.
[ root@hostname ~ ]# grub2-mkconfig -o /boot/grub/grub.cfg
  • Refer an article to change UUID of ext filesystem.

  • As a workaround, Mount the file-system with the nouuid option.

mount -o nouuid /dev/vg/lv  /xfs

Root Cause

  • XFS filesystem has UUID which are unique identifiers of the filesystem.
    Two file systems with same UUID can not be mounted on the same system.
  • If the backing storage of filesystem is cloned or replicated, the metadata that contains UUID information for filesystem will be identical on both filesystems.
  • LVM snapshots will have same UUID as original filesystem.

Diagnostic Steps

  • Check /var/log/messages while mounting the filesystem.
[ root@hostname ~ ]#  tail -f /var/log/messages
Oct 16 03:29:22 hostname kernel: XFS (sdc1): Filesystem has duplicate UUID c4e2eef9-c744-4c64-8ebc-044373f84ddc - can't mount
Oct 16 03:29:27 hostname kernel: XFS (sdc1): Filesystem has duplicate UUID c4e2eef9-c744-4c64-8ebc-044373f84ddc - can't mount
  • Mount the filesystem using nouuid option to check integrity of the filesystem.
# mount -t xfs -o nouuid /dev/vg/lv   /mnt

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.