top of page
taitaigramsentca

3pardata Ses Scsi Enclosure Device Driver: An Interface to SCSI Enclosure Services Devices



The sg_ses utility enables a user "to manage and sensethe state of the power supplies, cooling devices, displays,indicators, individual drives, and other non-SCSI elements installedin an enclosure". The SCSI Enclosure Services standards (mostrecent is SES-3 T10/BSR INCITS 518-2018) and the latest draft(ses4r05.pdf at www.t10.org)describe the format that the sg_ses utility expects to find ina SES device ("logical unit" or "process"). Thesg_ses utility is found in the sg3_utilspackage. The utility was originally written for Linux (includingAndroid) and has ports to FreeBSD, Solaris and Windows. This pageoutlines the features of the sg_ses utility version 2.48 found in thesg3_utils version 1.46 package.Thesg_ses_microcode utility was added in the sg3_utilsrelease 1.40 . It is designed todownload microcode (firmware) to an enclosure and report any errorsreturned by the enclosure.


Typically the first problem to solve is finding an OperatingSystem handle for a SES device. SCSI disks are typically easier tofind but rarely is a SCSI disk also a SES device (only if the EncServbit is set in the disk's INQUIRY command response). First let us trythe sg_ses utility on a SAS disk (in Linux):$sg_ses /dev/sdb SEAGATE ST33000650SS 0002 disk device (not an enclosure)Supporteddiagnostic pages: Supported diagnostic pages [sdp][0x0] Protocol specific (SAS transport) [] [0x3f] Translate address (SBC) [] [0x40]Without anyoptions sg_ses reports the names of the supported diagnostic pages.The SAS disk does support some pages but none that belong to the SESstandard. On Linux it helps to list all SCSI devices with the lsscsiutility (including showing the generic device names with the '-g'option; 'modprobe sg' may be needed ifhyphens appear in the last column):$lsscsi -g[1:0:0:0] disk ATA ST3320620AS 3.AA /dev/sda /dev/sg0[6:0:0:0] disk SEAGATE ST33000650SS 0002 /dev/sdb /dev/sg1[6:0:1:0] disk SEAGATE ST32000444SS 0006 /dev/sdc /dev/sg2[6:0:2:0] enclosu Intel RES2SV240 0600 - /dev/sg3The last item is an enclosure and noticethat it does not have a disk device node (i.e. there is no /dev/sdd).In Linux the bsg driver could also be used and its device node wouldbe /dev/bsg/6:0:2:0 for the enclosure.Now let us try sg_ses on /dev/sg3 :$sg_ses /dev/sg3 Intel RES2SV240 0600Supported diagnostic pages: Supporteddiagnostic pages [sdp] [0x0] Configuration (SES) [cf][0x1] Enclosure status/control (SES) [ec,es] [0x2] String In/Out (SES) [str] [0x4] Threshold In/Out (SES)[th] [0x5] Element descriptor (SES) [ed] [0x7] Additional element status (SES-2) [aes] [0xa] SupportedSES diagnostic pages (SES-2) [ssp] [0xd] Downloadmicrocode (SES-2) [dm] [0xe] Subenclosure nickname(SES-2) [snic] [0xf]So now we see severaldiagnostic pages related to the SES (and SES-2) standard. Of thesethe most important are the Configuration page and the EnclosureStatus/Control page. All the pages referred to below are actuallydiagnostic pages, so the term diagnostic will be dropped in many casefor brevity.Let us assume that a 6-disk SAS/SATA diskarray is associated with this SES device. We might suspect the diskon the left of the array is "slot 0" but would like tocheck before removing the disk. One way to double check is to ask"slot 0" to identify itself by flashing its LED for 10seconds. This can be done like this:$sg_ses --dev-slot-num=0 --set=ident /dev/sg3$ sleep 10$sg_ses --dsn=0 --clear=ident /dev/sg3In the latterinvocation '--dsn=0' is a synonym for '--dev-slot-num=0'.Now check the disk on the right (slot 5), this time using shorteroption variants ('-x 5' is equivalent to'--dev-slot-num=5'):$sg_ses -x 5 -S ident /dev/sg3$ sleep 10$ sg_ses -x 5 -Cident /dev/sg3 Typically there is a lot ofinformation held by a SES device divided into pages. Several of thosepages carry information with a somewhat similar structure torelational database tables. To see a lot of information try thesecommands (one after the other):$sg_ses --join /dev/sg3$ sg_ses --join --filter /dev/sg3$sg_ses -j -ff /dev/sg3The first command will listinformation on all disks, fans, power supplies etc, even for disksand fans not installed. The second command attempts to filter outsome less relevant information. The third command tries harder tofilter out some less relevant information.




3pardata Ses Scsi Enclosure Device Driver



Optionally a SES device may support the Element Descriptor page.If so that page will have the same number of elements as theEnclosure Status page. So it is possible that the descriptor namesfound in the Element Descriptor page may be used as an alternative tothe --index= option discussed in the previous section. The--descriptor=DES option was introduced forthis purpose.Apart from having a Element Descriptor page,the descriptor names need to be suitable. Some or all of thedescriptor names might be empty which does not help indexing. Alsothe descriptor names might be so long (e.g. including part and serialnumbers) as to make them unwieldy as indexes. A simple way to findout is to look at the descriptor names in the Element Descriptor pagewith:$ sg_ses --page=ed/dev/sg3Element descriptor In diagnostic page: generation code: 0x0 element descriptor list (grouped bytype): Element type: Array device slot,subenclosure id: 0 [ti=0] Overalldescriptor: ArrayDevicesInSubEnclsr0 Element 0 descriptor: ArrayDevice00 Element 1 descriptor: ArrayDevice01 Element 2 descriptor: ArrayDevice02 ...The above example shows descriptor namessuitable for indexing. Given these descriptor names, one would expectthese two commands to do the same thing, namely turn on the ident LEDon the disk in slot 0:$ sg_ses--index=arr,0 --set=ident /dev/sg3$ sg_ses--descriptor=ArrayDevice00 --set=ident /dev/sg3Ifan unrecognized descriptor name is given then response will be likethis:$ sg_ses --descriptor=xxx--set=ident /dev/sg3descriptor name: xxx not found (check 'ed'page [0x7])A SAS disk or tape can be indexed byits SAS address (also known as its target port identifier in SCSIjargon). SAS disks are typically dual ported and have two targetports whose SAS addresses are usually adjacent values. When a SATAdisk is involved, it is usually connected via a SAS expander whichtypically assigns it an arbitrary "SAS" address. And thatarbitrary "SAS" address is typically different from theSATA disk's WWN. One can see that in the following example where theSAS address (5001517e85c3efe1) issurprisingly close to that of the SAS expander (5001517e85c3efff). If that SATA disk was placed in another slot, the address wouldprobably change (slightly) in sympathy. For indexing based on SASaddresses to work, the Additional Element Status page needs to bepresent.# sg_ses--sas-addr=5001517e85c3efe1 /dev/sg3ArrayDevice01 [0,1] Element type: Array device slot Enclosure Status: Predicted failure=0, Disabled=0, Swap=0, status: OK OK=0, Reserved device=0, Hot spare=0, Cons check=0 In crit array=0, In failed array=0, Rebuild/remap=0, R/R abort=0 App client bypass A=0, Do not remove=0, Enc bypass A=0, Enc bypassB=0 Ready to insert=0, RMV=0, Ident=0,Report=0 App client bypass B=0, Faultsensed=0, Fault reqstd=0, Device off=0 Bypassed A=0, Bypassed B=0, Dev bypassed A=0, Dev bypassed B=0 Additional Element Status: Transportprotocol: SAS number of phys: 1, not allphys: 0, device slot number: 1 phy index:0 device type: no SAS deviceattached initiator portfor: target port for:SATA_device attached SAS address:0x5001517e85c3efff SAS address:0x5001517e85c3efe1 phyidentifier: 0x0The 'attached SAS address' shownabove is that of the SAS expander. From the above we can see that theSATA disk is associated with device slot number 1. So the ident flagcan be set as follows:# sg_ses--dev-slot-num=1 --set=ident /dev/sg3Device slotnumbers describe a position in a disk enclosure. They may also beavailable in SAS expanders often associated with SES devices. SomeSAS-2 and all SAS-3 expanders should report device slot numbers. Thenumber is a 1 byte value from 0 to 255 where 255 indicates there isno associated slot. Device slot numbers, if available, will be in theoutput of the smp_discover utility in the smp_utilspackage.


When using the --clear, --getand --set options, the default page is theEnclosure Status/Control page (the Status page for --get,the Control page for --clear and --set).All of the following invocations attempt to set the "ident"field on the disk in slot 5 and all should cause its LED to flash:$sg_ses --index=arr,5 --set=ident /dev/sg3$ sg_ses --index=arr,5--set=ident=1 /dev/sg3$ sg_ses --index=arr,5 --set=ident--page=ec /dev/sg3$ sg_ses --index=5 --set=ident /dev/sg3$sg_ses --index=arr,5 --set=2:1 /dev/sg3$ sg_ses --index=arr,5--set=2:1=1 /dev/sg3$ sg_ses --index=arr,5 --set=2:1:1=1/dev/sg3The latter three invocations use anumerical description of the field whose format is:[:] . The defaults to 1 when it is not given. To get alisting of the field names supported by sg_ses use the --enumerateoption twice (or more simply: '-ee'). Forexample:$ sg_ses -ee--clear,--get, --set acronyms for enclosure status/control [0x2] page: ... ident [Device slot] [2:1:1] ident [Array device slot] [2:1:1] ident [Power supply][1:7:1] ident [Cooling] [1:7:1] ... locate [Device slot] [2:1:1] locate [Arraydevice slot] [2:1:1] locate [Power supply][1:7:1] locate [Cooling] [1:7:1] ...Assuming there is only one power supply and ithas an "ident" LED then this invocation should cause it toflash:$ sg_ses --index=ps,0--set=ident /dev/sg3Notice that the "ident"field is in a different location in the Power Supply and CoolingElement Types (i.e. byte 1, bit 7) compared to the Device Slot andArray Device Slot Element Types (i.e. byte 2, bit 1).Tobe absolutely sure of what is written to a control element, the whole4 bytes (32 bits) can be written explicitly:$sg_ses --dsn=3 --set=0:7:32=0x200 /dev/sg3That willset the RQST IDENT bit in the Array device slot control element whosedevice slot number is 3.From sg3_utils version 1.43(subversion revision 711) multiple clear, get and set options canappear in one invocation (up to a maximum of 8). They are applied inthe order they appear (i.e. left to right) so if they contradict oneanother, the rightmost is applied last.At the same time, thenumeric part of the --index= argument wasexpanded to accept a range. For example:$sg_ses --index=3-5 --set=ident /dev/sg3will setthe IDENT bit on the (array) indexes 3, 4 and 5. 2ff7e9595c


1 view0 comments

Recent Posts

See All

Comments


bottom of page