• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How To Read And Clear SCSI Reservations in Solaris 11 (sg3_utils)

By admin

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

Also, changes included in newer versions are documented here:
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

Filed Under: Solaris, Solaris 11

Some more articles you might also be interested in …

  1. How to enable Solaris multipathing (MPxIO or STMS) for EMC Symmetrix LUNs
  2. Solaris 10 (x86/x64) : How to boot into single user mode from the Grub boot loader
  3. Solaris ZFS : How to import 2 pools that have the same names
  4. How to configure IPMP in Solaris 11 – Active-Active & Active-Standby
  5. How to Backup and Restore ZFS root pool in Solaris 10
  6. How to configure Solaris 10 Probe based IPMP
  7. How to verify non-global solaris zone is installed
  8. Unix file basics : Inode, Soft Vs Hard link, Device files, Named pipes
  9. How to configure Probe Based IPMP in Solaris 11
  10. Solaris : How to scan new storage LUNs (scsi/iscsi/fc/sas)

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary