Besides of ext2 /ext3 / ex4 and xfs, you can also change UUID of the following filesystem or block device.
swaplabel -U $NEW_UUID
Software RAID (md raid)
For MD RAID, you must stop the RAID first, then update the UUID when re-assembling. So if your RAID is mounted to
/, you need update UUID in offline mode -- use a live CD to do it.
mdadm --stop $RAID_DEVICE
mdadm --assemble $RAID_DEVICE --update=uuid --uuid=$NEW_UUID $MEMBER_DEVICES...
mdadm --stop /dev/md127
mdadm --assemble /dev/md127 --update=uuid --uuid=2A1D2A1D-2A1D-2A1D-2A1D-2A1D2A1D2A1D /dev/sda2 /dev/sdb2
After UUID been updated, you may need to update
linux/linuxefi/linux16 command line) and/or
update-initramfs (Debian family) and/or
dracut --force (Red Hat family) so that you can boot successfully next time.
cryptsetup luksUUID --uuid=$NEW_UUID $LUKS_DEVICE
cryptsetup luksUUID --uuid=e0c0e0c0-e0c0-e0c0-e0c0-e0c0e0c0e0c0 ~/encrypted-LUKS.loop
FAT / NTFS / exFAT
This is another story here,
currently there're no utilities to modify the filesystem UUID of these filesystems (See reichhart's answer -- the
mlabel tool), but we can modify raw data on disk to do this.
WARNING, it's dangerous to modify raw data on disk, and could lost data without careful operation.
Here's detail steps to modify raw data on disk using
blkid, write down the UUID of filesystem to paper, or remember it. The UUID string of FAT / exFAT looks like
1122-3344, UUID string of NTFS looks like
Open partition device using hexedit
hexedit <partition device such as /dev/sda1>
- Press /, enter the UUID in reverse order (if
1234-ABCD, then search
CDAB3412) to search the UUID data on disk.
- Once UUID is located, change them, press F2 to save and exit.
blkid to verify the UUID.
- Once UUID is modified, you may need to update
fstab so that you can boot successfully next time.
fsck <partition device such as /dev/sda1> and see a "There are differences between boot sector and its backup" message. In order to solve it, select "1) Copy original to backup", and if you are asked "Perform changes ? (y/n)" you press y.