How to Change the UUID of a Linux Disk Partition

Jerry’s Notes
What’s next?
Published in
1 min readSep 25, 2019

怎麼去變更Disk Partition的UUID ?

當您使用snapshot還原相同一個Disk時~ 就需要將第2顆Disk做變更UUID的動作!

What Is UUID?
UUID stands for Universally Unique Identifier which helps Linux system to identify a hard drives partition instead of block device file.

Step1 check current disk uuid
# sudo blkid
/dev/xvdf1: UUID="1b6848ba-ec9e-4ab5-a77d-571acfb8dba4"
Step2 generate a UUID
# uuidgen
9008a8bf-8baf-4b3a-9d2a-4cc59ca3cb28
Finally step to apply the new UUID on disk partition
# sudo tune2fs /dev/xvdf1 -U 9008a8bf-8baf-4b3a-9d2a-4cc59ca3cb28
tune2fs 1.42.9 (28-Dec-2013)
The UUID may only be changed when the filesystem is unmounted. <— remember, unmount disk partition first
# blkid
/dev/xvdf1: UUID="9008a8bf-8baf-4b3a-9d2a-4cc59ca3cb28”

Reference:
https://www.unix.com/man-page/centos/1/uuidgen/

--

--

Jerry’s Notes
What’s next?

An cloud support engineer focus on troubleshooting with customer reported issue ,and cloud solution architecture.