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

NFS Client

Services to check.

chkconfig nfs on
service rpcbind start
service nfs start
mount -a

If missing, install it.

yum install nfs-utils nfs-utils-lib

Mount it.

mount -a
mount 192.168.1.200:/home /mnt/nfs/home

Add to /etc/fstab.

10.10.10.10:/home on /mnt/nfs/home type nfs (rw,noatime,nolock,bg,nfsvers=2,intr,tcp,actimeo=1800,addr=10.10.10.10)

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

Mount and Unmount EFS

Here’s the command to mount and unmount AWS EFS. Assuming the EFS IP address is 10.0.0.23.

Mount:

mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 10.0.0.23:/ /efs

Umount:

# lazy unmount
umount -l /efs
# force unmount
umount -f /efs

You may have to force it if it’s busy.

AWS EFS Userdata

If you want to auto mount the EFS volumes when the instance is created, add the following script to userdata:

#cloud-config
repo_update: true
repo_upgrade: all
 
packages:
- amazon-efs-utils
 
runcmd:
- file_system_id_01=fs-12345678
- file_system_id_02=fs-34593405
- efs_directory_01=/mnt/efs
- efs_directory_02=/mnt/efs2
 
- mkdir -p ${efs_directory_01}
- mkdir -p ${efs_directory_02}
 
- echo "${file_system_id_01}:/ ${efs_directory_01} efs tls,_netdev" >> /etc/fstab
- echo "${file_system_id_02}:/ ${efs_directory_02} efs tls,_netdev" >> /etc/fstab
 
- mount -a -t efs defaults

Just add more if you have more mounts.