How to use the SCSIcmd utility to perform various SCSI-2 and SCSI-3 reservation related actions.

Article:TECH72086  |  Created: 2009-01-02  |  Updated: 2013-08-01  |  Article URL http://www.symantec.com/docs/TECH72086
Article Type
Technical Solution

Product(s)


Issue



How to use the SCSIcmd utility to perform various SCSI-2 and SCSI-3 reservation related actions.


Solution



The SCSIcmd utility has been enhanced to now support operations on both SCSI-2 and SCSI-3 reserved disks. All the original options of SCSIcmd still exist which can be seen by either running SCSIcmd /?, or by reviewing Technote TECH51635 which is included in the 'Related Articles' section below; however, with the new SCSIcmd commands, there should be very little need to use the older options.

Before beginning:
The syntax for all commands discussed in this article are as follows: scsicmd -d<harddisk#> -s<scsi_command>

Syntax Example: scsicmd -d14 -sscsi_reserved_status

This command will run a SCSI reservation status check on Harddisk14

Note: In regards to this syntax, here are some further points to consider:
 
- Make sure to include the -s before the command (i.e. -sscsi3_test) which means all commands will start with two S's. Failure to do so will result in an error being displayed: ERROR: No such SCSI Opcode: 0xc from SCSI opcode table.
 
- To perform an action across all disks in the system, you can specify ALL with the -d switch. Example: scsicmd -dALL -sscsi_reserved_status
 
- You can also specify multiple disks for the command. For example: scsicmd -d3,4,5,7,9,11,12 -sscsi_reserved_status.
 
As stated above, the new SCSIcmd utility now supports SCSI-3, and has been enhanced to perform SCSI-2 operations more effectively then before. This Technote will cover the commands that are most likely to be run to assist in reservation issue cases. Section 1 will provide commands for both SCSI-2 and SCSI3, Section II will provide SCSI-2 specific commands, and Section III will provide SCSI-3 specific commands.
 

I. Commands for both SCSI-2 and SCSI-3
 
scsi_reserved_status
This option provides the current SCSI reservation status (SCSI-2 or SCSI-3) of the disk(s) specified. This is a good command to run to determine if there is any type of reservation on the disk which might be causing access issues.
 
Syntax Example: scsicmd -d14 -sscsi_reserved_status
 
Below are some example outputs of what will be seen with this command depending on the reservation type and status:
 
SCSI-2 Output when there is a reservation on the disk:
 
Harddisk14
 
Scsi Address
------------------
 Length     : 0x8
 PortNumber : 0x2
 PathId     : 0x1
 TargetId   : 0x2
 Lun        : 0x45
 
Harddisk14 is currently SCSI-2 reserved by SCSI Address (0x2, 0x1, 0x0, 0x1) of the computer: MTV2850-07.
 
SCSI-3 Output when there is a reservation on the disk
 
Harddisk14
 
Scsi Address
------------------
 Length     : 0x8
 PortNumber : 0x2
 PathId     : 0x1
 TargetId   : 0x2
 Lun        : 0x45
 
Harddisk 14 has SCSI-3 key(s) registered.
SCSI3 registered keys on harddisk14
Key: 7856341278563412
Key: 7856341278563412
Harddisk14 is currently under SCSI-3 reservation
SCSI3 reservation holder key on harddisk14
Key: 7856341278563412
Harddisk14 is currently being SCSI-3 reserved on the computer: MTV2850-07.
 
SCSI2 or SCSI3 output when there is no reservation on the disk:
 
Harddisk14
 
Scsi Address
------------------
 Length     : 0x8
 PortNumber : 0x2
 PathId     : 0x1
 TargetId   : 0x2
 Lun        : 0x45
 
Harddisk14 of the computer: MTV2850-07 is not under any SCSI reservation.


II. Commands specific to SCSI-2
 
scsi2_reserve
This performs a SCSI-2 reservation. This can be run to ensure a SCSI-2 reservation can be placed on a disk. One example would be in an environment where SCSI-2 is being used, but the Clustered Disk Group fails to come online with an error stating it failed to reserve a Majority of the Disks.
 
Syntax Example: scsicmd -d14 -sscsi2_reserve
 
Example of the output of a successful reservation:
 
Harddisk12
 
Scsi Address
------------------
 Length     : 0x8
 PortNumber : 0x3
 PathId     : 0x1
 TargetId   : 0x1
 Lun        : 0x7
 
Successfully issued SCSI-2 reservation on harddisk12 through SCSI Address (0x3, 0x1, 0x1, 0x7) of the computer: MTV2850-07
 
Checking the SCSI-2 reservation status on harddisk12.....
Harddisk12 is being SCSI-2 reserved.
 
scsi2_release
This option performs a SCSI-2 release reservation. This can be used in instances where there may be a stuck reservation on a disk that needs to be cleared in order for the current system to import the Disk Group.
 
