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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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
up vote 13 down vote accepted

Assuming it is an ext2-family filesystem:

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
Andy, you don't even need uuidgen command: "tune2fs -U random /dev/sdb1" should work fine – grzuy Mar 21 '12 at 2:58
How to run it on FAT? – CMCDragonkai Feb 1 at 10:15

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


tune2fs -U random /dev/sdb1

if it's an ext filesystem, or

xfs_admin -U generate /dev/sdb1

if it's an xfs filesystem.

The reason the second partition has the same UUID is because dd just copies data from one file to another (dd if=/dev/sda1 of=/dev/sdb1 = cat /dev/sda1 > /dev/sdb1); dd doesn't know what a partition is, or how to generate a UUID, so it just copied all the data as-is, including the UUID, which is stored in the filysystem superblock near the start of the partition.

By the way,
I also think UUID (Universally Unique IDentifier) is a weird name. It should be called PGUID (Possibly Globally Unique IDentifier), or even better, just ARLN (A Reasonably Large Number).

share|improve this answer
I have backed up one my partitions on /dev/sda6. I get the following error: xfs_admin -U generate /dev/sda6 ERROR: The filesystem has valuable metadata changes in a log which needs to be replayed. Mount the filesystem to replay the log, and unmount it before re-running xfs_admin. If you are unable to mount the filesystem, then use the xfs_repair -L option to destroy the log and attempt a repair. Note that destroying the log may cause corruption -- please attempt a mount of the filesystem before doing this. – gudge Oct 14 '15 at 20:03

Your Answer


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.