# MPATHPERSIST(8) - man - phpMan

[MPATHPERSIST(8)](https://www.chedong.com/phpMan.php/man/MPATHPERSIST/8/markdown)                        System Manager's Manual                       [MPATHPERSIST(8)](https://www.chedong.com/phpMan.php/man/MPATHPERSIST/8/markdown)



## NAME
       mpathpersist - Manages SCSI persistent reservations on dm multipath devices.

## SYNOPSIS
       **mpathpersist** [**OPTIONS**] _device_

## DESCRIPTION
       This  utility  is  used to manage SCSI persistent reservations on Device Mapper Multipath de‐
       vices. To be able to use this functionality, the _reservation_key_ attribute must be defined in
       the  _/etc/multipath.conf_  file. Otherwise the **multipathd** daemon will not check for persistent
       reservation for newly discovered paths or reinstated paths.

       **mpathpersist** supports the same command-line options as the **sg**___**persist** utility.   Consult  the
       **sg**___**persist** **(8)** manual page for an in-depth discussion of the various options.

## OPTIONS
### -verbose|-v
              Verbosity:

              _0_    Critical messages.

              _1_    Error messages.

              _2_    Warning messages.

              _3_    Informational messages.

              _4_    Informational messages with trace enabled.

       **--device=**_DEVICE_**|-d** _DEVICE_
              Query or change DEVICE.

       **--batch-file=**_DEVICE_**|-f** _FILE_
              Read  commands from _FILE_. See section "BATCH FILES" below. This option can be given at
              most once.

### --help|-h
              Output this usage message.

### --hex|-H
              Output response in hex.

### --in|-i
              Request PR In command.

### --out|-o
              Request PR Out command.

### --param-alltgpt|-Y
              PR Out parameter 'ALL_TG_PT'.

### --param-aptpl|-Z
              PR Out parameter 'APTPL'.

### --read-keys|-k
              PR In: Read Keys.

       **--param-rk=**_RK_**|-K** _RK_
              PR Out parameter reservation key (RK is in hex, up to 8 bytes).

       **--param-sark=**_SARK_**|-S** _SARK_
              PR Out parameter service action reservation key (SARK is in hex).

### --preempt|-P
              PR Out: Preempt.

### --clear|-C
              PR Out: Clear registrations.

### --preempt-abort|-A
              PR Out: Preempt and Abort.

       **--prout-type=**_TYPE_**|-T** _TYPE_
              PR Out command type.

### --read-full-status|-s
              PR In: Read Full Status.

### --read-keys|-k
              PR In: Read Keys.

### --read-reservation|-r
              PR In: Read Reservation.

### --register|-G
              PR Out: Register.

### --register-ignore|-I
              PR Out: Register and Ignore.

### --release|-L
              PR Out: Release.

### --report-capabilities|-c
              PR In: Report Capabilities.

### --reserve|-R
              PR Out: Reserve.

       **--transport-id=**_TIDS_**|-X** _TIDS_
              TransportIDs can be mentioned in several forms.

       **--alloc-length=**_LEN_**|-l** _LEN_
              PR In: maximum allocation length. LEN is a decimal number between 0 and 8192.

## EXAMPLE
       Register the key "123abc" for the /dev/mapper/mpath9 device:
              **mpathpersist** **--out** **--register** **--param-sark=**_123abc_ _/dev/mapper/mpath9_

       Read registered reservation keys for the /dev/mapper/mpath9 device:
              **mpathpersist** **-i** **-k** _/dev/mapper/mpath9_

       Create a reservation for the /dev/mapper/mpath9 device with the given reservation key:
              **mpathpersist** **--out** **--reserve** **--param-rk=**_123abc_ **--prout-type=**_8_ **-d** _/dev/mapper/mpath9_

       Read the reservation status of the /dev/mapper/mpath9 device:
              **mpathpersist** **-i** **-s** **-d** _/dev/mapper/mpath9_

       Release the previously created reservation (note that the prout-type needs to be the same  as
       above):
              **mpathpersist** **--out** **--release** **--param-rk=**_123abc_ **--prout-type=**_8_ **-d** _/dev/mapper/mpath9_

       Remove the current key registered for this host (i.e. reset it to 0):
              **mpathpersist** **--out** **--register-ignore** **-K** _123abc_ **-S** _0_ _/dev/mapper/mpath9_

       Remove current reservation, and unregister all registered keys from all I_T nexuses:
              **mpathpersist** **-oCK** _123abc_ _/dev/mapper/mpath9_

## BATCH FILES
       The  option  _--batch-file_  (_-f_)  sets an input file to be processed by **mpathpersist**. Grouping
       commands in batch files can provide a speed improvement in particular on large  installments,
       because **mpathpersist** needs to scan existing paths and maps only once during startup.

       The  input  file is a text file that is parsed line by line. Every line of the file is inter‐
       preted as a command line (i.e. list of options and parameters) for **mpathpersist**. Options  and
       parameters are separated by one or more whitespace characters (space or TAB).  Lines can, but
       do not have to, begin with the word "mpathpersist".  The "#" character, either at the  begin‐
       ning  of the line or following some whitespace, denotes the start of a comment that lasts un‐
       til the end of the line. Empty lines are allowed. Continuation of mpathpersist commands  over
       multiple lines is not supported.

       All options listed in this man page, except _-f_ and _-v_, are allowed in batch files. Both short
       and long option formats may be used.  Using the _-f_ option inside the batch file is an  error.
       The _-v_ option is ignored in batch files.

       The  multipath  map  on which to act must be specified on every input line, e.g. using the _-d_
       option.  Commands acting on different multipath maps may be combined in  a  batch  file,  and
       multiple  commands  may  act  on the same multipath map. Commands are executed one by one, so
       that commands further down in the file see status changes caused by  previous  commands.   If
       **mpathpersist**  encounters  an error while processing a line in the batch file, batch file pro‐
       cessing is **not** aborted; subsequent commands are executed  nonetheless.  The  exit  status  of
       **mpathpersist** is the status of the first failed command, or 0 if all commands succeeded.

       If  other options and parameters are used along with _-f_ on the **mpathpersist** command line, the
       command line will be executed first, followed by the commands from the batch file.

       Below is an example of a valid batch input file.

              # This is an mpathpersist input file.
              # Short and long forms of the same command
              -i -k /dev/dm-1 # short form, this comment is ignored
              mpathpersist --in --read-keys --device=/dev/dm-1

              # Mixing of long and short options, variable white space
                --out  --register    -S  abcde     /dev/dm-1

              # Mixing of commands for different maps
              -ir /dev/dm-0
              -ir /dev/dm-1

              mpathpersist --out --param-rk abcde --reserve --prout-type 5 /dev/dm-1
              # This should now show a reservation
              -ir /dev/dm-1
              -oCK abcde /dev/dm-1
              --in --read-reservation /dev/dm-1

## SEE ALSO
       [**multipath**(8)](https://www.chedong.com/phpMan.php/man/multipath/8/markdown), [**multipathd**(8)](https://www.chedong.com/phpMan.php/man/multipathd/8/markdown), **sg**___**[persist**(8)](https://www.chedong.com/phpMan.php/man/persist/8/markdown).

## AUTHORS
       _multipath-tools_ was developed by Christophe Varoqui <<christophe.varoqui@opensvc.com>> and oth‐
       ers.



Linux                                        2019-05-27                              [MPATHPERSIST(8)](https://www.chedong.com/phpMan.php/man/MPATHPERSIST/8/markdown)
