XFS Filesystem has duplicate UUID

Here’s how to fix a duplicate UUID on a XFS file system.

mount -o rw,nouuid /dev/sda1  /data

Mounting with nouuid will work, but not after a reboot.

To avoid a duplicate ID, run this command to generate a new UUID.

xfs_admin -U generate /dev/sda3
Clearing log and setting UUID
writing all SBs
new UUID = xxxxx-xxxx-xxxx-xxxxxxxxx

XFS vs Ext4 Commands

File system command differences between ext3 and xfs.

Taskext4xfs
Creating a file systemmkfs.ext4mkfs.xfs
Mounting a file systemmountmount
Resizing a file systemresize2fsxfs_growfs
Repairing a file systeme2fsckxfs_repair
Changing the label on a file systeme2labelxfs_admin -L
Reporting on disk space and file usagequota quota
Debugging a file systemdebugfsxfs_db
Saving critical file system metadata to a filee2imagexfs_metadump

Adding a XFS Volume

Add a disk volume via cloud console. Then perform the following commands:

# check the new block
lsblk
# format
fdisk /dev/sdc
# create file system
mkfs.xfs -f /dev/sdc1
# get uuid
blkid /dev/sdc1
# vi /etc/fstab
UUID="xxxxxxxxxxxxxxxxxxxxx" /mnt/directory xfs defaults 0 0
# mount
mount -a

xfs vs ext 2/3/4

When resizing disks, here are the commands for each respected file system.

For xfs:

xfs_growfs /dev/vgname/lgname

For ext 2/3/4:

resize2fs /dev/vgname/lgname