Change encrypted partition UUID
7,564
Solution 1
For changing the file system UUID you have to decrypt /dev/sda1
and then run tune2fs on the decrypted device mapper device.
sda1
itself does not have a UUID thus it cannot be changed.
The LUKS volume within sda1
does have a UUID (which is of limited use because you probably cannot use it for mounting), though. It can be changed with
cryptsetup luksUUID /dev/sda1 --uuid "$newuuid"
Solution 2
To change the UUID of the LUKS volume, use cryptsetup luksUUID --uuid=<the new UUID> /dev/sda1
.
Related videos on Youtube
Author by
Hacktivista
Updated on September 18, 2022Comments
-
Hacktivista over 1 year
I'm trying to change a partition's UUID, the problem is that I'm trying to change an encrypted volume. So I can't use the usual method described here. Since it throws the following error:
tune2fs: Bad magic number in super-block while trying to open /dev/sda1 Couldn't find valid filesystem superblock.
So let's suppose this is my
blkid
:/dev/sda1: UUID="adc4277c-0057-4455-a25e-94dec062571c" TYPE="crypto_LUKS" PARTUUID="23487624-01" /dev/sda2: UUID="9f16a55e-954b-4947-87ce-b0055c6ac953" TYPE="crypto_LUKS" PARTUUID="23487624-02" /dev/mapper/root: LABEL="root" UUID="6d1b1654-016b-4dc6-8330-3c242b2c538b" TYPE="ext4" /dev/mapper/home: LABEL="home" UUID="9c48b8fe-36a6-4958-af26-d15a2a89878b" TYPE="ext4"
What I want to change in this example is the /dev/sda1 UUID. How can I achieve this?
-
Gilles 'SO- stop being evil' over 8 yearsDo you want to change the UUID of the filesystem, or the UUID of the encrypted volume?
-
Hacktivista over 8 yearsAs stated, the /dev/sda1 UUID
-
-
Hacktivista over 8 yearsThat's /dev/mapper/root but if I run tune2fs on that "device" it will not change the /dev/sda1 device
-
Hauke Laging over 8 years@Hacktivista Added some info.