Role of Multipathd Daemon in Linux SAN Storage
In modern enterprise Linux environments, maintaining continuous
access to storage area network (SAN) resources is critical for system
reliability and uptime. The multipathd daemon serves as the
user-space component of the Linux Device Mapper Multipathing
(DM-Multipath) framework, tasked with continuously monitoring, managing,
and optimizing redundant physical connections between a host and its
storage arrays. This article examines the core responsibilities of
multipathd, detailing how it executes path failure
detection, automated failover, dynamic device discovery, and load
balancing across active storage routes.
Path Monitoring and Failure Detection
The primary function of multipathd is actively
supervising the health of all configured physical paths to a storage
LUN. Because a single logical drive can be accessed via multiple host
bus adapters (HBAs), SAN switches, and storage controllers, hardware
failures can happen at various points in the fabric.
The daemon uses path checkers—such as tur (Test Unit
Ready), directio, or readsector0—to
periodically poll each physical path. If a path fails to respond within
a specified timeout, multipathd detects the failure
immediately, alters the path state in the routing map, and instructs the
kernel to bypass the degraded route for all subsequent input/output
(I/O) operations.
Automated Failover and Failback
When a path failure occurs, multipathd manages the
failover process to prevent application downtime or data corruption:
- Failover: Once a path is flagged as dead,
multipathdupdates the Device Mapper multipath map in the kernel. The kernel reroutes active I/O queues to secondary or alternate surviving paths without exposing an I/O error to the operating system's file system or applications. - Failback: The daemon continues to poll failed paths
in the background. When the underlying hardware or connection is
repaired,
multipathddetects the recovery, re-evaluates path priority, and seamlessly integrates the path back into the active path group.
Dynamic Topology and Configuration Updates
In dynamic enterprise environments, storage configurations change
frequently. The multipathd daemon monitors system events
(such as udev events) to react dynamically to changes
without requiring server reboots:
- Device Discovery: When new LUNs are masked and
mapped to the host,
multipathdaggregates the underlying/dev/sd*block devices into unified/dev/mapper/mpath*virtual devices. - Device Removal: When storage administrators unmap a LUN, the daemon flushes remaining buffers, closes the multipath target, and cleans up the associated device-mapper mappings.
- Runtime Reconfiguration: Changes made to the
/etc/multipath.conffile can be applied dynamically via the multipath interactive shell (multipathd -k) or by reloading the service, allowing administrators to adjust timeouts, polling intervals, and path groupings on live systems.
Load Balancing and Performance Optimization
Beyond handling faults, multipathd helps optimize SAN
bandwidth utilization. Working with the kernel's DM-Multipath drivers,
the daemon configures how I/O is distributed across functional paths
based on predefined routing algorithms:
- Round-Robin: I/O requests are distributed sequentially across all active paths in a priority group.
- Queue-Length: New I/O operations are directed to the path with the fewest outstanding requests.
- Service-Time: I/O is routed based on path throughput and latency, sending traffic to the path best equipped to complete the request fastest.
By actively coordinating these mechanisms, multipathd
abstracts the complexity of redundant SAN fabrics into unified,
high-performing, and fault-tolerant block devices for the Linux
operating system.