0

(Partially related to this but the case is significantly different)

Recently I have cloned a drive and I need to use both in my system without formatting either one of them, so I need to change one drive's UUID.

It would be simple enough if it was a LUKS ext4 volume, but the drive has 2 VeraCrypt encrypted partitions that have an NTFS filesystem, so tune2fsisn't an option.

I need to change both the outer volumes' UUIDs (/dev/sddX) and the inner volumes' UUIDs (/dev/mapper/veracryptX).

Thanks in advance!

Origami
  • 1
  • 2

1 Answers1

0

So, I have managed to do it myself, these are the steps (for an MBR dirk):

First of all, you need to change the UUIDs of the inner, encrypted filesystems, per partition.

  1. Decrypt /dev/sdX# using VeraCrypt and don't mount it, you'll get a device named /dev/mapper/veracrypt1

  2. Use blkid to find the UUID of `/dev/mapper/veracrypt1'

  3. Edit /dev/mapper/veracrypt1 with a hex editor (e.g. hexedit) and replace bytes that represent your UUID (they are in reverse order, due to endianness).

  4. Close the mapper device from VeraCrypt.

  5. Repeat 1-4 for any subsequent encrypted partitions.

Now you want to change the PARTUUID of an MBR disk. It's generated basing on the MBR of the drive itself.

  1. Use blkid to find the PARTUUID of the drive you want to modify (/dev/sdX#)

  2. Open /dev/sdX with a hex editor (e.g. hexedit)

  3. Search for the PARTUUID you found before, without the "-" character and anything after that. It's also in reverse order, due to endianness.

  4. Modify the PARTUUID (which is actually the disk's MBR identifier) how you see fit.

That's all, just make sure not to screw anything up.

Origami
  • 1
  • 2