All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <gmazyland@gmail.com>
To: ".. ink .." <mhogomchungu@gmail.com>
Cc: dm-crypt@saout.de
Subject: Re: [dm-crypt] crypt_get_uuid does not work as expected with plain volumes
Date: Mon, 21 Jan 2013 15:19:07 +0100	[thread overview]
Message-ID: <50FD4E5B.7000606@gmail.com> (raw)
In-Reply-To: <CAFnMBaS6sY5MrAe=Usmxev+JYk-9M=Yy4-9OqkbOv9a+jEqrqA@mail.gmail.com>

On 01/21/2013 02:40 PM, .. ink .. wrote:
>     Hm. That function is confusing.
> 
>     There are two UUIDs in fact
>      - on disk (applies only to LUKS)
>      - for activated device (aka DM-UUID)
> 
>     DM-UUID is constructed from format type, on-disk UUID (if present) and
>     activated device name (so you are able to activate e.g. snapshot of LUKS
>     even with the same on-disk UUID).
> 
>     crypt_get_uuid() was formerly designed to return DM-UUID but apparently I
>     mixed up something here (PLAIN prefix should not be visible).
> 
> 
> so crypt_get_uuid() was supposed to return something like one of the below entries?

In some old testing API yes, but not now :)

> 
> [ink@mtz ~]$ ls /dev/disk/by-id/dm-uuid
> dm-uuid-CRYPT-LUKS1-f57ccd0520f943b9973aed73c6b67f07-zuluCrypt-500-NAAN-sdc6-781
> dm-uuid-CRYPT-PLAIN-rrr
> dm-uuid-CRYPT-PLAIN-zuluCrypt-500-NAAN-image-01.img-2216
> dm-uuid-CRYPT-TCRYPT-zuluCrypt-500-NAAN-truecrypt-2273

These are is udev links created from DM_UUID (it is adding dm-uuid prefix)
(and created by generic DM udev rules, you will similar links for LVM, multipath etc).

Anyway, I'll switch crypt_get_uuid() to return only on-disk UUID
IOW it will work for LUKS  and VERITY where UUID is persistent.
(I did not found users which rely on this old and confusing behaviour for PLAIN/loopAES devices.)

The rest (DM_UUID handling) is internal for libcryptsetup and will remain hidden.

But just for reference (you should not rely on this, internal for libcryptsetup),
DM-UUID is generated like this

 CRYPT-TCRYPT-zuluCrypt-500-NAAN-truecrypt-2273
   |      |   ---------------------------------
   |      |          activated device name
   |       - CRYPT device context type (LUKS1/PLAIN/ etc)
    - device managed by cryptsetup (similar to LVM,DMRAID,MPATH prefixes)

For device with on-disk UUID:
 CRYPT-LUKS1-f57ccd0520f943b9973aed73c6b67f07-zuluCrypt-500-NAAN-sdc6-781
   |      |        on-disk UUID                  activated device name
   |       - CRYPT device context type (LUKS1/PLAIN/etc)
    - device managed by cryptsetup

Milan

      reply	other threads:[~2013-01-21 14:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18 18:29 [dm-crypt] crypt_get_uuid does not work as expected with plain volumes .. ink ..
2013-01-21 11:42 ` Milan Broz
2013-01-21 13:40   ` .. ink ..
2013-01-21 14:19     ` Milan Broz [this message]

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=50FD4E5B.7000606@gmail.com \
    --to=gmazyland@gmail.com \
    --cc=dm-crypt@saout.de \
    --cc=mhogomchungu@gmail.com \
    /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.