MULTIPATHD(8)

🌸 MULTIPATHD(8) β€” the multipath daemon, explained by your fave ✨

okay so this is the multipathd(8) page from the System Manager's Manual, and bestie, it's a whole thing. buckle up πŸ’…


✨ NAME ✨

multipathd β€” the Multipath daemon. yep. that's the whole name section. iconic brevity honestly πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

multipathd [-d] [-s] [-v verbosity] [-B] [-w]

multipathd [-v verbosity] -kcommand

multipathd [-v verbosity] -k

three whole moods, pick your fighter πŸ”₯


πŸ’– DESCRIPTION πŸ’–

so the multipathd daemon is the one in charge of checking for failed paths. that's its literal job, its main character energy 🌟

when a path fails, it reconfigures the multipath map that the path belongs to, so that map gets back to its maximum performance and redundancy. like a glow-up but for storage paths, no cap πŸ’«

and then with the -k option? multipathd switches lanes entirely and acts as a client utility that sends commands to a running instance of the multipathd daemon (peep COMMANDS below, iykyk πŸ‘€).


πŸŽ€ OPTIONS πŸŽ€

  • -d β€” Foreground Mode. don't daemonize, and print all messages to stdout and stderr. it's giving "i want to see everything live" πŸ™ˆ
  • -s β€” Suppress timestamps. meaning: do not prefix logging messages with a timestamp. minimalism slay ✨
  • -v level β€” Verbosity level. prints additional information while running multipathd. a level of 0 means only print errors. a level of 3 or greater prints debugging information as well. crank it up for the full tea β˜•πŸ”₯
  • -B β€” Read-only bindings file. multipathd will not write to the user_friendly_names bindings file. and if a user_friendly_name doesn't already exist for a device, it will use its WWID as its alias. respectful. hands off. 🫢
  • -kcommand β€” multipathd executes the given command (see COMMANDS below). if the command contains whitespace or shell special characters, it needs to be quoted, like in multipathd -k'show topology'. and bestie listen β€” no whitespace is allowed between the -k and the command string. that's a hard rule, periodt πŸ’…

commands can also be issued without using -k. in that case, the command string should not be quoted. but command arguments that contain whitespace or special characters still need to be quoted, like in multipathd show paths format "%n %w" πŸ¦‹

  • -k β€” multipathd executes the multipathc interactive shell for entering commands (see COMMANDS below). it's giving interactive era 🌈
  • -n β€” IGNORED. like, literally ignored. use the option find_multipaths to control the treatment of newly detected devices by multipathd. see multipath.conf(5). don't come for me, it's what the page says 😭
  • -w β€” since kernel 4.14 a new device-mapper event polling interface is used for updating multipath devices on dmevents. use this flag to force it to use the old event waiting method, based on creating a separate thread for each device. vintage behaviour, lowkey πŸ’€

🧚 COMMUNICATING WITH MULTIPATHD 🧚

okay so besides the multipathd CLI, there's also the libmpathcmd library, and you can use it to send commands (see COMMANDS below) to the multipathd daemon from other programs. multitasking queen πŸ‘‘

by default, multipathd listens on both:

  • the @/org/kernel/linux/storage/multipathd abstract namespace socket, and
  • the /run/multipathd.socket socket file

libmpathcmd will use either of these sockets to connect to multipathd. and the socket file is actually useful β€” it can be useful to communicate with multipathd from different namespaces since it can be bind mounted in them, unlike the abstract namespace socket. namespace travelling, we love to see it ✈️✨

so here's the permissions tea: multipathd will accept list|show commands from any user. all other commands must be issued by root. know your place, respectfully πŸ‘‘


and yes, it is possible to change the sockets that multipathd listens on. details:

  • if multipathd.socket is running, multipathd will use the sockets it listens on.
  • a maximum of two sockets can be defined by multipathd.socket, and by default it listens on @/org/kernel/linux/storage/multipathd and /run/multipathd.socket.
  • if multipathd.socket is not running, a single socket can be configured for listening on by setting the MULTIPATH_SOCKET_NAME environment variable when starting multipathd.
and this next bit is important, so read it twice bestie: this environment variable must also be set to make multipathd CLI commands (or any other program using libmpathcmd) connect to the multipathd daemon using a non-default socket β€” regardless of whether that socket was set for the daemon using multipathd.socket or the MULTIPATH_SOCKET_NAME environment variable. 😀

to be continued… more parts incoming, don't go anywhere πŸŒΈπŸ’œ

πŸŽ€ COMMANDS πŸŽ€

