LinuxCommandLibrary

dmevent_tool

Monitor device-mapper events

SYNOPSIS

dmevent_tool [-h|--help] [-v|--verbose] [-y|--yes] [-x|--expert] [-w|--waitfor timeout] [--version] major minor [wait_for]

PARAMETERS

-h, --help
    Display help and exit.

-v, --verbose
    Enable verbose logging.

-y, --yes
    Proceed without prompts.

-x, --expert
    Expert mode; ignore some safety checks.

-w timeout, --waitfor timeout
    Wait up to specified seconds instead of indefinitely.

--version
    Display version information.

major minor
    Major and minor numbers of the DM device (required).

wait_for
    Optional event type: snapshot, device, media, cluster, path, reconfig, or 1-4.

DESCRIPTION

dmevent_tool is a userspace utility from the LVM2 package used to monitor and wait for events generated by Linux kernel's Device Mapper (DM) subsystem. Device Mapper enables advanced storage features like Logical Volume Manager (LVM), device-mapper-thin (thin provisioning), dm-crypt encryption, and multipath I/O. Events signal important state changes, such as a thin pool running out of space, a snapshot filling up, media errors, path failures, or configuration updates.

The tool relies on the dmeventd daemon, which periodically polls registered DM devices for changes and notifies waiting clients. Without dmeventd running, dmevent_tool will fail. Specify a device's major:minor numbers (from dmsetup info -c) and optionally an event type to wait for. By default, it waits indefinitely; use -w for a timeout.

Common use cases include scripting failover in clusters, alerting on storage exhaustion, or pausing operations until a snapshot is invalid. Event types include snapshot (fills), device (general), media, cluster, path, reconfig, and custom 1-4. Verbose mode aids debugging.

CAVEATS

dmeventd daemon must be running. Events require prior registration via dmsetup message. Not all DM targets generate events.

EVENT TYPES

snapshot: Wait for snapshot to fill.
device: Any device event.
media: Media change/failure.
cluster: Cluster events.
path: Multipath path events.
reconfig: Table reconfiguration.
1-4: Custom user-defined events.

EXAMPLES

dmevent_tool 254 5 snapshot # Wait for snapshot full
dmevent_tool -w 300 254 10 full # Wait 5 min for thin pool full
dmsetup info /dev/mapper/vg-lv | cut -d: -f1 | xargs dmevent_tool -v # From device name

HISTORY

Introduced in LVM2 2.02.66 (2009) for thin provisioning and snapshot monitoring; enhanced in later versions for multipath and custom events.

SEE ALSO

dmsetup(8), dmeventd(8), lvm(8), lvdisplay(8)

Copied to clipboard