How do I permanently reset the UUID of an LVM partition?
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 /
and blkid
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?
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?