Unable to mount the filesystem due to duplicate UUID error.
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
- XFS
Issue
-
Unable to mount the XFS filesystem.
Duplicate UUID
errors are logged indmesg
:# 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:# xfs_admin -U generate </path/to/dev/device> 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, as well:# xfs_admin -U 9e1c84e4-b33f-4138-9992-c38b25b84237 </path/to/dev/device>
-
If the UUID of boot or root partition is changed, rebuilding the grub is required:
# grub2-mkconfig -o /boot/grub2/grub.cfg
On UEFI-based machines, enter:
# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
-
As a workaround, mount the filesystem with the
nouuid
option:# mount -o nouuid </path/to/dev/device> </path/to/mount/point>
-
Please refer to article for changing UUID of ext* filesystem.
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
orjournal
ordmesg
while mounting the filesystem:# 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 -o nouuid </path/to/dev/device> </path/to/mount/point>
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.
Comments