1.\" Copyright (c) 2007 Matthew Jacob 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.Dd September 28, 2026 26.Dt GMULTIPATH 8 27.Os 28.Sh NAME 29.Nm gmultipath 30.Nd "disk multipath control utility" 31.Sh SYNOPSIS 32.Nm 33.Cm create 34.Op Fl ARv 35.Ar name 36.Ar prov ... 37.Nm 38.Cm label 39.Op Fl ARv 40.Ar name 41.Ar prov ... 42.Nm 43.Cm configure 44.Op Fl APRv 45.Ar name 46.Nm 47.Cm add 48.Op Fl v 49.Ar name prov 50.Nm 51.Cm remove 52.Op Fl v 53.Ar name prov 54.Nm 55.Cm fail 56.Op Fl v 57.Ar name prov 58.Nm 59.Cm restore 60.Op Fl v 61.Ar name prov 62.Nm 63.Cm rotate 64.Op Fl v 65.Ar name 66.Nm 67.Cm prefer 68.Op Fl v 69.Ar name 70.Ar prov 71.Nm 72.Cm getactive 73.Op Fl v 74.Ar name 75.Nm 76.Cm destroy 77.Op Fl v 78.Ar name 79.Nm 80.Cm stop 81.Op Fl v 82.Ar name 83.Nm 84.Cm clear 85.Op Fl v 86.Ar prov ... 87.Nm 88.Op Fl -libxo 89.Cm list 90.Nm 91.Op Fl -libxo 92.Cm status 93.Nm 94.Cm load 95.Nm 96.Cm unload 97.Sh DESCRIPTION 98The 99.Nm 100utility is used for device multipath configuration. 101.Pp 102The multipath device can be configured using two different methods: 103.Dq manual 104or 105.Dq automatic . 106When using the 107.Dq manual 108method, no metadata are stored on the devices, so the multipath 109device has to be configured by hand every time it is needed. 110Additional device paths also will not be detected automatically. 111The 112.Dq automatic 113method uses on-disk metadata to detect device and all its paths. 114Metadata use the last sector of the underlying disk device and 115include device name and UUID. 116The UUID guarantees uniqueness in a shared storage environment 117but is in general too cumbersome to use. 118The name is what is exported via the device interface. 119.Pp 120The first argument to 121.Nm 122indicates an action to be performed: 123.Bl -tag -width ".Cm destroy" 124.It Cm create 125Create multipath device with 126.Dq manual 127method without writing any on-disk metadata. 128It is up to administrator, how to properly identify device paths. 129Kernel will only check that all given providers have same media and 130sector sizes. 131.Pp 132.Fl A 133option enables Active/Active mode, 134.Fl R 135option enables Active/Read mode, otherwise Active/Passive mode is used 136by default. 137.It Cm label 138Create multipath device with 139.Dq automatic 140method. 141Label the first given provider with on-disk metadata using the specified 142.Ar name . 143The rest of given providers will be retasted to detect these metadata. 144It reliably protects against specifying unrelated providers. 145Providers with no matching metadata detected will not be added to the device. 146.Pp 147.Fl A 148option enables Active/Active mode, 149.Fl R 150option enables Active/Read mode, otherwise Active/Passive mode is used 151by default. 152.It Cm configure 153Configure the given multipath device. 154.Pp 155.Fl A 156option enables Active/Active mode, 157.Fl P 158option enables Active/Passive mode, 159.Fl R 160option enables Active/Read mode. 161.It Cm add 162Add the given provider as a path to the given multipath device. 163Should normally be used only for devices created with 164.Dq manual 165method, unless you know what you are doing (you are sure that it is another 166device path, but tasting its metadata in regular 167.Dq automatic 168way is not possible). 169.It Cm remove 170Remove the given provider as a path from the given multipath device. 171If the last path removed, the multipath device will be destroyed. 172.It Cm fail 173Mark specified provider as a path of the specified multipath device as failed. 174If there are other paths present, new requests will be forwarded there. 175.It Cm restore 176Mark specified provider as a path of the specified multipath device as 177operational, allowing it to handle requests. 178.It Cm rotate 179Change the active provider/path to the next available provider in Active/Passive mode. 180.It Cm prefer 181Change the active provider/path to the specified provider in Active/Passive mode. 182.It Cm getactive 183Get the currently active provider(s)/path(s). 184.It Cm destroy 185Destroy the given multipath device clearing metadata. 186.It Cm stop 187Stop the given multipath device without clearing metadata. 188.It Cm clear 189Clear metadata on the given provider. 190.It Cm list 191See 192.Xr geom 8 . 193.It Cm status 194See 195.Xr geom 8 . 196.It Cm load 197See 198.Xr geom 8 . 199.It Cm unload 200See 201.Xr geom 8 . 202.It Fl -libxo 203Generate output via 204.Xr libxo 3 205in a selection of different human and machine readable formats. 206See 207.Xr xo_options 7 208for details on command line arguments. 209.El 210.Sh SYSCTL VARIABLES 211The following 212.Xr sysctl 8 213variable can be used to control the behavior of the 214.Nm MULTIPATH 215GEOM class. 216.Bl -tag -width indent 217.It Va kern.geom.multipath.debug : No 0 218Debug level of the 219.Nm MULTIPATH 220GEOM class. 221This can be set to 0 (default) or 1 to disable or enable various 222forms of chattiness. 223.It Va kern.geom.multipath.exclusive : No 1 224Open underlying providers exclusively, preventing individual paths access. 225.El 226.Sh EXIT STATUS 227Exit status is 0 on success, and 1 if the command fails. 228.Sh MULTIPATH ARCHITECTURE 229This is a multiple path architecture with no device knowledge or 230presumptions other than size matching built in. 231Therefore the user must exercise some care 232in selecting providers that do indeed represent multiple paths to the 233same underlying disk device. 234The reason for this is that there are several 235criteria across multiple underlying transport types that can 236.Ar indicate 237identity, but in all respects such identity can rarely be considered 238.Ar definitive . 239.Pp 240For example, if you use the World Wide Port Name of a Fibre Channel 241disk object you might believe that two disks that have the same WWPN 242on different paths (or even disjoint fabrics) might be considered 243the same disk. 244Nearly always this would be a safe assumption, until 245you realize that a WWPN, like an Ethernet MAC address, is a soft 246programmable entity, and that a misconfigured Director Class switch 247could lead you to believe incorrectly that you have found multiple 248paths to the same device. 249This is an extreme and theoretical case, but 250it is possible enough to indicate that the policy for deciding which 251of multiple pathnames refer to the same device should be left to the 252system operator who will use tools and knowledge of their own storage 253subsystem to make the correct configuration selection. 254.Pp 255There are Active/Passive, Active/Read and Active/Active operation modes 256supported. 257In Active/Passive mode only one path has I/O moving on it 258at any point in time. 259This I/O continues until an I/O is returned with 260a generic I/O error or a "Nonexistent Device" error. 261When this occurs, that path is marked FAIL, the next path 262in a list is selected as active and the failed I/O reissued. 263In Active/Active mode all paths not marked FAIL may handle I/O at the same time. 264Requests are distributed between paths to equalize load. 265For capable devices it allows the utilisation of the bandwidth available on all paths. 266In Active/Read mode all paths not marked FAIL may handle reads at the same time, 267but unlike in Active/Active mode only one path handles write requests at any 268point in time; closely following the original write request order if the layer 269above needs it for data consistency (not waiting for requisite write completion 270before sending dependent write). 271.Pp 272When new devices are added to the system the 273.Nm MULTIPATH 274GEOM class is given an opportunity to taste these new devices. 275If a new 276device has a 277.Nm MULTIPATH 278on-disk metadata label, the device is either used to create a new 279.Nm MULTIPATH 280GEOM, or added to the list of paths for an existing 281.Nm MULTIPATH 282GEOM. 283.Pp 284It is this mechanism that works reasonably with 285.Xr isp 4 286and 287.Xr mpt 4 288based Fibre Channel disk devices. 289For these devices, when a device disappears 290(due to e.g., a cable pull or power failure to a switch), the device is 291proactively marked as gone and I/O to it failed. 292This causes the 293.Nm MULTIPATH 294failure event just described. 295.Pp 296When Fibre Channel events inform either 297.Xr isp 4 298or 299.Xr mpt 4 300host bus adapters that new devices may have arrived (e.g., the arrival 301of an RSCN event from the Fabric Domain Controller), they can cause 302a rescan to occur and cause the attachment and configuration of any 303(now) new devices to occur, causing the taste event described above. 304.Pp 305This means that this multipath architecture is not a one-shot path 306failover, but can be considered to be steady state as long as failed 307paths are repaired (automatically or otherwise). 308.Pp 309Automatic rescanning is not a requirement. 310Nor is Fibre Channel. 311The 312same failover mechanisms work equally well for traditional "Parallel" 313SCSI but may require manual intervention with 314.Xr camcontrol 8 315to cause the reattachment of repaired device links. 316.Sh EXAMPLES 317The following example shows how to use 318.Xr camcontrol 8 319to find possible multiple path devices and to create a 320.Nm MULTIPATH 321GEOM class for them. 322.Bd -literal -offset indent 323mysys# camcontrol devlist 324<ECNCTX @WESTVILLE > at scbus0 target 0 lun 0 (da0,pass0) 325<ECNCTX @WESTVILLE > at scbus0 target 0 lun 1 (da1,pass1) 326<ECNCTX @WESTVILLE > at scbus1 target 0 lun 0 (da2,pass2) 327<ECNCTX @WESTVILLE > at scbus1 target 0 lun 1 (da3,pass3) 328mysys# camcontrol inquiry da0 -S 329ECNTX0LUN000000SER10ac0d01 330mysys# camcontrol inquiry da2 -S 331ECNTX0LUN000000SER10ac0d01 332.Ed 333.Pp 334Now that you have used the Serial Number to compare two disk paths 335it is not entirely unreasonable to conclude that these are multiple 336paths to the same device. 337However, only the user who is familiar 338with their storage is qualified to make this judgement. 339.Pp 340You can then use the 341.Nm 342command to label and create a 343.Nm MULTIPATH 344GEOM provider named 345.Ar FRED . 346.Bd -literal -offset indent 347gmultipath label -v FRED /dev/da0 /dev/da2 348disklabel -Bw /dev/multipath/FRED auto 349newfs /dev/multipath/FREDa 350mount /dev/multipath/FREDa /mnt.... 351.Ed 352.Pp 353The resultant console output looks something like: 354.Bd -literal -offset indent 355GEOM_MULTIPATH: da0 added to FRED 356GEOM_MULTIPATH: da0 is now active path in FRED 357GEOM_MULTIPATH: da2 added to FRED 358.Ed 359.Pp 360To load the 361.Nm 362module at boot time, add this entry to 363.Pa /boot/loader.conf : 364.Bd -literal -offset ident 365geom_multipath_load="YES" 366.Ed 367.Sh SEE ALSO 368.Xr geom 4 , 369.Xr isp 4 , 370.Xr mpt 4 , 371.Xr loader.conf 5 , 372.Xr xo_options 7 , 373.Xr camcontrol 8 , 374.Xr geom 8 , 375.Xr mount 8 , 376.Xr newfs 8 , 377.Xr sysctl 8 378.Sh HISTORY 379The 380.Nm 381utility first appeared in 382.Fx 7.0 383.Sh AUTHORS 384.An Matthew Jacob Aq Mt mjacob@FreeBSD.org 385.An Alexander Motin Aq Mt mav@FreeBSD.org 386