Fwd: First try at improving hal's device mapper support

Alasdair G Kergon agk at redhat.com
Fri Jan 7 05:59:21 PST 2005


On Fri, Jan 07, 2005 at 12:32:45AM -0500, David Zeuthen wrote:
> OK, this is useful to know; so it should be possibly to get the name
> or UUID given just the device file? E.g. the use case I'm thinking
> about is that hald only gets /dev/dm-0 from udev and we're interested
> in the name. 
 
> For example, on my Fedora Core 3 system I can see that udev creates 
> /dev/dm-0 and the initscripts create /dev/mapper/VolGroup00-LogVol00.
> They're the same thing because the got the same major:minor number.
> So, in other words, can I just do an ioctl on /dev/dm-0 and get
> the name VolGroup00-LogVol00?
 
The way to do this currently is to take the major + minor number of
/dev/dm-0 - let's say it's (253,4) - and run:
  dmsetup info -j 253 -m 4

[or in a program, make the same libdevmapper calls that dmsetup uses]

All device-mapper ioctls are done on /dev/mapper/control - but we've
talked about extending this to let people perform them directly on 
the mapped devices, but this is mostly to make it easier to
allow operations by non-root users one day.

> > LVM2 uses different uuids for different logical volumes, so if you spot
> > the same uuid on two different occasions you know it's the same data,
> > even though the device number might be different e.g. after lvchange -an;
> > lvchange -ay.

> Does this cause a hotplug event? 
lvchange -a should do.

> E.g., say that I have 
>  /dev/mapper/VolGroup00-LogVol00
> and adds a new physical volume. 

Neither adding a PV nor extending an LV would delete/recreate the mapped device.

Alasdair
-- 
agk at redhat.com
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list