Linux Device Mapper development
 help / color / mirror / Atom feed
* Differentiating between dm devices
@ 2011-03-23 17:30 Phillip Susi
  2011-03-24  7:23 ` Hannes Reinecke
  0 siblings, 1 reply; 4+ messages in thread
From: Phillip Susi @ 2011-03-23 17:30 UTC (permalink / raw)
  To: device-mapper development

There are different classes of dm devices that different utilities may
or may not care about.  Some are intended to represent whole disks (
dmraid ) that can be partitioned.  Some ARE partitions and should
contain filesystems.  Still others are used only internally by the tools
( -real, -cow for lvm, and raid10 subvolumes for dmraid ).  I can not
find any good way to differentiate between these types.

One way of fixing this is to add a new attribute to the device where the
tools creating them can specify a hint about what they are and how they
should be used.  Another way is to embed that information in the UUID.
For instance, logical volumes have UUIDs that start with "LVM-" and
dmraid disks start with "DMRAID-".  Perhaps dmraid partitions could have
their uuids changed to "DMRAIDP-" and internal devices changed to
"DMRAIDI-" and "LVMI-" for dmraid and lvm respectively.

Which of these ways sounds best, or is there a better one I have not
thought of?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Differentiating between dm devices
  2011-03-23 17:30 Differentiating between dm devices Phillip Susi
@ 2011-03-24  7:23 ` Hannes Reinecke
  2011-03-24  8:32   ` Milan Broz
  0 siblings, 1 reply; 4+ messages in thread
From: Hannes Reinecke @ 2011-03-24  7:23 UTC (permalink / raw)
  To: device-mapper development; +Cc: Phillip Susi

On 03/23/2011 06:30 PM, Phillip Susi wrote:
> There are different classes of dm devices that different utilities may
> or may not care about.  Some are intended to represent whole disks (
> dmraid ) that can be partitioned.  Some ARE partitions and should
> contain filesystems.  Still others are used only internally by the tools
> ( -real, -cow for lvm, and raid10 subvolumes for dmraid ).  I can not
> find any good way to differentiate between these types.
> 
And indeed you are right, there is none.

> One way of fixing this is to add a new attribute to the device where the
> tools creating them can specify a hint about what they are and how they
> should be used.  Another way is to embed that information in the UUID.
> For instance, logical volumes have UUIDs that start with "LVM-" and
> dmraid disks start with "DMRAID-".  Perhaps dmraid partitions could have
> their uuids changed to "DMRAIDP-" and internal devices changed to
> "DMRAIDI-" and "LVMI-" for dmraid and lvm respectively.
> 
That is the approach I've been following for SUSE.
The UUID is assumed to be of this syntax:

<type>-<identifier>

where <type> is defined by the program creating the mapping.
EG 'mpath' for multipath, 'partX' (where 'X' is the partition
number) for kpartx etc.

Not that these prefixes are registered in any way; would be nice
to have them registered / documented somewhere.
Cool would be to have them build into the module :-)

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Differentiating between dm devices
  2011-03-24  7:23 ` Hannes Reinecke
@ 2011-03-24  8:32   ` Milan Broz
  2011-03-25 18:34     ` Phillip Susi
  0 siblings, 1 reply; 4+ messages in thread
From: Milan Broz @ 2011-03-24  8:32 UTC (permalink / raw)
  To: device-mapper development; +Cc: Phillip Susi

On 03/24/2011 08:23 AM, Hannes Reinecke wrote:

> That is the approach I've been following for SUSE.
> The UUID is assumed to be of this syntax:
> 
> <type>-<identifier>

There were several discussions, I think even unofficial definition
tries but nobody documented that properly.

So thanks for opening this here, it should be formalized (Alasdair?).

What I remember from discussions:

- all devices should set DM-UUID (not required still though)
(btw available now in sysfs /sys/block/dm-X/dm/uuid in udev db,
no need to use dm-ioctl)

- everything is supposed to set a prefix to identify subsystem (owner)

- DM-UUID can contain multiple namespaces

- first part (prefix) says which the second part belongs to

(e.g. CRYPT-PLAIN-blabla - CRYPT is says it was cryptsetup namespace,
it is up subsystem to handle content, here we can parse crypt device
type from it it for example.)

- you can stack it (like partition/kpartx over other subsystem)
(problem of prefix separator, now we will get
probably something like part1-CRYPT-LUKS-00000000...)

- kpartx uses prefix in format (part%N- where
N is part number - my opinion it is bug but that up to discussion.
My suggestion is to use KPARTX-part%N*)

- some uses lowercase here

- there is limit of 128 characters for DM-UUID
(so stacking should handle this somehow)

To my knowledge, these prefixes are in the wild:

LVM- (lvm2)
DMRAID- (dmraid)
CRYPT- (cryptsetup)
mpath- (multipath)
part%N- (kpartx)

Milan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Differentiating between dm devices
  2011-03-24  8:32   ` Milan Broz
@ 2011-03-25 18:34     ` Phillip Susi
  0 siblings, 0 replies; 4+ messages in thread
From: Phillip Susi @ 2011-03-25 18:34 UTC (permalink / raw)
  To: device-mapper development; +Cc: Milan Broz

On 3/24/2011 4:32 AM, Milan Broz wrote:
> - kpartx uses prefix in format (part%N- where
> N is part number - my opinion it is bug but that up to discussion.
> My suggestion is to use KPARTX-part%N*)

So if kpartx creates the partition device instead of dmraid, the
partition will have a UUID of "part1-DMRAID-xyz"?  If that is the case,
then dmraid and lvm should be patched to use the same scheme don't you
think?  And then tools like parted can tell which devices are partitions
and which are not.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-25 18:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-23 17:30 Differentiating between dm devices Phillip Susi
2011-03-24  7:23 ` Hannes Reinecke
2011-03-24  8:32   ` Milan Broz
2011-03-25 18:34     ` Phillip Susi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox