I just used sfdisk
to clone my partition table to a new disk,
sudo sfdisk -d /dev/nvme0n1 > /tmp/part.txt
sudo sfdisk /dev/nvme1n1 < /tmp/part.txt
However, now both drives have the same uuid. How can I fix that and generate a new UUID for device with the cloned partition table?
The number that are duped can be seen with sudo fdisk -l
. You can see the "523436E9-4DA5-474F-87CA-D784E4BF345D" is shared as a common "Disk identifier"
Disk /dev/nvme1n1: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
[...]
Disklabel type: gpt
Disk identifier: 523436E9-4DA5-474F-87CA-D784E4BF345D
[...]
Disk /dev/nvme0n1: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
[...]
Disklabel type: gpt
Disk identifier: 523436E9-4DA5-474F-87CA-D784E4BF345D
You can also see a shared UUID with,
❯ lsblk -o +uuid
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS UUID
nvme1n1 259:0 0 1.8T 0 disk
├─nvme1n1p1 259:2 0 512M 0 part
└─nvme1n1p2 259:3 0 1.8T 0 part 7d78ed4b-e4aa-4270-853d-6489ea4d6c54
nvme0n1 259:1 0 1.8T 0 disk
├─nvme0n1p1 259:4 0 512M 0 part /boot/efi 1D40-E385
└─nvme0n1p2 259:5 0 1.8T 0 part / 7d78ed4b-e4aa-4270-853d-6489ea4d6c54
On the partition "7d78ed4b-e4aa-4270-853d-6489ea4d6c54" is shared?
label-id
) – Jaromanda X Jul 31 '23 at 08:06--disk-id
option – Jaromanda X Jul 31 '23 at 08:09fdisk
, and also how to change the UUIDs of many filesystem types. – telcoM Jul 31 '23 at 08:21fdisk
just calls it the "disk GUID". And unfortunately the OP did not specify which type of partition table the question is about - although the presence of NVMe devices makes GPT more likely. – telcoM Jul 31 '23 at 08:29