Skip to contentSkip to conversation

udev and md/dm

DISCUSSION Joel Becker 6 participants 11 messages Jun 16, 2007

lore
Share & tools
lore
#0 lore raw

Why does udev ignore md* and dm-* devices for persistent naming?
I was utterly surprised to find that an ext3 on /dev/md0 or /dev/dm-0 won't show up in /dev/disk/by-uuid. Given that dm and md devices can change names, isn't this something we'd really like to have?

Joel

Signature · 18 lines
"Copy from one, it's plagiarism; copy from two, it's research."
        - Wilson Mizner

Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw
Quoted 4 lines · Joel Becker

Why does udev ignore md* and dm-* devices for persistent naming?
I was utterly surprised to find that an ext3 on /dev/md0 or /dev/dm-0 won't show up in /dev/disk/by-uuid. Given that dm and md devices can change names, isn't this something we'd really like to have?

Sure, they just have their own rules files. Both have specific requirements/lifetime-rules and plug into "change" events.

Kay

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Joel Becker
Quoted 8 lines · Kay Sievers
Quoted 4 lines · Joel Becker

Why does udev ignore md* and dm-* devices for persistent naming?
I was utterly surprised to find that an ext3 on /dev/md0 or /dev/dm-0 won't show up in /dev/disk/by-uuid. Given that dm and md devices can change names, isn't this something we'd really like to have?

Sure, they just have their own rules files. Both have specific requirements/lifetime-rules and plug into "change" events.

I'm looking at rhel5, debian, and raw udev-105, and I can't find
anywhere in the rules that use vol_id to map md or dm devices to /dev/disk/by-label and /dev/disk/by-uuid. The vol_id using files (persistent.rules) skips those devices. I can see why perhaps you'd say "loop and ramdisk may be garbage", but dm*, md*, and similar are expected persistent environment things. And their names can certainly change.
I ask because I am looking at implementing a robust "how to
determine what device is meant by UUID xxxxx". Robust in the face of catching the raid1 and multipath and so on. So /dev/disk/by-uuid/xxxxx wouldn't point to /dev/sdd1 if it really should be /dev/md0. I had hoped udev + vol_id would do this for me, as vol_id seems to have explicit ordering to make this work right. But the udev rules skip checking uuids and labels on the aggregate devices.
Please, show me where I'm wrong :-)

Joel

Signature · 19 lines
"The question of whether computers can think is just like the question
 of whether submarines can swim."
	- Edsger W. Dijkstra

Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#3 lore raw
In reply to Joel Becker
Quoted 10 lines · Joel Becker
Quoted 8 lines · Kay Sievers
Quoted 4 lines · Joel Becker

Why does udev ignore md* and dm-* devices for persistent naming?
I was utterly surprised to find that an ext3 on /dev/md0 or /dev/dm-0 won't show up in /dev/disk/by-uuid. Given that dm and md devices can change names, isn't this something we'd really like to have?

Sure, they just have their own rules files. Both have specific requirements/lifetime-rules and plug into "change" events.

Quoted 7 lines

I'm looking at rhel5, debian, and raw udev-105, and I can't find
anywhere in the rules that use vol_id to map md or dm devices to /dev/disk/by-label and /dev/disk/by-uuid. The vol_id using files (persistent.rules) skips those devices. I can see why perhaps you'd say "loop and ramdisk may be garbage", but dm*, md*, and similar are expected persistent environment things. And their names can certainly change.

at least device mapper already has entries under /dev/mapper; I has been using it for multipathing only so far, and multipath can be configured to create persistent names there. I presume other device mapper modules can be told to create persistent names too.

For mdadm you can specify persistent names based on UUID or array name as well.

I agree that having everything in one place simplifies things.

Quoted 3 lines

I ask because I am looking at implementing a robust "how to
determine what device is meant by UUID xxxxx". Robust in the face of catching the raid1 and multipath and so on.

It depends what in imply by "implementing". It is definitely possible to write such script; moreover, it is quite possible that blkid already does what you need:

{pts/0}% sudo blkid -l -t UUID="72973377-c299-4ca6-ae94-2022b7dca58f" /dev/sda2: UUID="72973377-c299-4ca6-ae94-2022b7dca58f" LABEL="/" TYPE="reiserfs"

-andrey

Quoted 9 lines

So /dev/disk/by-uuid/xxxxx
wouldn't point to /dev/sdd1 if it really should be /dev/md0. I had hoped udev + vol_id would do this for me, as vol_id seems to have explicit ordering to make this work right. But the udev rules skip checking uuids and labels on the aggregate devices.
Please, show me where I'm wrong :-)

Joel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to Joel Becker
Quoted 1 line · Joel Becker

Why does udev ignore md* and dm-* devices for persistent naming?

Please see http://lkml.org/lkml/2007/5/14/188 for device-mapper - but note that the problems are now at least partially fixed.

Signature · 12 lines
Alexander E. Patrakov


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#5 lore raw
In reply to Joel Becker
Quoted 10 lines · Joel Becker
Quoted 8 lines · Kay Sievers
Quoted 4 lines · Joel Becker

Why does udev ignore md* and dm-* devices for persistent naming?
I was utterly surprised to find that an ext3 on /dev/md0 or /dev/dm-0 won't show up in /dev/disk/by-uuid. Given that dm and md devices can change names, isn't this something we'd really like to have?

