UUID and Drive Cloning
UUIDs are not hardware-specific but stored in the partition's filesystem. That means cloning a disk or partition with dd
will result in the same UUID.
You can assign a new UUID by using:
tune2fs -U random <device>
(ext2/ext3/ext4)xfs_admin -U generate <device>
(xfs)reiserfstune -u $(uuidgen) <device>
(reiserfs)mkswap -U $(uuidgen) <device>
(swap)
Having duplicated UUIDs doesn't necessarily lead to errors. However booting and mounting a device by UUID will become ambiguous and may lead to the wrong device being used.
Related videos on Youtube
Matt Clark
I dream; I design; I build; I program; I repeat; I design; I build; I program; I repeat; I dream; I build; I program; I repeat; I dream; I design; I program; I repeat; I dream; I design; I build; I repeat; I dream; I design; I build; I program; MClarkDev.com [email protected]
Updated on September 18, 2022Comments
-
Matt Clark over 1 year
When cloning a drive (using
dd
), will the UUID's for each partition change, or are they hardware specific? or does cloning it preserve the UUID as well?What happen if a system detected two devices with the same UUID?
-
Ƭᴇcʜιᴇ007 about 10 yearsWhy not just try it yourself and see if they change?
-
Matt Clark about 10 years32gb USB to USB across a VM.... :'(
-
Ƭᴇcʜιᴇ007 about 10 yearsIf you just want to test if DD changes UUID's or not, then why not just use a small test source disk/partition with little data on it, locally?
-
Matt Clark about 10 yearsAnd the last part is still valid. If the UUID stays the same, how the the system deal with multiple of the same UUID? I guess that works...
-
Ƭᴇcʜιᴇ007 about 10 yearsRelated: askubuntu.com/questions/156063/…
-
Matt Clark about 10 yearsI failed to find this in my initial search. Found my answer, and I appreciate the help.
-
-
Admin about 2 years"However booting and mounting a device by UUID will become ambiguous and may lead to the wrong device being used." Yes. This can become really dangerous when a cloned disk is used as backup. You need to double check that /home is really the disk you think it is. A "backup" done in the wrong direction can wipe out data from both disks.