What is ALUA?
ALUA stands for Asymmetrical Logical Unit Access. Midrange arrays usually have an internal interconnect between the two storage processors used for write cache mirroring and other management purposes. ALUA was an addition to the SCSI standard that enables a LUN to be presented via its primary path and via an asymmetrical (significantly slower) path via the secondary storage processor, transferring the data over the internal interconnect.
In simpler terms, ALUA specifies a type of storage device that is capable of servicing I/O to a given LUN on two different storage processors but in an uneven manner. Using ALUA, I/O to a given LUN can be sent to available ports on any of the SPs in the storage array. This is closer to the behavior of asymmetric active/active arrays than to that of active/passive arrays. The I/O is allowed to the LUN, but the performance of the owner SP is better than that of the non-owner SP. To allow the initiators to identify which targets would provide the best I/O, the ports on each SP are grouped together into target port groups. Each target port group is given a distinctive “state” (asymmetric access state [AAS]) that denotes the optimization of ports on one SP compared to ports on the other SP (for example, active-optimized versus active-non-optimized).
How to tell if ALUA is enabled on a LUN
Apart from checking the SAN configuration, how can I tell if a LUN is in active-active or active-passive mode? Well, The LUN can be queried with the sg_rtpg command, available in the sg3_utils package. A SCSI “Report Target Port Groups” (RTPG) command is sent to the specified device and the returned data is decoded. This is the same command/data used within multipath for ascertaining port status within ALUA configurations.
1. Install the SCSI command utilities:
# yum install sg3_utils
2. Send a “Report Target Port Groups” query to the path:
# sg_rtpg -d /dev/sdX
3. The following output indicates a path does not support ALUA:
# sg_rtpg /dev/sdX Report Target Port Groups command not supported
The following output indicates a path supports, is configured for, ALUA:
# sg_rtpg /dev/sdX target port group asymmetric access state : 0x00 (active/optimized) target port group asymmetric access state : 0x01 (active/non optimized)
The full set of asymmetric access state values defined by the SCSI specification are:
|asymmetric access state Value||Remark|
|4h – Eh||Reserved|
|Fh||Transitioning between states|
Lets see an example to verify ALUA mode on a specific LUN as shown in the example below:
# sg_rtpg -vvd /dev/sda open /dev/sdg with flags=0x802 report target port groups cdb: a3 0a 00 00 00 00 00 00 04 00 00 00 report target port group: requested 1024 bytes but got 116 bytes Report list length = 116 Report target port groups: target port group id : 0x1 , Pref=0 target port group asymmetric access state : 0x01 (active/non optimized) T_SUP : 0, O_SUP : 0, U_SUP : 1, S_SUP : 0, AN_SUP : 1, AO_SUP : 1 status code : 0x01 (target port asym. state changed by SET TARGET PORT GROUPS command) vendor unique status : 0x00 target port count : 0c Relative target port ids: 0x01 0x02 0x03 << target port id 1,3 is active/non optimized alua pass (offspeed path) : target port group id : 0x2 , Pref=1 target port group asymmetric access state : 0x00 (active/optimized) T_SUP : 0, O_SUP : 0, U_SUP : 1, S_SUP : 0, AN_SUP : 1, AO_SUP : 1 status code : 0x01 (target port asym. state changed by SET TARGET PORT GROUPS command) vendor unique status : 0x00 target port count : 0c Relative target port ids: 0x0d 0x0e :
So this storage is configured in ALUA mode. Looking at a specific device’s SCSI Inquiry page 0x83, multipath can determine if the path is an optimized path or non-optimized (offspeed) path. All optimized paths would be grouped together.
# sg_inq -vv -p 0x83 /dev/sda : Designation descriptor number 3, descriptor length: 8 designator_type: Relative target port, code_set: Binary associated with the target port Relative target port: 0x3 Designation descriptor number 4, descriptor length: 8 designator_type: Target port group, code_set: Binary associated with the target port Target port group: 0x1
So /dev/sda has group,port pair of 1,3. Looking up group id 1, port id 3 in the above sg_rtpg output we see that port group is active/non-optimized state. Typically active/optimized path groups have a calculated priority of something list 50-80 and active/non-optimized have a lesser calculated priority such as:
mpath2 (3600601602df02d00aae0129e5c11e111) dm-60 DGC,VRAID [size=30G][features=1 queue_if_no_path][hwhandler=1 alua][rw] \_ round-robin 0 [prio=50][active] \_ 1:0:3:20 sds 70:944 [active][ready] \_ 0:0:1:20 sdk 67:288 [active][ready] \_ round-robin 0 [prio=10][enabled] \_ 0:0:2:20 sda 8:592 [active][ready] \_ 1:0:2:20 sdx 128:592 [active][ready]