pNFS SCSI sg3_utils cheet sheet
Support for Persistent Reservations
Does this device support reservations?
[root@fedora ~]# sg_persist --in --report-capabilities -v /dev/sda
inquiry cdb: 12 00 00 00 24 00
LIO-ORG block_1 4.0
Peripheral device type: disk
Persistent Reservation In cmd: 5e 02 00 00 00 00 00 20 00 00
Report capabilities response:
Compatible Reservation Handling(CRH): 1
Specify Initiator Ports Capable(SIP_C): 1
All Target Ports Capable(ATP_C): 1
Persist Through Power Loss Capable(PTPL_C): 1
Type Mask Valid(TMV): 1
Allow Commands: 1
Persist Through Power Loss Active(PTPL_A): 1
Support indicated in Type mask:
Write Exclusive, all registrants: 1
Exclusive Access, registrants only: 1
Write Exclusive, registrants only: 1
Exclusive Access: 1
Write Exclusive: 1
Exclusive Access, all registrants: 1
Query page 0x83 of vital product data
What what are the device’s identifiers?
[root@gfs-a24c-01 /]# sg_inq --vpd -p 0x83 /dev/sda
VPD INQUIRY: Device Identification page
Designation descriptor number 1, descriptor length: 20
designator_type: NAA, code_set: Binary
associated with the addressed logical unit
NAA 6, IEEE Company_id: 0x6016
Vendor Specific Identifier: 0x5e203f00
Vendor Specific Identifier Extension: 0xccbbc3f19b08e611
[0x600601605e203f00ccbbc3f19b08e611]
Designation descriptor number 2, descriptor length: 20
designator_type: vendor specific [0x0], code_set: Binary
associated with the addressed logical unit
vendor specific:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Designation descriptor number 3, descriptor length: 8
designator_type: Relative target port, code_set: Binary
associated with the target port
Relative target port: 0x1
Designation descriptor number 4, descriptor length: 8
designator_type: Target port group, code_set: Binary
associated with the target port
Target port group: 0x1
Query any existing persistent reservations
[root@gfs-a24c-01 /]# sg_persist -r /dev/sda
DGC VRAID 0533
Peripheral device type: disk
PR generation=0x9, Reservation follows:
Key=0x100000000000000
scope: LU_SCOPE, type: Exclusive Access, registrants only
Release an existing reservation
You’ll need to match the reservation type in prout-type:
[root@gfs-a24c-02 ~]# sg_persist -r /dev/sda
DGC VRAID 0533
Peripheral device type: disk
PR generation=0xb, Reservation follows:
Key=0x100000000000000
scope: LU_SCOPE, type: Exclusive Access, registrants only
[root@gfs-a24c-02 ~]# sg_persist --out --release --param-rk=0x100000000000000 --prout-type=6 /dev/sda
DGC VRAID 0533
Peripheral device type: disk
[root@gfs-a24c-02 ~]# sg_persist -r /dev/sda
DGC VRAID 0533
Peripheral device type: disk
PR generation=0xb, there is NO reservation held
Note, you’ll need to release the reservation from the same initiator, otherwise perform a register-move. The sg_persist man page is helpful here..