1Please Note: 2>>> Up to and including sg3_utils-1.33 the Solaris code was built 3>>> and tested on an OpenSolaris VM run with VirtualBox on Ubuntu 4>>> 11.10 . Now with Ubuntu 12.04 those VMs crash immediately when 5>>> started with VirtualBox. Further, Oracle (who owns SUN and thus 6>>> Solaris) no longer supports OpenSolaris and its package 7>>> repository has been withdrawn. The author can find no generic VMs 8>>> for Oracle Solaris 11 that run on VirtualBox or VMWare. The author 9>>> is also displeased with the withdrawal of the Open Software 10>>> OS and is disinclined to build a Solaris 11 system just to 11>>> virtualize it. 12>>> So as of sg3_utils-1.34 the Solaris port is provided "as-is" without 13>>> testing on a Solaris platform. 14 15Douglas Gilbert 1613th October 2012 17 18 19 20Introduction 21============ 22The Solaris port of sg3_utils contains those utilities that are 23_not_ specific to Linux. 24 25The dd variants from the sg3_utils package (e.g. sg_dd) rely on too many 26Linux idiosyncrasies to be easily ported. A new package called 'ddpt' 27contains a utility with similar functionality to sg_dd and is available 28for Solaris. 29 30Supported Utilities 31=================== 32Here is a list of utilities that have been ported: 33 sg_bg_ctl 34 sg_compare_and_write 35 sg_decode_sense 36 sg_format 37 sg_get_config 38 sg_get_elem_status 39 sg_get_lba_status 40 sg_ident 41 sg_inq [dropped ATA IDENTIFY DEVICE capability] 42 sg_logs 43 sg_luns 44 sg_modes 45 sg_persist 46 sg_opcodes 47 sg_prevent 48 sg_raw 49 sg_rdac 50 sg_read_block_limts 51 sg_read_buffer 52 sg_read_long 53 sg_readcap 54 sg_reassign 55 sg_referrals 56 sg_rep_pip 57 sg_rep_zones 58 sg_requests 59 sg_rmsn 60 sg_rtpg 61 sg_safte 62 sg_sanitize 63 sg_sat_identify 64 sg_sat_phy_event 65 sg_sat_set_features 66 sg_seek 67 sg_senddiag 68 sg_ses 69 sg_start 70 sg_stpg 71 sg_stream_ctl 72 sg_sync 73 sg_turs 74 sg_unmap 75 sg_verify 76 sg_vpd 77 sg_wr_mode 78 sg_write_buffer 79 sg_write_long 80 sg_write_same 81 sg_write_verify 82 sg_write_x 83 sg_zone 84 85Most utility names are indicative of the main SCSI command 86that they execute. Some utilities are slightly higher level, for 87example sg_ses fetches SCSI Enclosure Services (SES) status pages and 88can send control pages. Each utility has a man page (placed in 89section 8). An overview of sg3_utils can be found at: 90https://sg.danny.cz/sg/sg3_utils.html . 91A copy of the "sg3_utils.html" file is in the "doc" subdirectory. 92 93 94The executables and library can be built from the source code in 95the tarball and installed with the familiar 96"./configure ; make ; make install" sequence. If this fails try 97running the "./autogen.sh" script prior to that sequence. There 98are generic instruction on configure and friend in the INSTALL file. 99 100Some man pages have examples which use Linux device names which 101hopefully will not confuse the Solaris users. 102 103Device naming 104============= 105In Solaris, SCSI device names below the '/dev' directory have a 106form like: c5t4d3s2 where the number following "c" is the controller 107(HBA) number, the number following "t" is the target number (from 108the SCSI parallel interface days) and the number following "d" is 109the LUN. Following the "s" is the slice number which is related to 110a partition and by convention "s2" is the whole disk. 111 112OpenSolaris also has a c5t4d3p2 form where the number following 113the "p" is the partition number apart from "p0" which is the whole 114disk. So a whole disk may be referred to as either: 115 - c5t4d3 116 - c5t4d3s2 117 - c5t4d3p0 118 119And these device names are duplicated in the /dev/dsk and /dev/rdsk 120directories. The former is the block device name and the latter 121is for "raw" (or char device) access which is what sg3_utils needs. 122So in OpenSolaris something of the form: 123 sg_inq /dev/rdsk/c5t4d3p0 124should work. If it doesn't add a '-vvv' option. If that is attempted 125on the /dev/dsk/c5t4d3p0 variant an inappropriate ioctl for device 126error will result. 127 128The device names within the /dev directory are typically symbolic 129links to much longer topological names in the /device directory. 130 131In Solaris cd/dvd/bd players seem to be treated as disks and so are 132found in the /dev/rdsk directory. Tape drives appear in the /dev/rmt 133directory. 134 135There is also a sgen (SCSI generic) driver which by default does not 136attach to any device. See the /kernel/drv/sgen.conf file to control 137what is attached. Any attached device will have a device name of 138the form /dev/scsi/c5t4d3 . 139 140Listing available SCSI devices in Solaris seems to be a challenge. 141"Use the 'format' command" advice works but seems a very dangerous 142way to list devices. [It does prompt again before doing any damage.] 143'devfsadm -Cv' cleans out the clutter in the /dev/rdsk directory, 144only leaving what is "live". The "cfgadm -v" command looks promising. 145 146Details 147======= 148The ported utilities listed above, all use SCSI command functions 149declared in sg_cmds_basic.h and sg_cmds_extra.h . Those SCSI command 150functions are implemented in the corresponding ".c" files. The ".c" 151files pass SCSI commands to the host operating system via an interface 152declared in sg_pt.h . There are currently five implementations of that 153interface depending on the host operating system: 154 - sg_pt_linux.c 155 - sg_pt_freebsd.c 156 - sg_pt_osf1.c [Tru64] 157 - sg_pt_solaris.c 158 - sg_pt_win32.c 159 160The sg_pt_solaris.c file uses the "uscsi" SCSI pass through mechanism. There 161seems to be no corresponding ATA pass through and recent SATA disks do not 162seem to have a SAT layer in front of them (within Solaris). If SAT is 163present (perhaps externally or within a HBA) then that would allow SATA 164disks to accept SCSI commands including the SCSI ATA PASS THROUGH commands. 165 166 167Douglas Gilbert 1685th June 2020 169