Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a fedora guest OS in VMware. I want to expand /boot partition, so I add another virtual disk to this VM, and try to clone the disk.

After dd if=/dev/sda1 of=/dev/sdb1, blkid report that /dev/sda1 and /dev/sdb1 have same UUID/GUID.

It's weird that there're 2 same UUIDs in the universe, how to change one of them to another UUID value?

share|improve this question

migrated from stackoverflow.com May 9 '11 at 2:18

This question came from our site for professional and enthusiast programmers.

4  
It's not weird at all. When you clone a partition with dd, of course the clone will have the same UUID as the original. The UUID is just metadata of the partition - not some inherent property of a physical disk. –  Andrew Medico May 4 '11 at 3:08
    
Thank you Andrew, I thought UUID is a calculated value before when a new partition been created. Now I know it's just a metadata stuff. –  LiuYan 刘研 May 4 '11 at 3:32
    
Thanks Andy, now I got a new UUID on /dev/sdb1 –  LiuYan 刘研 May 4 '11 at 3:53

2 Answers 2

up vote 9 down vote accepted

Assuming it is an ext2-family filesystem:

uuidgen
tune2fs -U <output of uuidgen> /dev/sdb1

Or if you're confident uuidgen is going to work:

tune2fs -U `uuidgen` /dev/sdb1

The UUID is stored in the superblock, so a byte-for-byte copy of the filesystem will have the same UUID.

share|improve this answer
    
Thanks Andy, now I got a new UUID on /dev/sdb1 –  LiuYan 刘研 May 4 '11 at 3:53
5  
Andy, you don't even need uuidgen command: "tune2fs -U random /dev/sdb1" should work fine –  grzuy Mar 21 '12 at 2:58

For XFS, use: xfs_admin -U <uuid> <device>

Use xfs_admin -u <device> to view a UUID (note lower case option to view, versus upper case option to set). Another post on U&L pointed out the blkid command for viewing all or some of the UUIDs on the system.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.