How To Read And Clear SCSI Reservations in Solaris 11 (sg3_utils)
The post provides a general overview of sg3_utils and provide some examples to read and clear SCSI reservations with the sg_persist command. The command sg_persist sends a SCSI PERSISTENT RESERVE (IN or OUT) command to manipulate registrations and reservations.
Installing and configuring sg3_utils
These utilities, initially developed for Linux environments, are not installed by default, but the package can be installed from a Solaris 11 repository using the following command:
# pkg install sg3_utils
Complete information about sg3_utils and all the tools / commands can be found here:
http://sg.danny.cz/sg/sg3_utils.html
http://sg.danny.cz/sg/sg3_utils.html
Also, changes included in newer versions are documented here:
https://github.com/hreinecke/sg3_utils/blob/master/ChangeLog
https://github.com/hreinecke/sg3_utils/blob/master/ChangeLog
The sg_persist utility is used to send a SCSI PERSISTENT RESERVE (IN or OUT) command to query or manipulate registrations and reservations. Few of the important arguments are listed below.
-c, –report-capabilities
Report Capabilities is a sub-command of the PRIN command. It lists information about the aspects of persistent reservations that the DEVICE supports. For example:
# sg_persist --report-capabilities /dev/rdsk/c0t5000CCA0536DD628d0s2 HGST HSCAC2DA2SUN1.6T A29A Peripheral device type: disk Report capabilities response: Compatible Reservation Handling(CRH): 0 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: 0 Persist Through Power Loss Active(PTPL_A): 1 Support indicated in Type mask: Write Exclusive, all registrants: 0 Exclusive Access, registrants only: 1 Write Exclusive, registrants only: 1 Exclusive Access: 1 Write Exclusive: 1 Exclusive Access, all registrants: 0
-k, –read-keys
Read Keys is a sub-command of the PRIN command. Lists all the reservation keys registered (i.e. registrations) with the given SCSI device. For example:
# sg_persist --read-keys /dev/rdsk/c0t5000CCA0536DD628d0s2 HGST HSCAC2DA2SUN1.6T A29A Peripheral device type: disk PR generation=0x9, 1 registered reservation key follows: 0x59ee067a00000001
-r, –read-reservation
Read Reservation is a sub-command of the PRIN command. List information about the current holder of the reservation on the DEVICE. If there is no current reservation this will be noted. Information about the current holder of the reservation includes its reservation key, scope and type. For example:
# sg_persist --read-reservation /dev/rdsk/c0t5000CCA0536DD628d0s2 HGST HSCAC2DA2SUN1.6T A29A Peripheral device type: disk PR generation=0x9, Reservation follows: Key=0x59ee067a00000001 scope: LU_SCOPE, type: Write Exclusive, registrants only
-C, –clear
Clear is a sub-command of the PROUT command. It releases the persistent reservation (if any) and clears all registrations from the device. It is required to supply a reservation key that is registered for this I_T_L nexus (identified by –param-rk=RK). For example:
# sg_persist --clear --param-rk=0x59ee067a00000001 /dev/rdsk/c0t5000CCA0536DD628d0s2
No comments:
Post a Comment