[collectd] [PATCH] Persistent names for linux's device mapper disks.

Simone Gotti simone.gotti at gmail.com
Fri Feb 4 17:41:29 CET 2011


Hi all,

as on linux all in kernel names for devices (scsi devices: sd, device
mapper devices: dm-X) are not persistent but will change during
operations on devices (remove/add disks, activate/deactivate logical
volumes, multipathed devices and so on), reboot etc... you'll get inside
the same rrdfile values from different scsi/devicemapper devices and
will be very difficult to understand the relation between the kernel
name and the real device.

For scsi devices (sdX) it's difficult to get a persistent name. If it's
a partition with a filesystem then you can use the filesystem label/uuid
(you can get it from /dev/disk/by-*/). If it's a path of a multipath
device than this will be not possibile. The rules can be a lot and the
way to get a persistent name will be different between linux
distributions and releases (changes to udev rules or other)

One thing that can be done and will be quite useful are persistent and
meaningful names for device mapper devices. The kernel names them as
dm-X where X is dynamic. But the device mapper table has a name that is
usually persistent (lvm has its convention, dm multipathed devices can
be named in the configuration file).

The attached patch (based on the master branch) uses libdevmapper to
retrieve the name of a dm-X device and uses this name as the
plugin_instance value.
Perhabs, to avoid this different behavior after a possibile patch
inclusion (and the presence of the libdevmapper development files on the
build system) that will led to new files created with the new name, a
config option to the disk plugin should be added to activate it. I'll
add it if you like this patch.

What do you think about it?


P.S
A more generic solution will be to call from the disk plugin an external
script (call it a "PersistentNameProvider") that given the kernel name
will provide the persistent name to use. But I think that this will
create a great overhead with system with a lot of disks...


Thanks.

Bye!

--
Simone Gotti
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: disk_plugin_devmapper_persistent_names-20110204-1735.patch
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20110204/017ab82d/attachment.txt>


More information about the collectd mailing list