From: Arno Wagner <arno@wagner.name>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] UUID question
Date: Tue, 18 Dec 2012 09:55:12 +0100 [thread overview]
Message-ID: <20121218085512.GB19928@tansi.org> (raw)
In-Reply-To: <50D0279C.4000305@gmail.com>
On Tue, Dec 18, 2012 at 09:21:48AM +0100, Milan Broz wrote:
> On 12/18/2012 01:36 AM, Arno Wagner wrote:
> > On Mon, Dec 17, 2012 at 04:10:50PM -0800, David Li wrote:
> >> Hi, I wonder if the dm-crypt partition UUID (shown in blkid -p <dev>) can
> >> be used to uniquely associate it with the set of keys the partition will
> >> need. Are there any cases that the UUID would change during the partition's
> >> lifetime?
> >
> > The UUID is actually a filesystem attribute, not a partition
> > attribute. That said, for purpose of an UUID, LUKS is regarded as a
> > filesystem, which is IMO the correct way to view it, but not a
> > perfect one. So, yes, the UUID will change if you do a luksFormat
> > (aptly named if LUKS is regarded as a filesystem), but it will not
> > change otherwise. As a luksFormat invalidates all keys, that should
> > do for your purpose.
>
> Well, it is more complicated. blkid recognizes UUID from metadata
> on disk. There are several groups of metadata and there are priorities
> (raid devices have priority to filesystem for example).
Interesting. I admit I only checked where LUKS and ext2/3/4 keep
the UUID and whether DOS partitions have them. Is there some
documentation on these priorities, or is the source of blkid
authorative?
> UUID is generic attribute, even MD devices, LVM PVs etc have UUID.
>
> LUKS is basically handled like MD (raid) device.
Makes sense.
Arno
> Anyway, question was if UUID can change during lifetime - no.
> (reformat is not part of lifetime, you will lose data)
> To be precise, you can change UUID but it must be explicit user action
> (see man cryptsetup).
>
> And it is preferred way to reference LUKS device by its UUID (if the
> physical disk is moved likde sdb->sdc, it still works).
>
> An example:
>
> # blkid /dev/sdb
> /dev/sdb: UUID="bb0c71ca-24c0-4a73-b7ff-ebdbcf152040" TYPE="crypto_LUKS"
>
> # blkid -U bb0c71ca-24c0-4a73-b7ff-ebdbcf152040
> /dev/sdb
>
>
> And cryptsetup itself (in recent versions) recognizes UUID as device parameter:
>
> #cryptsetup luksOpen UUID=bb0c71ca-24c0-4a73-b7ff-ebdbcf152040 test
> Enter passphrase for /dev/disk/by-uuid/bb0c71ca-24c0-4a73-b7ff-ebdbcf152040:
>
> And you should be able to use UUID in /etc/crypttab as well.
>
> Milan
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt
--
Arno Wagner, Dr. sc. techn., Dipl. Inform., Email: arno@wagner.name
GnuPG: ID: CB5D9718 FP: 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D 9718
----
One of the painful things about our time is that those who feel certainty
are stupid, and those with any imagination and understanding are filled
with doubt and indecision. -- Bertrand Russell
next prev parent reply other threads:[~2012-12-18 8:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 0:10 [dm-crypt] UUID question David Li
2012-12-18 0:36 ` Arno Wagner
2012-12-18 8:12 ` Marc Ballarin
2012-12-18 8:57 ` Arno Wagner
2012-12-18 16:46 ` David Li
2012-12-19 23:30 ` Sven Eschenberg
2012-12-18 8:21 ` Milan Broz
2012-12-18 8:55 ` Arno Wagner [this message]
[not found] <mailman.1.1356001202.8121.dm-crypt@saout.de>
2012-12-20 11:16 ` Yaron Sheffer
2012-12-21 1:24 ` Sven Eschenberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121218085512.GB19928@tansi.org \
--to=arno@wagner.name \
--cc=dm-crypt@saout.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.