Search This Blog

Sunday, November 18, 2018

Change UUID of new AWS volume

Before using the new volume its UUID must be changed, so it matches that of the original volume.

This command prints attributes for the block devices it finds on the system. For example,

/dev/xvda: LABEL="cloudimg-rootfs" UUID="8cd9967e-f9c0-438f-bebd-a0a7c5886e24" TYPE="ext4" PTTYPE="dos"
Copy the UUID string from the result of blkid(the one for original volume /dev/xvda) and use it with tune2fs, replacing <uuid> below,

sudo tune2fs -U <uuid> /dev/xvdf
Please note, if tune2fs fails to change the UUID, you may need to unset uninit_bg flag* on the new volume, before trying the same command again.

sudo tune2fs -O ^uninit_bg /dev/xvdf
* Don’t forget to run e2fsck after disabling/enabling this flag.