How do I permanently reset the UUID of an LVM partition?

4

1

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?

Thomas Arildsen

Posted 2014-10-30T09:30:12.963

Reputation: 727

Are you perhaps cloning the entire filesystem? You might want to look into the “Skip Activation” flag for LVM. – Daniel B – 2014-10-30T09:37:03.820

1I 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 – 2014-10-30T09:39:38.013

Answers

1

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?

Thomas Arildsen

Posted 2014-10-30T09:30:12.963

Reputation: 727

0

This command

sudo udevadm trigger

shoud update your /dev/disk/by-uuid/ directory. Don't forget to modify your /etc/fstab file.

Hoping that's help.

dubis

Posted 2014-10-30T09:30:12.963

Reputation: 222

It 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 in fstab and I assign a new one to /dev/mapper/raidgroup-osbackup, I suppose I should not change the one in fstab? – Thomas Arildsen – 2014-10-30T10:46:56.890