okay bestie, the following commands can be used in interactive mode β€” this is basically the group chat where you tell multipathd what to do, and every command below is exactly what you type:

  • list|show paths β€” shows the paths that multipathd is monitoring, plus their state.
  • list|show paths [raw] format $format β€” shows the paths that multipathd is monitoring, using a format string with path format wildcards. Adding raw removes the headers and alignment padding from the output. See "Path format wildcards" below.
  • list|show path $path β€” shows whether path $path is offline or running.
  • list|show maps|multipaths β€” shows the multipath devices that multipathd is monitoring.
  • list|show maps|multipaths [raw] format $format β€” shows the status of all multipath devices that multipathd is monitoring, using a format string with multipath format wildcards. Adding raw removes the headers and alignment padding from the output. See "Multipath format wildcards" below.
  • list|show maps|multipaths status β€” shows the status of all multipath devices that multipathd is monitoring.
  • list|show maps|multipaths stats β€” shows some statistics of all multipath devices that multipathd is monitoring.
  • list|show maps|multipaths topology β€” shows the current multipath topology. Same as multipath -ll.
  • list|show maps|multipaths json β€” shows information about all multipath devices in JSON format.
  • list|show topology β€” shows the current multipath topology. Same as multipath -ll.
  • list|show map|multipath $map topology β€” shows topology of a single multipath device specified by $map, for example 36005076303ffc56200000000000010aa. This map could be obtained from list maps.
  • list|show map|multipath $map [raw] format $format. β€” shows the status of multipath device $map, using a format string with multipath format wildcards. Adding raw removes the headers and alignment padding from the output. See "Multipath format wildcards" below.
  • list|show map|multipath $map json β€” shows information about multipath device $map in JSON format.
  • list|show wildcards β€” shows the format wildcards used in interactive commands taking $format. See "Format Wildcards" below.
  • list|show config β€” shows the currently used configuration, derived from default values and values specified within the configuration file /etc/multipath.conf.
  • list|show config local β€” shows the currently used configuration like show config, but limiting the devices section to those devices that are actually present in the system.
  • list|show blacklist β€” shows the currently used blacklist rules, derived from default values and values specified within the configuration file /etc/multipath.conf.
  • list|show devices β€” shows all available block devices by name, including the information if they are blacklisted or not.
  • list|show status β€” shows the number of path checkers in each possible state, the number of monitored paths, and whether multipathd is currently handling a uevent.
  • list|show daemon β€” shows the current state of the multipathd daemon.
  • reset maps|multipaths stats β€” resets the statistics of all multipath devices.
  • reset map|multipath $map stats β€” resets the statistics of multipath device $map.
  • add path $path β€” adds a path to the list of monitored paths. $path is as listed in /sys/block (e.g. sda).
  • remove|del path $path β€” stops monitoring a path. $path is as listed in /sys/block (e.g. sda).
  • add map|multipath $map β€” adds a multipath device to the list of monitored devices. $map can either be a device-mapper device as listed in /sys/block (e.g. dm-0), or it can be the alias for the multipath device (e.g. mpath1), or the uid of the multipath device (e.g. 36005076303ffc56200000000000010aa).
  • remove|del maps|multipaths β€” removes all multipath devices.
  • remove|del map|multipath $map β€” removes the multipath device $map.
  • resize map|multipath $map β€” resizes map $map to the given size.
  • switch|switchgroup map|multipath $map group $group β€” forces a multipath device to switch to a specific path group. $group is the path group index, starting with 1.
  • reconfigure β€” rereads the configuration and reloads all changed multipath devices. This also happens at startup, when the service is reload, or when a SIGHUP is received.
  • reconfigure all β€” rereads the configuration and reloads all multipath devices regardless of whether or not they have changed. This also happens when multipath -r is run.
  • suspend map|multipath $map β€” sets map $map into suspend state.
  • resume map|multipath $map β€” resumes map $map from suspend state.
  • reset map|multipath $map β€” reassign existing device-mapper table(s) use the multipath device, instead of its path devices.
  • reload map|multipath $map β€” reloads a multipath device.
  • fail path $path β€” sets path $path into failed state.
  • reinstate path $path β€” resumes path $path from failed state.
  • disablequeueing maps|multipaths β€” disables queueing on all multipath devices.
  • restorequeueing maps|multipaths β€” restores queueing to the configured no_path_retry setting on all multipath devices whose queueing has been previously disabled by the disablequeueing command. Note: If no_path_path_retry is set to queue for a limited number of retries after all paths have failed, this will not enable queueing if there are no active paths.
  • disablequeueing map|multipath $map β€” disables queuing on multipathed map $map.
  • restorequeueing map|multipath $map β€” restores queueing to the configured no_path_retry setting on multipathed map $map whose queueing has been previously disabled by the disablequeueing command. Note: If no_path_path_retry is set to queue for a limited number of retries after all paths have failed, this will not enable queueing if there are no active paths.
  • forcequeueing daemon β€” forces multipathd into queue_without_daemon mode, so that no_path_retry queueing will not be disabled when the daemon stops.
  • restorequeueing daemon β€” restores configured queue_without_daemon mode.
  • setprstatus map|multipath $map β€” enables persistent reservation management on $map.
  • setprstatus map|multipath $map pathlist $pathlist β€” enables persistent reservation management on $map, and notifies multipathd of the paths that have been registered, so it doesn't attempt to re-register them.
  • unsetprstatus map|multipath $map β€” disables persistent reservation management on $map.
  • getprstatus map|multipath $map β€” gets the current persistent reservation management status of $map.
  • getprkey map|multipath $map β€” gets the current persistent reservation key associated with $map.
  • setprkey map|multipath $map key $key β€” sets the persistent reservation key associated with $map to $key in the prkeys_file. This key will only be used by multipathd if reservation_key is set to file in /etc/multipath.conf.
  • unsetprkey map|multipath $map β€” removes the persistent reservation key associated with $map from the prkeys_file. This will only unset the key used by multipathd if reservation_key is set to file in /etc/multipath.conf.
  • setmarginal path $path β€” moves $path to a marginal pathgroup. The path will remain in the marginal path group until unsetmarginal is called. This command will only work if marginal_pathgroups is enabled and there is no Shaky paths detection method configured (see the multipath.conf man page for details).
  • unsetmarginal path $path β€” returns marginal path $path to its normal pathgroup. This command will only work if marginal_pathgroups is enabled and there is no Shaky paths detection method configured (see the multipath.conf man page for details).
  • unsetmarginal map $map β€” returns all marginal paths in $map to their normal pathgroups. This command will only work if marginal_pathgroups is enabled and there is no Shaky paths detection method configured (see the multipath.conf man page for details).
  • quit|exit β€” ends the interactive session.
  • shutdown β€” stops multipathd.