Sure, they just have their own rules files. Both have specific requirements/lifetime-rules and plug into "change" events.

Quoted 7 lines

I'm looking at rhel5, debian, and raw udev-105, and I can't find
anywhere in the rules that use vol_id to map md or dm devices to /dev/disk/by-label and /dev/disk/by-uuid. The vol_id using files (persistent.rules) skips those devices. I can see why perhaps you'd say "loop and ramdisk may be garbage", but dm*, md*, and similar are expected persistent environment things. And their names can certainly change.

dm: (requires a simple patch to dmsetup)
http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=etc/udev/suse/64-device-mapper.rules;hb=HEAD

md: (requires the latest mdadm)
http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=etc/udev/suse/64-md-raid.rules;hb=HEAD

Quoted 6 lines

I ask because I am looking at implementing a robust "how to
determine what device is meant by UUID xxxxx". Robust in the face of catching the raid1 and multipath and so on. So /dev/disk/by-uuid/xxxxx wouldn't point to /dev/sdd1 if it really should be /dev/md0. I had hoped udev + vol_id would do this for me, as vol_id seems to have explicit ordering to make this work right.

Right, vol_id recognizes md-metadata and doesn't return uuid/label for raid members.

Udev has priorities for the symlink-stack (multiple devices can claim the same name, but only one can actually own the symlink), and the multipath rules for dm-devices specify a higher priority, so that symlinks requested from the individual paths are overwritten.

Quoted 3 lines

But the udev rules skip
checking uuids and labels on the aggregate devices.
Please, show me where I'm wrong :-)

All of that is not in RHEL or Debian at the moment. :)

Kay

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#6 lore raw
In reply to Joel Becker

also sprach Kay Sievers <[email protected]> [2007.06.16.1140 +0100]:

Quoted 1 line

All of that is not in RHEL or Debian at the moment. :)

Please correct me if I'm wrong, but all this patch does is to provide /dev/disk symlinks, right?

http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=etc/udev/suse/64-md-raid.rules;hb=HEAD

mdadm and udev need better integration and I'd rather not fuzz with it before I have time to do it right. However, the above is really tangential, so I see no problem with including it in Debian.

If you can confirm then I shall try to get it in.

Signature · 7 lines
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: [email protected]
 
"i must get out of these wet clothes and into a dry martini."
                                                 -- alexander woolcott

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#7 lore raw
In reply to Joel Becker
Quoted 10 lines · martin f krafft

also sprach Kay Sievers <[email protected]> [2007.06.16.1140 +0100]:

Quoted 1 line

All of that is not in RHEL or Debian at the moment. :)

Please correct me if I'm wrong, but all this patch does is to provide /dev/disk symlinks, right?

http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=etc/udev/suse/64-md-raid.rules;hb=HEAD

mdadm and udev need better integration and I'd rather not fuzz with it before I have time to do it right.

Sure, it's the first step in this direction, we are still working on it. It didn't work at all with older kernels, that's why we skipped the events for these devices in the past.

Quoted 4 lines

However, the above is really
tangential, so I see no problem with including it in Debian.

If you can confirm then I shall try to get it in.

Right, it creates stuff in /dev/disk. It hooks into the "change" events the kernel sends when the devices become online, or tables change. So it creates the uuid/label links for the contained filesystem data, and some by-id links to identify the device itself.

Kay

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#8 lore raw
In reply to Joel Becker
Quoted 3 lines · Kay Sievers

dm: (requires a simple patch to dmsetup)
http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=etc/udev/suse/64-device-mapper.rules;hb=HEAD

Is this device-mapper-dmsetup-export.patch in the opensuse package? Any chance to get it upstream?

http://download.opensuse.org/distribution/SL-OSS-factory/inst-source/suse/src/device-mapper-1.02.19-11.src.rpm

--
Dan

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#9 lore raw
In reply to Joel Becker
Quoted 6 lines · Dan Nicholson
Quoted 3 lines · Kay Sievers

dm: (requires a simple patch to dmsetup)
http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=etc/udev/suse/64-device-mapper.rules;hb=HEAD

Is this device-mapper-dmsetup-export.patch in the opensuse package?

Yes, it is.

Quoted 3 lines

Any chance to get it upstream?

http://download.opensuse.org/distribution/SL-OSS-factory/inst-source/suse/src/device-mapper-1.02.19-11.src.rpm

Sure, I'll send it upstream after we are sure it works as expected. It's currently tested in openSUSE and Ubuntu.

Kay

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#10 lore raw
In reply to Joel Becker
Quoted 6 lines · Kay Sievers

dm: (requires a simple patch to dmsetup)
http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=etc/udev/suse/64-device-mapper.rules;hb=HEAD

md: (requires the latest mdadm)
http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=etc/udev/suse/64-md-raid.rules;hb=HEAD

Ok, so it's coming. But for now, I'll have to implement my own
thing, as existing distros (which I need to support) won't ever have this.

Thanks!
Joel

Signature · 20 lines
"All alone at the end of the evening
 When the bright lights have faded to blue.
 I was thinking about a woman who had loved me
 And I never knew"

Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel