If the Linux server has device-mapper-multipath configured, you can run ‘multipath -ll’ to list how disks are grouped together. For ALUA mode, you can check if a disk is in the Active/Optimized or non-optimized group.
This post, however, is to discuss how to use sg_rtpg command to check the target port group asymmetric access state (aas). Along with sg_inq command, you can check if a specific disk (/dev/sdX) is in Active/optimized group or not.
You can use sg_rtpg to decode the status code and asymmetric access state from each target port group descriptor returned:
# sg_rtpg -vvd /dev/sda
If sg_repg returns “Report Target Port Groups command not supported“, the disk does not have ALUA enabled or supported. If ALUA is enabled on storage, the output should show the ‘aas‘ state and the list the target group/port id(s).
target port group asymmetric access state : 0x01 (active/non optimized)
Then You can check the same disk’s SCSI Inquiry page 0x83 :
# sg_inq -vv -p 0x83 /dev/sda
The sg_inq will report which target group/port it belongs to, and you can verify if the target port group is optimized or not.