🌈 Format Wildcards 🌈

So multipathd has a bunch of commands that take a $format option, and those literally need a format string. That string is what decides how a device gets printed out, and it should have format wildcards in it. When the devices get printed, each wildcard gets swapped out for the actual device info. Here's the whole menu of wildcards, bestie πŸ’–

✨ Multipath format wildcards ✨

  • %n β€” the device name.
  • %w β€” the device WWID (uuid).
  • %d β€” the device sysfs name (dm-<minor_nr>).
  • %F β€” the device failback setting. For deferred failbacks it either includes the configured time (if a deferred failback isn't in progress) or it shows the current progress of a deferred failback in seconds.
  • %Q β€” the device no_path_retry setting. If no_path_retry is set to a number of retries, it prints the configured number of checker retries if the device isn't in recovery mode, the number of seconds until queueing is disabled if the device is queueing in recovery mode, or off if the device has disabled queueing.
  • %N β€” how many active paths the device has.
  • %r β€” the device write-protect setting, either ro or rw.
  • %t β€” the state of the device in device-mapper. suspend if the device is suspended, active otherwise.
  • %S β€” the device size, using the suffixes K, M, G, T, and P to stand for kilobytes, megabytes, gigabytes, terabytes, and petabytes, respectively.
  • %f β€” the "features" string of the device-mapper table in the kernel.
  • %x β€” the number of times the device has entered a state where it will fail IO. This is an alias for the %4 wildcard. You can reset this value with the 'reset map $map stats' command.
  • %h β€” the device table hardware handler string.
  • %A β€” the last action multipathd took on the device. This wildcard is for debugging use, since understanding what it means requires looking at the code πŸ™ˆ
  • %0 β€” the number of times a path in the device has failed. Resettable with 'reset map $map stats'.
  • %1 β€” the number of times multipathd has initiated a pathgroup switch for the device. Resettable with 'reset map $map stats'.
  • %2 β€” the number of times multipathd has loaded a new table for the device. Resettable with 'reset map $map stats'.
  • %3 β€” the approximate number of seconds multipathd has spent queueing with no usable paths. Resettable with 'reset map $map stats'.
  • %4 β€” the number of times the device has entered a state where it will fail IO. This is an alias for the %x wildcard. Resettable with 'reset map $map stats'.
  • %s β€” the vendor/product string for the device.
  • %v β€” the array vendor string for the device.
  • %p β€” the array product string for the device.
  • %e β€” the array firmware revision string for the device.
  • %G β€” the foreign library used for the device, or -- for native device-mapper multipath devices. Peep "FOREIGN MULTIPATH SUPPORT" in /etc/multipath.conf(5).
  • %g β€” data from vendor specific vpd pages for the device, if any. Currently multipathd supports VPD page 0xc0 for HPE 3PAR / Primera / Alletra storage arrays.
  • %k β€” the actual max_sectors_kb setting for the device (which may be different from the configured one).

πŸ¦‹ Path format wildcards πŸ¦‹

  • %w β€” the device WWID (uuid).
  • %i β€” the device Host:Channel:Id:Lun for SCSI devices. For NVMe devices it's the device "Controller Instance Number":"Controller ID":"Namespace Instance Number":"Namespace ID". The Controller and Namespace Instance Numbers match the NVMe device name: "nvme<Controller_Instance_Number>n<Namespace_Instance_Number>"
  • %d β€” the device sysfs name.
  • %D β€” the device major:minor
  • %t β€” the device-mapper state of the device, either active or failed.
  • %o β€” the offline state of the device. Shows "offline" if the device's "state" attribute in sysfs is "offline" (for SCSI) or "dead" (for NVMe). For all other sysfs states, it shows "running".
  • %T β€” the multipathd path checker state of the device. The possible states are:
    • ready β€” the device is ready to handle IO.
    • faulty β€” the device is unusable.
    • shaky β€” the device is not able to handle IO but can still be accessed to check the priority.
    • ghost β€” the device is in stand-by state.
    • i/o pending β€” the checker is in the process of determining the device state.
    • i/o timeout β€” the path checker has timed out, failing the device.
    • delayed β€” the device appears usable, but it is being delayed for marginal path checking.
    • undef β€” the device either is not part of a multipath device, or its path checker has not yet run.
  • %s β€” the vendor/product/revision string for the device.
  • %c β€” the name of the device's path checking algorithm
  • %C β€” the progress towards the next path checker run on the device, in seconds.
  • %p β€” the device priority.
  • %S β€” the device size, using the suffixes K, M, G, T, and P to stand for kilobytes, megabytes, gigabytes, terabytes, and petabytes, respectively.
  • %z β€” the device serial number.
  • %M β€” the device marginal state, either marginal or normal.
  • %m β€” the multipath device that this device is a path of, or [offline] if this device couldn't be added to a device because it's offline, or [orphan] if it isn't part of any multipath device.
  • %N β€” the host World Wide Node Name (WWNN) of the device, if any.
  • %n β€” the target World Wide Node Name (WWNN) of the device, if any.
  • %R β€” the host World Wide Port Name (WWPN) of the device, if any.
  • %r β€” the target World Wide Port Name (WWPN) of the device, if any.
  • %a β€” the host adapter name for the device (only SCSI devices).
  • %G β€” the foreign library used for the device, or -- for native device-mapper multipath devices. See "FOREIGN MULTIPATH SUPPORT" in /etc/multipath.conf(5).
  • %g β€” data from vendor specific vpd pages for the device, if any. Currently multipathd supports VPD page 0xc0 for HPE 3PAR / Primera / Alletra storage arrays.
  • %0 β€” the number of times this device has failed.
  • %P β€” the device protocol. See /etc/multipath.conf(5).
  • %I β€” the device initialization state. Devices that have been fully initialized are shown as ok.
  • %L β€” the device SCSI LUN ID in hexadecimal format. This is only meaningful for SCSI devices.
  • %A β€” the ALUA Target Port Group ID for the device, if applicable.
  • %k β€” the actual max_sectors_kb setting for the device (which may be different than the configured one).

🧚 SYSTEMD INTEGRATION 🧚

When it's compiled with systemd support, two systemd service files get installed: multipathd.service and multipathd.socket. If enabled, the multipathd.socket service tells systemd to intercept the CLI command socket, so any call to the CLI interface will start up the daemon if it's needed. The multipathd.service file holds the definitions for controlling the multipath daemon. The daemon itself uses the sd_notify(3) interface to talk to systemd. These are the unit keywords it recognizes:

  • WatchdogSec= β€” enables the internal watchdog from systemd. multipath will send a notification via sd_notify(3) to systemd to reset the watchdog. If specified, the polling_interval and max_polling_interval settings get overridden by the watchdog settings 🌸
Heads up bestie: systemd prior to version 207 has issues which prevent the systemd-provided watchdog from working correctly. So the watchdog is not enabled per default β€” you have to enable it manually by updating the multipathd.service file.
  • OOMScoreAdjust= β€” overrides the internal OOM adjust mechanism.
  • LimitNOFILE= β€” overrides the max_fds configuration setting.

πŸ‘‘ SEE ALSO πŸ‘‘

multipathc(8), multipath(8), kpartx(8), sd_notify(3), systemd.service(5).


πŸ’œ AUTHORS πŸ’œ

multipath-tools was developed by Christophe Varoqui <christophe.varoqui@opensvc.com> and others.


And that's the whole page, friend!! 🫢 This one's from the Linux gang, dated 2024-05-29, and it's MULTIPATHD(8) β€” go forth and slay your storage, you've got this πŸ’…βœ¨

πŸ“¦ where this page comes from
  • arch rolling: multipath-tools 0.15.1-1 Β· GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms