devrsrv Command

Purpose

Queries and breaks the single-path and persistent reservations on a device.

Syntax

devrsrv -c query [-e] | release | prin -s sa | (prout -s sa -r rkey -k sa_key -t prtype) -l devicename

devrsrv -f -l devicename

devrsrv -d

Description

The devrsrv command queries and breaks the single-path and persistent reservations on the device. The command runs the persistent reserve in (prin) and persistent reserve out (prout) service actions.

The query subcommand queries and displays the current reservation status of the device. The release subcommand releases the reservation on the device by using the single-path reservation.

The prin subcommand displays all the registered reservation keys, reservation key holder, and capabilities information. The prout subcommand requests service action that reserves a device for the exclusive or shared use of a particular I/O path to the device. The prout subcommand supports the following service actions:

Item Description
RELEASE Releases the specified persistent reservation for the device.
CLEAR Clears all the reservation keys and all the persistent reservations.
PREEMPT Preempts the persistent reservations or removes registrations, or both.
PREEMPT AND ABORT Preempts persistent reservations or removes registrations, or both and stops all tasks for all preempted I/O paths to the device.
REGISTER AND IGNORE KEY Registers the new key value in place of the old key value.

Flags

Item Description
-c Specifies the following subcommands:
query
Queries and displays the status of reservations on a device.
release
Releases the device with the single-path reservation by using SCSI-2.
prin
Specifies the persistent reservation in service action.
prout
Specifies the persistent reservation out service action.
-d Lists the disk name and other identifying information for all disks that are queried or manipulated by using the devrsrv command.
-e Avoids opening the disk in exclusive mode, which includes both single and diagnostic modes. This flag is applicable only for PR_exclusive and PR_shared reservation types. If Object Data Manager (ODM) reservation policy is single_path, this flag is ignored.
Note: In some cases, if you use this flag, the devrsrv command might not determine the reservation status of the disk or whether the disk is already open on the local host.
-f Breaks the reservation that is held by other I/O path or host. For single-path reservations, the devrsrv command issues a SC_FORCED_OPEN action to break the reservation. For persistent reservations, the devrsrv command issues a prout subcommand along with the CLEAR service action to clear the persistent reservation and the registrations.
-k Specifies the service action reservation key. The -k flag is required for the REGISTER, PREEMPT, and PREEMPT_ABORT service actions.
-l Specifies the name of the device.
-r Specifies the reservation key. The -r flag is required for the REGISTER, PREEMPT, PREEMPT AND ABORT, and RELEASE service actions.
-s Specifies the service action for persistent reservations. The valid service actions for the prin subcommand follow:
0
READ KEYS
1
READ RESERVATION
2
REPORT CAPABILITIES
The valid service actions for the prout subcommand follow:
2
RELEASE
3
CLEAR
4
PREEMPT
5
PREEMPT AND ABORT
6
REGISTER AND IGNORE EXISTING KEY
-t Specifies the persistent reservation type. The types of persistent reservations follow:
1
Write exclusive
2
Exclusive access
3
Write exclusive registrants only
4
Exclusive access registrants only
5
Write exclusive all registrants
6
Exclusive access all registrants

Examples

The following are the examples that are related to different scenarios.

Query operation

  1. To query the reservation status of the hdisk0 device when it is not reserved by any host, enter the following command:
    # devrsrv -c query -l hdisk0
    Device Reservation State Information
    ==================================================
    Device Name                      :  hdisk0
    Device Open On Current Host?     :  NO
    ODM Reservation Policy           :  SINGLE PATH RESERVE
    Device Reservation State         :  NO RESERVE

    The output shows that the device is not opened on the current host and the Object Data Manager (ODM) reservation policy is SINGLE PATH RESERVE. It indicates that the reservation policy is set in the ODM for this device. The device reservation state indicates the reservation that is present on the device. You can find the device reservation state by running a sequence of SCSI commands.

  2. To query the reservation status of the hdisk1 device when it is reserved by a host, enter the following command:
    # devrsrv -c query -l hdisk1
    The device is reserved by using the single path reservation by a host.
    Device Reservation State Information
    ==================================================
    Device Name                     :  hdisk1
    Device Open On Current Host?    :  NO
    ODM Reservation Policy          :  SINGLE PATH RESERVE
    Device Reservation State        :  SINGLE PATH RESERVE
  3. To query the reservation status of the hdisk2 device when it is reserved on the same host, enter the following command:
    # devrsrv -c query -l hdisk2
    Device Reservation State Information
    ==================================================
    Device Name                     :  hdisk2
    Device Open On Current Host?    :  YES
    ODM Reservation Policy          :  SINGLE PATH RESERVE
    Device Reservation State        :  SINGLE PATH RESERVE
    Path Id of Reserved Path        :  0
  4. To query the reservation status of the hdisk2 device when the ODM reservation policy is PR SHARED and the device is not reserved by any host, enter the following command:
    # devrsrv -c query -l hdisk0
    Device Reservation State Information
    ==================================================
    Device Name              :  hdisk0
    Device Open              :  NO
    ODM Reservation Policy   :  PR SHARED
    ODM PR Key Value         :  7777
    Device Reservation State :  NO RESERVE
    Registered PR Keys       :
    555
    777
    PR Capabilities Byte[2]  :  0xd  SIP_C   ATP_C   PTPL_C
    PR Capabilities Byte[3]  :  0x0
    PR Types Supported       :  NOT VALID
    Descriptions of several fields from the query output follow:
Registered PR Keys:
Displays keys that are registered by running the prout subcommand along with the REGISTER service action from all I/O paths that are sharing this device.
PR Capabilities Bytes:
Indicates the content of bytes 2 and 3 returned by the REPORT CAPABILITIES service action of the prin subcommand. See the SPC standard to interpret the output of the Example 4.
PR Types Supported:
Displays the persistent reservation types that are supported by the device that are reported by the persistent reservation type mask field in the report capabilities output.
If the persistent reservation is held on a device, the query output displays additional information about the device reservation as follows:
PR Reservation Type:
Displays one of the values of the PR Types that are described in the Flags section.
PR Holder key Value:
Displays the PR key value of the current reservation holder. The persistent reservation key value is 0 if the PR Type is 5 or 6.

Persistent reserve in (prin) operation

  1. To read all of the registered reservation keys, enter the following command:
    # devrsrv -c prin -s 0 -l hdisk0
    Registered PR Keys              :
    555
    777
  2. To read the current reservation key holder and type, enter the following command:
    # devrsrv -c prin -s 1 -l hdisk0
    PR Generation Value     :  2
    PR Type                 :  PR_EA_RO (EXCLUSIVE ACCESS, REGISTRANTS ONLY)
    PR Holder Key Value     :  777
  3. To return the PR capabilities information that is supported by sending the report capabilities service action, enter the following command:
    # devrsrv -c prin -s 2 -l hdisk0
    PR Capabilities Byte[2]         :  0xd  SIP_C   ATP_C   PTPL_C
    PR Capabilities Byte[3]         :  0x0
    PR Types Supported              :  NOT VALID

Persistent reserve out (prout) operation

RELEASE service action

To release the persistent reservation from IT-nexus that is registered and reserved with key 1777 and PR reservation type 4, enter the following command:
# devrsrv -c prout -s 2 -r 1777 -t 4 -l hdisk0
Device Reservation State Information
==================================================
Device Name                     :  hdisk0
Device Open On Current Host?    :  YES
ODM Reservation Policy          :  PR SHARED
ODM PR Key Value                :  7777
Device Reservation State        :  PR SHARED
Reservation will be cleared on the device. Do you want to continue y/n:y
If you run the query now, the result displays the Device Reservation State as NO RESERVE.
# devrsrv -c query -l hdisk0
Device Reservation State Information
==================================================
Device Name              :  hdisk0
Device Open              :  NO
ODM Reservation Policy   :  PR SHARED
ODM PR Key Value         :  7777
Device Reservation State :  NO RESERVE
Registered PR Keys       :
555
1777
PR Capabilities Byte[2]  :  0xd  SIP_C   ATP_C   PTPL_C
PR Capabilities Byte[3]  :  0x0
PR Types Supported       :  NOT VALID

CLEAR service action

To release the persistent reservation and to remove all the registrations from a device server that uses the CLEAR service action by using a registered I/O path with key 555, enter the following command:
# devrsrv -c prout -s 3 -r 555 -l hdisk0
Device Reservation State Information
==================================================
Device Name                     :  hdisk0
Device Open On Current Host?    :  YES
ODM Reservation Policy          :  PR SHARED
ODM PR Key Value                :  5555
Device Reservation State        :  PR SHARED
Reservation will be cleared on the device. Do you want to continue y/n:y
If you run the query now, the persistent reservation is released and the registrations are removed from the device.
# devrsrv -c query -l hdisk0
Device Reservation State Information
==================================================
Device Name               :  hdisk0
Device Open               :  NO
ODM Reservation Policy    :  PR SHARED
ODM PR Key Value          :  5555
Device Reservation State  :  NO RESERVE
Registered PR Keys        :  No Keys Registered
PR Capabilities Byte[2]   :  0xd  SIP_C   ATP_C   PTPL_C
PR Capabilities Byte[3]   :  0x0
PR Types Supported        :  NOT VALID

PREEMPT and PREEMPT_ABORT service actions

