UUID question
Hi Sven,
a quick correction: blkid is (surprisingly) not smart enough, and your command line results in duplicates. Both the /dev (e.g. /dev/sdg) and the equivalent /dev/disk/by-uuid are listed.
So you want to use:
blkid -t TYPE="crypto_LUKS" -s UUID /dev/disk/by-uuid/*
(tested on Ubuntu 10.04 Lucid).
Thanks,
Yaron
Quoted 37 lines · On 12/20/2012 01:00 PM, [email protected] wrote:
Date: Thu, 20 Dec 2012 00:30:23 +0100
From: "Sven Eschenberg" <[email protected]>
To: [email protected]
Subject: Re: [dm-crypt] UUID question Message-ID:<[email protected]>Content-Type: text/plain;charset=utf-8
cryptsetup luksUUID <dev> will return the luks header's UUID if <dev> holds a luks header, and yes, this should usually not change the same way as the UUID of a filesystem souldn't.
There's 2 problems though:
1.) You'd have to know <dev> in advance or iterate over all possible (non locked) blockdevices (which is what blkid usually does anyway for you)
2.) a blockdev could possibly hold a luks header and still be part of a md device (depending on metadata version), you'd better hope that the md device is set up already, when you issue your cryptsetup commands.
Concerning the original question:
The UUID within the LUKS header should not change throughout the LUKS volume's lifetime, except for enforced changes (as noted before).
To associated keys based on luks UUID, using something like:
'blkid -t TYPE="crypto_LUKS" -s UUID'
is probably a good starting point, as it gives you the UUID to retrieve the keys based on the UUID and the device inode you'd use on further calls to cryptsetup etc. - The rest is just a little shell magic ;-)Regards
-Sven
Hi Yaron,
Old bugs it seems. Neither my gentoo box, nor a Ubuntu 12.10 showed the behavior you describe. Can you verify that the entries under /dev/disk/by-uuid/ are softlinks on Lucid?
Regards
-Sven
Quoted 63 lines · Yaron Sheffer
Hi Sven,
a quick correction: blkid is (surprisingly) not smart enough, and your command line results in duplicates. Both the /dev (e.g.
/dev/sdg) and the equivalent/dev/disk/by-uuidare listed.So you want to use:
blkid -t TYPE="crypto_LUKS" -s UUID
/dev/disk/by-uuid/*(tested on Ubuntu 10.04 Lucid).
Thanks,
YaronQuoted 36 lines · On 12/20/2012 01:00 PM, [email protected] wrote:
Date: Thu, 20 Dec 2012 00:30:23 +0100
From: "Sven Eschenberg" <[email protected]>
To: [email protected]
Subject: Re: [dm-crypt] UUID question Message-ID:<[email protected]>Content-Type: text/plain;charset=utf-8
cryptsetup luksUUID <dev> will return the luks header's UUID if <dev> holds a luks header, and yes, this should usually not change the same way
as the UUID of a filesystem souldn't.There's 2 problems though:
1.) You'd have to know <dev> in advance or iterate over all possible (non
locked) blockdevices (which is what blkid usually does anyway for you)2.) a blockdev could possibly hold a luks header and still be part of a md
device (depending on metadata version), you'd better hope that the md device is set up already, when you issue your cryptsetup commands.Concerning the original question:
The UUID within the LUKS header should not change throughout the LUKS volume's lifetime, except for enforced changes (as noted before).
To associated keys based on luks UUID, using something like:
'blkid -t TYPE="crypto_LUKS" -s UUID'
is probably a good starting point, as it gives you the UUID to retrieve the keys based on the UUID and the device inode you'd use on further calls
to cryptsetup etc. - The rest is just a little shell magic ;-)Quoted 5 lines
Regards
-Sven
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt