How do I permanently reset the UUID of an LVM partition?
I seem to have solved it now. I am not sure exactly which step solved the problem, but this time I did:
Generate new UUID:
uuidgen
This gave me a new UUID which I then copied into:
sudo tune2fs -U <insert here> /dev/mapper/raidgroup-osbackup
I then disabled the logical volume /dev/mapper/raidgroup-osbackup
using:
sudo lvm lvchange -an /dev/mapper/raidgroup-osbackup
I disabled the other logical volumes on the same volume group and physical volume. I then disabled the underlying (software) RAID array in the "Disks" GUI. I re-enabled the RAID array in "Disks" which in turn automatically re-activated the logical volume whos file system I was messing with. Checking the UUID with blkid
, I could now confirm that the UUID was still changed.
Just as an extra confirmation, I rebooted the Ubuntu live image and once again checked the UUID of /dev/mapper/raidgroup-osbackup
with blkid
. Still changed - so this part is solved now.
Along came a new problem... When rebooting the system from the ordinary install, the boot loader somehow still gets the wrong partition mounted at /
despite the fact that the UUID is now different. I have posted this problem as a new question: Why does Ubuntu mount the wrong partition as root?
Related videos on Youtube
Thomas Arildsen
Updated on September 18, 2022Comments
-
Thomas Arildsen over 1 year
A (dd cloned) backup of my boot partition left me with duplicate UUIDs.
blkid
shows:/dev/sda1: UUID="32579810-0388-416d-bb49-7031ac2c2975" TYPE="ext4" ... /dev/mapper/raidgroup-osbackup: UUID="32579810-0388-416d-bb49-7031ac2c2975" TYPE="ext4" ...
where
/dev/mapper/raidgroup-osbackup
is an LVM device.I booted from a live Ubuntu image and tried:
sudo tune2fs -U random /dev/mapper/raidgroup-osbackup
This appeared to succeed and the target device showed a new UUID.
However, after reboot
/dev/mapper/raidgroup-osbackup
was remounted at/
andblkid
showed the original UUID.I thought the change with
tune2fs
was supposed to be permanent, but this does not seem to be the case. How can I fix this?-
Daniel B over 9 yearsAre you perhaps cloning the entire filesystem? You might want to look into the “Skip Activation” flag for LVM.
-
Thomas Arildsen over 9 yearsI think the duplicate UUID indeed comes from cloning the entire file system with
dd
. It seems it should be easily solved by simply changing the UUID of the backed-up partition. But why does the UUID revert to its original value?
-
-
Thomas Arildsen over 9 yearsIt is my impression that I should not need to modify the
fstab
. I want to retain the original UUID of the partition/dev/sda1
(which is the one I want to boot at/
). So when this is still the UUID listed infstab
and I assign a new one to/dev/mapper/raidgroup-osbackup
, I suppose I should not change the one infstab
?