Language and Page Formatting Options
A.3. Device Mapper Support for the udev Device Manager
The primary role of the
udevdevice manager is to provide a dynamic way of setting up nodes in the
/devdirectory. The creation of these nodes is directed by the application of
udevrules in user space. These rules are processed on
udevevents sent from the kernel directly as a result of adding, removing or changing particular devices. This provides a convenient and central mechanism for hotplugging support.
Besides creating the actual nodes, the
udevdevice manager is able to create symbolic links which the user can name. This provides users the freedom to choose their own customized naming and directory structure in the
/devdirectory, if needed.
udevevent contains basic information about the device being processed, such as its name, the subsystem it belongs to, the device's type, its major and minor number used, and the type of the event. Given that, and having the possibility of accessing all the information found in the
/sysdirectory that is also accessible within
udevrules, the users are able to utilize simple filters based on this information and run the rules conditionally based on this information.
udevdevice manager also provides a centralized way of setting up the nodes' permissions. A user can easily add a customized set of rules to define the permissions for any device specified by any bit of information that is available while processing the event.
It is also possible to add program hooks in
udevrules directly. The
udevdevice manager can call these programs to provide further processing that is needed to handle the event. Also, the program can export environment variables as a result of this processing. Any results given can be used further in the rules as a supplementary source of information.
Any software using the
udevlibrary is able to receive and process
udevevents with all the information that is available, so the processing is not bound to the
A.3.1. udev Integration with the Device Mapper
In Red Hat Enterprise Linux 6, the Device Mapper provides direct support for
udevintegration. This synchronizes the Device Mapper with all
udevprocessing related to Device Mapper devices, including LVM devices. The synchronization is needed since the rule application in the
udevdaemon is a form of parallel processing with the program that is the source of the device's changes (such as
dmsetupand LVM). Without this support, it was a common problem for a user to try to remove a device that was still open and processed by
udevrules as a result of a previous change event; this was particularly common when there was a very short time between changes for that device.
The Red Hat Enterprise Linux 6 release provides officially supported
udevrules for Device Mapper devices in general and for LVM as well. Table A.1, “udev Rules for Device-Mapper Devices” summarizes these rules, which are installed in
Table A.1. udev Rules for Device-Mapper Devices
| Contains rules to be applied for all Device Mapper devices in general and creates symlinks in the |
| Contains the rule to notify the waiting process using |
| Contains a hook to trigger an LVM scan on any newly appeared block device in the system and do any LVM autoactivation if possible. This supports the |
You can add additional customized permission rules by means of the
12-dm-permissions.rulesfile. This file is not installed in the
/lib/udev/rulesdirectory; it is found in the
12-dm-permissions.rulesfile is a template containing hints for how to set the permissions, based on some matching rules given as an example; the file contains examples for some common situations. You can edit this file and place it manually in the
/etc/udev/rules.ddirectory where it will survive updates, so the settings will remain.
These rules set all basic variables that could be used by any other rules while processing the events.
The following variables are set in 10-dm.rules:
DM_NAME: Device Mapper device name
DM_UUID: Device Mapper device UUID
DM_SUSPENDED: the suspended state of Device Mapper device
udevrules version (this is primarily for all other rules to check that previously mentioned variables are set directly by official Device Mapper rules)
The following variables are set in
DM_LV_NAME: logical volume name
DM_VG_NAME: volume group name
DM_LV_LAYER: LVM layer name
All these variables can be used in the
12-dm-permissions.rulesfile to define a permission for specific Device Mapper devices, as documented in the