Syntax Example: scsicmd -d14 -sscsi2_release
 
Example of the output of a successful reservation release on Harddisk14:
 
Harddisk14
 
Scsi Address
------------------
 Length     : 0x8
 PortNumber : 0x3
 PathId     : 0x1
 TargetId   : 0x1
 Lun        : 0x7
 
Successfully issued SCSI-2 release on harddisk14 through SCSI Address (0x3, 0x1, 0x1, 0x7) of the computer: MTV2850-07
 
scsi2_clear
This option performs SCSI-2 bus reset/break reservation. This will not only break the reservation on the specified harddisk(s), but will also issue a SCSI BUS reset down the path(s) of the disk(s) specified. This should only be run when all disks or Disk Groups are affected on a server. For example, if a server has 2 Disk Groups and only one is having an issue and the other one is imported and properly running, issuing this command could cause the cluster resource to determine that there is a reservation issue on the healthy disk and issue a resource fault. When performing a BUS reset, SFW will place another reservation on all imported disks, but if a cluster monitor cycle occurs prior to this, it will fault. This is more likely to occur in an MSCS cluster as it is checking reservation status every 5 seconds (where VCS only checks every 60 seconds).
 
Syntax Example: scsicmd -d14 -sscsi2_clear
 
Example of a successful SCSI-2 clear command:
 
Checking for disk(s) that have the common Scsi Port number and Scsi Path Id....
Harddisk14
 
Scsi Address
------------------
 Length     : 0x8
 PortNumber : 0x3
 PathId     : 0x1
 TargetId   : 0x1
 Lun        : 0x7
 
Successfully issued bus reset to ScsiPort3, PathId1.


III. Commands specific to SCSI-3
 
scsi3_reserve
This command performs a SCSI-3 reservation with a predefined SCSI-3 key (1234567812345678)
 
Syntax Example: scsicmd -d14 -sscsi3_reserve
 
Example of the output of a successful SCSI-3 reservation being placed on the disk:
 
Harddisk14
 
Scsi Address
------------------
 Length     : 0x8
 PortNumber : 0x3
 PathId     : 0x1
 TargetId   : 0x1
 Lun        : 0x7
 
Successfully performed SCSI-3 reservation on harddisk14.
 
scsi3_release
This command performs a SCSI-3 reservation release. This is only used to remove the reservation key from a specific disk down a specific path (remember, all disks share the same key in SCSI-3). To remove a reservation completely from a disk (removing both the registrant and register key), use the scsi3_clear option instead which is explained further below.
 
Syntax Example: scsicmd -d14 -sscsi3_release
 
Example of the output of a successful reservation:
 
Harddisk14
 
Scsi Address
------------------
 Length     : 0x8
 PortNumber : 0x3
 PathId     : 0x1
 TargetId   : 0x1
 Lun        : 0x7
 
Harddisk14 has the current SCSI-3 reservation holder:
7856341278563412
 
Successfully performed SCSI-3 release reservation on harddisk14
 
scsi3_clear
This option clears the SCSI-3 key and SCSI-3 reservation. This is the option that should be used when trying to clear a reservation on a disk that is SCSI-3 reserved. This should be used instead of the scsi3_release command as the release command doesn't completely clear the reservation key.
 
Syntax Example: scsicmd -d14 -sscsi3_clear
 
Example of the output of a successful clear:
 
Harddisk14
 
Scsi Address
------------------
 Length     : 0x8
 PortNumber : 0x3
 PathId     : 0x1
 TargetId   : 0x1
 Lun        : 0x7
 
Successfully performed SCSI-3 clear operation on harddisk14
 
scsi3_test
This option tests a disk to determine if it supports SCSI-3. This is a very useful command to run when a customer is considering moving to SCSI-2 to SCSI-3. For example, when running Active/Active in a cluster, SCSI-3 is required and we need to confirm that the disk/array supports this.
 
Syntax Example: scsicmd -d14 -sscsi3_test
 
Example of the output of a successful SCSI-3 reservation test:
 
Test #1:  Clean up any SCSI-3 keys left on harddisk14
Test #2:  Perform SCSI-3 Register action on harddisk14 with SCSI-3 key: 7856341278563412
Test #3:  Perform SCSI-3 reservation action on harddisk14 with SCSI-3 key: 7856341278563412
Test #4:  Perform SCSI-3 release action on harddisk14 with SCSI-3 key: 7856341278563412
Test #5: Perform a part of SCSI-3 preempt action test on harddisk14.
Test #6: Perform SCSI-3 Register Ignore Existing action on harddisk14.
Test #7: Perform SCSI-3 Unregister Service Action on harddisk14.
Test #8: Perform SCSI-3 Clear Service Action on harddisk14.
SCSI-3 PERSISTENT OPERATION TESTS: All tests are PASSED on harddisk14.


  *********************************************

