Change UUID under Linux?
Those working with ordinary disks can do this simply with tune2fs
and uuidgen
.
Example: using a not currently mounted device /dev/sdb1
tune2fs /dev/sdb1 -U `uuidgen`
The new UUID will be immediately visible under
ls -l /dev/disk/by-uuid
if, say, you need to copy the value to /etc/fstab for automatic mount.
However, blkid
will continue to (erroneously) report the old value until the cache is updated (on reboot, for example; though the cache may be bypassed with sudo blkid -c /dev/null
).
Alternatively, the new UUID may be obtained via udev with
sudo lsblk -fo UUID /dev/sdb1
Those working with LVM disks might like to check the answer here.