To preempt the persistent reservation that is held with reservation holder 444 by another IT-nexus with the registered key 777, enter the following command:
# devrsrv -c prout -s 4 -r 777 -k 444 -t 2 -l hdisk0
Before you run the # devrsrv -c prout -s 4 -r 777 -k 444 -t 2 -l hdisk0 command, the query output is displayed as follows.
# devrsrv -c query -l hdisk0
Device Reservation State Information
==================================================
Device Name               :  hdisk0
Device Open               :  NO
ODM Reservation Policy    :  PR SHARED
ODM PR Key Value          :  7777
Device Reservation State  :  PR EXCLUSIVE
PR Generation Value       :  5
PR Type                   :  PR_WE (WRITE EXCLUSIVE)
PR Holder Key Value       :  444
Registered PR Keys        :
777
444
PR Capabilities Byte[2]   :  0xd  SIP_C   ATP_C   PTPL_C
PR Capabilities Byte[3]   :  0x0
PR Types Supported        :  NOT VALID
After you run the # devrsrv -c prout -s 4 -r 777 -k 444 -t 2 -l hdisk0 command, the query output shows that the reservation is preempted by IT-nexus with key 777 and key 444 is unregistered.
# devrsrv -c query -l hdisk0
Device Reservation State Information
==================================================
Device Name              :  hdisk0
Device Open              :  NO
ODM Reservation Policy   :  PR SHARED
ODM PR Key Value         :  7777
Device Reservation State :  PR EXCLUSIVE
PR Generation Value      :  6
PR Type                  :  PR_EA (EXCLUSIVE ACCESS)
PR Holder Key Value      :  777
Registered PR Keys       :
777
PR Capabilities Byte[2]  :  0xd  SIP_C   ATP_C   PTPL_C
PR Capabilities Byte[3]  :  0x0
PR Types Supported       :  NOT VALID

RELEASE operation for SINGLE PATH RESERVE policy

To release the reservation on the hdisk0 device, enter the following commands:
  • Scenario 1: The current host is the owner of the reservation.
    # devrsrv -c query -l hdisk0
    
    Device Reservation State Information
    ==================================================
    Device Name                     :  hdisk0
    Device Open On Current Host?    :  YES
    ODM Reservation Policy          :  SINGLE PATH RESERVE
    Device Reservation State        :  SINGLE PATH RESERVE
    Path Id of Reserved Path        :  0
    # devrsrv -c release -l hdisk0
    
    Device Reservation State Information
    ==================================================
    Device Name                     :  hdisk0
    Device Open On Current Host?    :  YES
    ODM Reservation Policy          :  SINGLE PATH RESERVE
    Device Reservation State        :  SINGLE PATH RESERVE
    Device is currently Open on this host by a process.Do you want to continue y/n:y
    Command Successful
    Reservation cleared on the device. Query operation may not work properly.
    Close the application that holds the reservation and retry.
  • Scenario 2: The current host is not the owner of the reservation.
    # devrsrv -c query -l hdisk0
    
    Device Reservation State Information
    ==================================================
    Device Name                     :  hdisk0
    Device Open On Current Host?    :  NO
    ODM Reservation Policy          :  SINGLE PATH RESERVE
    Device Reservation State        :  SINGLE PATH RESERVE
    
    Because the current host does not own the reservation on the device,
    try the force option if you want to break the reservation.
    # devrsrv -f -l hdisk0
    The device is already reserved by using the single-path reservation by another host.
    Device Reservation State Information
    ==================================================
    Device Name                     :  hdisk0
    Device Open On Current Host?    :  NO
    ODM Reservation Policy          :  SINGLE PATH RESERVE
    Device Reservation State        :  SINGLE PATH RESERVE
    Reservation will be cleared on the device. Do you want to continue y/n:y
    After you run the release command successfully, the query option must display NO RESERVE as the device reservation state.
    # devrsrv -c query -l hdisk0
    
    Device Reservation State Information
    ==================================================
    Device Name                     :  hdisk0
    Device Open On Current Host?    :  NO
    ODM Reservation Policy          :  SINGLE PATH RESERVE
    Device Reservation State        :  NO RESERVE

Forced mode

The hdisk0 device is reserved with key 777 from another I/O path. To release this reservation from the other client, enter the following command:
# devrsrv -f -l hdisk0

Device Reservation State Information
==================================================
Device Name                     :  hdisk16
Device Open On Current Host?    :  NO
ODM Reservation Policy          :  PR SHARED
ODM PR Key Value                :  5555
Device Reservation State        :  PR SHARED
Reservation will be cleared on the device. Do you want to continue y/n:y
Command Successful
Before you run the # devrsrv -f -l hdisk0 command, the query displays the following output:
# devrsrv -c query -l hdisk0

Device Reservation State Information
==================================================
Device Name               :  hdisk0
Device Open               :  NO
ODM Reservation Policy    :  PR SHARED
ODM PR Key Value          :  5555
Device Reservation State  :  PR EXCLUSIVE
PR Generation Value       :  1
PR Type                   :  PR_WE (WRITE EXCLUSIVE)
PR Holder Key Value       :  777
Registered PR Keys        :
777
PR Capabilities Byte[2]   :  0xd  SIP_C   ATP_C   PTPL_C
PR Capabilities Byte[3]   :  0x0
PR Types Supported        :  NOT VALID
After you execute the # devrsrv -f -l hdisk0 command, the output indicates that the device is not reserved.
# devrsrv -c query -l hdisk0

Device Reservation State Information
==================================================
Device Name                     :  hdisk16
Device Open On Current Host?    :  NO
ODM Reservation Policy          :  PR SHARED
ODM PR Key Value                :  5555
Device Reservation State        :  NO RESERVE
Registered PR Keys              :  No Keys Registered
PR Capabilities Byte[2]         :  0x0
PR Capabilities Byte[3]         :  0x0
PR Types Supported              :  NOT VALID