pigmonkey / cryptshot

Open and mount a LUKS volume before performing a backup with rsnaphot
15 stars 5 forks source link

PARTUUID vs UUID #7

Closed livier closed 8 months ago

livier commented 8 months ago

I want to use your script, thanks for having doing it ;-)

I want to make backups on a usb-drive, and a meeted a difficulty when connecting it to another usb-port.

I founded a solution by changing all "uuid" references in the script by "partuuid" witch , in my knowledge, will never change.

I also change [ echo "Volume $PARTUUID not found." ] by [ echo "$volume not found." ] for a outputa bit more explicit>

Are you ok with that and do you want to enhance the script with it ?

Another bug-report for another topic to follow ...

pigmonkey commented 8 months ago

The UUID of a disk will not change when it is plugged into different USB ports. It is persistent and unique to the filesystem. It only changes when a partition is reformatted.

You should not have to use PARTUUID, but you may be using an incorrect value as the UUID if it isn't persistent for you.

livier commented 8 months ago

Thanks for the link, understood and tested, you are rignht, excuses for the noise.

livier commented 8 months ago

@pigmonkey For the record I understood why I thougt UUID was changing .... There is a difference between UUID of the uncryped LUKS partition and the decrypted one ; while the PARTUUID is still the same.

pigmonkey commented 8 months ago

That makes sense. If your LUKS partition was inside of a LVM mapper, I don't think it would even have a PARTUUID value.

livier commented 8 months ago

I have a LVM mapper as principal disk for the computer, but not for the USB one concerned here !

livier commented 8 months ago

Furthermore, the UUID is not the same when the volume is mounted by root or by the user, whereas PARTUUID remains the same.

pigmonkey commented 8 months ago

The UUID is assigned by the file system formatter (eg, mkfs.ext4). It doesn't have anything to do with the user, or even if the file system is mounted or not. I can plug the same drive into different computers with completely different users and get the same UUID for the file system. I don't know why you would be seeing different values.