Using DD to copy drives results in duplicate UUID values.

General support questions
Post Reply
zach_gamma
Posts: 30
Joined: 2012/01/13 12:54:11

Using DD to copy drives results in duplicate UUID values.

Post by zach_gamma » 2012/02/26 05:24:37

Hi Peoples.

I wanted to create a duplicate of system drive so I could play on the copy and not impact the original install.
To copy I booted from a Knoppix I used the DD command.
I used the command
dd if=/dev/sda6 of=/dev/sda8 Conv=noerror,sync

(As a side issue, this was very slow process running some hours, because I was copying from one partition to another partition on the same disk)

This appeared to work fine but what did not know was that this resulted in the target partition having the same UUID as the source. This resulted in some really weird results, maybe the system randomly selected between the duplicate partitions.

The UUID is used in two locations: /boot/grub/grub.conf & /etc/fstab

EG
/boot/grub/grub.conf uses the UUID
"kernel /boot/vmlinuz-2.6.32-220.4.2.el6.x86_64 ro root=UUID=fb5dd7a7-44dd-4aa0-ad0d-aee9b81642a3 "

/etc/fstab
UUID=fb5dd7a7-44dd-4aa0-ad0d-aee9b81642a3 /

This resulted in me getting weird results when I rebooted.
When I noted the duplicate UUID I used the following process to associate a new UUID

uuidgen
tune2fs /dev/sda6 -U

I then updated grub.conf but forgot to update fstab which resulted in the system appararently booting from from the wrong partition. To correct this I updated fstab to use the newly generated UUID.

Cheers Zach

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Using DD to copy drives results in duplicate UUID values.

Post by pschaff » 2012/02/26 23:38:34

If you duplicate a drive with dd then you need to anticipate duplicate UUIDs and/or LABELs and deal with them.

If there is an open question I don't see one. Is this topic resolved?

Post Reply