Readme from SCSIcmd.zip download

USAGE:

scsicmd -d{# {[,#] | [..#]} | ALL {[#,] | [[#..#]} }  
        -s{ ScsiOp | scsi_reserved_status | scsi2_reserve | scsi2_release  
                   | scsi2_clear | scsi3_reserve | scsi3_release 
                   | scsi3_clear | scsi3_test}

where

    # denotes a harddisk number.
    Use 1 for harddisk1, 2 for harddisk2 and so on.

    ALL denotes for all disks in the testing system.

    -d option specifies disk(s) that will be used in scsicmd.

    OPTION -d  is followed by either a harddisk number or ALL parameter,
    there is no space between -d and its parameter.

        * If a harddisk number parameter is specified in -d option, 
          extra optional parameters can be specified:

                 ,#  ===> Include a set of harddisk number(s) to be used.
                   Each disk is separated by a comma ',' and there is no space
                   between comma.
                   Example: -d1,2,9 specifies harddisk1, harddisk2 and
                             harddisk9 to be used in SCSICMD.

                  ..# ===> Include a range of harddisk numbers.
                   Example: -d20..29 specifies harddisk20 through harddisk29
                            to be used in SCSICMD.

        * If ALL parameter is specified in -d option, extra optional parameters
          can be specified:

                  ,# ===> Exclude harddisk number(s) in -dALL.
                   Each disk is separated by a comma ',' and there is no space
                   between comma.
                   Example: -dAll1,2,9 specifies all disks to be used in
                             SCSICMD except harddisk1, harddisk2 and harddisk9.

                  ..#  ===> Excluded a range of harddisk numbers in -dALL
                   Example: -dAll20..29 specifies all disks to be used in
                             SCSICMD except hardisk20 through harddisk29.


    -s option specifies the operation to be performed

    OPTION -s is followed by only one of the below scsicmd operations
    
    NOte: There is no space between -s and and scsicmd operation.

            scsi_reserved_status  : get scsi reservation (scsi-2/scsi-3) status.

            scsi2_reseve          : perform SCSI-2 reservation.

            scsi2_release         : perform SCSI-2 release reservation.

            scsi2_clear           : perform SCSI-2 bus reset/break reservation.

            scsi3_reserve         : perform SCSI-3 reservation with a
                                    predefined SCSI-3 '1234567812345678' key.

            scsi3_release         : perform SCSI-3 release.

            scsi3_clear           : clear SCSI-3 key and SCSI-3 reservation.

            scsi3_test            : perform SCSI-3 tests.

            ScsiOp                : specify one of the ScsiOp number in
                                    SCSICMD CODE TABLE.
                                    Example: -s12 will get SCSI Inquiry.

     If -s option is not explictly given, SCSICMD uses -s25 (READ CAPATITY) as its default operation.


 Examples:
      scsicmd -d1 -s12
        The above command will get standard SCSI Inquiry for harddisk#1

      scsicmd -d5,6 -sscsi_reserved_status
        The above command will check scsi-2/scsi-3 reservation for harddisk5 and hardisk6

      scsicmd -dAll -s0
        The above command will check SCSI TUR for all disks in the system
                          

*************************** SCSICMD CODE TABLE ********************************
ScsiOp  Description                    ScsiOp  Description                    *
======  =========================      ======  ================================
                                   |                                          
 12  INQUIRY                       |                                          
 1A  MODE SENSE (page 80)          |                                          
 25  READ CAPACITY                 |                                          
371  READ DEFECT DATA              |                                          
 A0  REPORT LUNS                   |                                          
  3  REQUEST SENSE                 |                                          
 16  RESERVE                       |                                          
 17  RELEASE                       |                                          
 1B  START STOP UNIT               |                                          
  0  TEST UNIT READY               |                                          
 22  MODE PAGE  22                 |                                          
 23  MODE SENSE 23                 |                                          
 2B  MODE SENSE 2B                 |                                          
 37  MODE SENSE 37                 |                                          
 80  MODE PAGE 80                  |                                          
 83  MODE PAGE 83                  |                                          
 E0  MODE PAGE E0                  |                                          
 C0  MODE PAGE C0                  |                                          
 C9  MODE PAGE C9                  |                                          
 26  MODE PAGE 26                  |                                          
 A3  REPORT TARGET GROUP           |                                          
 FE  TEST DRIVE LAYOUT READING     |                                          
 13  RESET SCSI BUS                |                                          
*******************************************************************************


Attachments

Scsicmd Utility for SFW 5.x
SCSIcmd.zip (33 kBytes)
Scsicmd Utility for SFW 6.x
scsicmd.exe (116 kBytes)




Legacy ID



327426


Article URL http://www.symantec.com/docs/TECH72086


Terms of use for this information are found in Legal Notices