When I try to mount my Amazon Elastic Block Store (Amazon EBS) volume, I get the following error:
root@:~# mount /dev/nvme2n1 /lv2mount: /lv2: wrong fs type, bad option, bad superblock on /dev/nvme2n1, missing codepage or helper program, or other error.
Resolution
When you're mounting your Amazon EBS volume, you can get this error because of a UUID conflict issue with the XFS file system.
Check if it's a UUID conflict issue
To determine if it's a UUID conflict issue, complete the following steps:
1. Run the blkid command to check the UUID of the file system:
root@:~# blkid
/dev/nvme0n1p1: LABEL="cloudimg-rootfs" UUID="ce780dbf-6f70-412d-87dd-61654730a231" TYPE="ext4" PARTUUID="bf0d338c-01"
.......
/dev/nvme1n1: UUID="2ddd89c4-415a-4aee-8431-abecdd8c79b8" TYPE="xfs"
/dev/nvme2n1: UUID="2ddd89c4-415a-4aee-8431-abecdd8c79b8" TYPE="xfs"
2. Check the Linux kernel ring buffer to confirm that it's a UUID conflict issue.
root@:~# blkid
..........
[ 5444.389157] XFS (nvme2n1): Filesystem has duplicate UUID 2ddd89c4-415a-4aee-8431-abecdd8c79b8 - can't mount
Ignore the UUID check, or change the UUID of one of the file systems
If you don't want to change either of the file systems, then you can use the nouuid option to ignore the UUID check:
root@:~# mount -o nouuid /dev/nvme2n1 /lv2
root@:~# df -h |grep lv2
/dev/nvme2n1 1014M 40M 975M 4% /lv2
Or, you can change the UUID of one of the file systems:
root@:~# xfs_admin -U generate /dev/nvme2n1
Clearing log and setting UUID
writing all SBs
new UUID = 02f8750a-c482-4ed1-949c-4088f2ecc04a
root@:~# blkid
/dev/nvme0n1p1: LABEL="cloudimg-rootfs" UUID="ce780dbf-6f70-412d-87dd-61654730a231"
TYPE="ext4" PARTUUID="bf0d338c-01"
/dev/nvme1n1: UUID="2ddd89c4-415a-4aee-8431-abecdd8c79b8" TYPE="xfs"
/dev/nvme2n1: UUID="02f8750a-c482-4ed1-949c-4088f2ecc04a" TYPE="xfs"
root@:~# mount /dev/nvme2n1 /lv2