1SG_STPG(8) SG3_UTILS SG_STPG(8)
2
3
4
6 sg_stpg - sends a SCSI SET TARGET PORT GROUPS command
7
9 sg_stpg [--active] [--help] [--hex] [--offline] [--optimized] [--raw]
10 [--standby] [--state=S,S...] [--tp=P,P...] [--unavailable] [--verbose]
11 [--version] DEVICE
12
14 Send a SCSI SET TARGET PORT GROUPS command to DEVICE. This utility has
15 different modes depending on whether the --tp= option is given.
16
17 If --tp= is given then the SET TARGET PORT GROUPS command parameter
18 block is built with a descriptor for each element in the list given to
19 --tp=. The corresponding asymmetric access state value is either taken
20 from the --state= list or, if that is not given, from one of the
21 explicit state options (e.g. --unavailable), used repeatedly if
22 required.
23
24 If --tp= is not given then a sequence of SCSI commands are sent to the
25 DEVICE leading up to the SET TARGET PORT GROUPS command. First an
26 INQUIRY is sent to fetch the device identification VPD page to find the
27 (primary) target port group associated with DEVICE. Then a REPORT TAR‐
28 GET PORT GROUPS command is issued to find the current state and whether
29 a transition to the requested state is supported. If so the SET TARGET
30 PORT GROUPS command is sent.
31
32 Target port group access is described in SPC-4 found at www.t10.org in
33 section 5.8 (in rev 11 dated 2007/5/14). The SET TARGET PORT GROUPS
34 command is also described in that document.
35
37 Arguments to long options are mandatory for short options as well. The
38 options are arranged in alphabetical order based on the long option
39 name.
40
41 -a, --active
42 set active/non-optimized state.
43
44 -h, --help
45 output the usage message then exit.
46
47 -H, --hex
48 output response to the REPORT TARGET PORT GROUPS command in hex
49 then exit.
50
51 -O, -l, --offline
52 set offline state. This is the appropriate state to set a target
53 port to prior to removing the device. Note that a relative tar‐
54 get port identifier should be given with this state (rather than
55 a target port group identifier that all other states take).
56
57 -o, --optimized
58 set active/optimized state. If no other state options or --tp=
59 option are given then active/optimized is the default state.
60
61 -r, --raw
62 output response to the REPORT TARGET PORT GROUPS command in
63 binary to stdout then exit.
64
65 -s, --standby
66 set standby state. Port group shall accept those commands listed
67 for "unavailable" state plus LOG SELECT/SENSE, MODE
68 SELECT/SENSE, RECEIVE DIAGNOSTIC RESULTS, SEND DIAGNOSTIC, PER‐
69 SISTENT RESERVE IN/OUT commands.
70
71 -S, --state=S,S...
72 specifies a comma separated list (one element of more) of
73 states. Either a number or an abbreviation can be given. A num‐
74 ber is assumed to be a decimal number unless it is prefixed by
75 "0x" or has a trailing "h" in which case a hexadecimal value is
76 assumed. Only the values 0, 1, 2, 3 or 14 are accepted. The
77 accepted abbreviations are "an", "ao", "o", "s" or "u"; which
78 represent active/non-optimized(1), active/optimized(0), off‐
79 line(14), standby(2) or unavailable(3) respectively.
80
81 -t, --tp=P,P...
82 specifies a comma separated list (one element of more). Each
83 elements is either a target port group identifier (when the cor‐
84 responding state is other than "offline") or a relative target
85 port identifier (when the corresponding state is "offline").
86 Each element is assumed to be a decimal number unless it is pre‐
87 fixed by "0x" or has a trailing "h" in which case a hexadecimal
88 value is assumed.
89
90 -u, --unavailable
91 set unavailable state. Port group shall only accept INQUIRY,
92 REPORT LUNS, REPORT/SET TARGET PORT GROUPS, REQUEST SENSE and
93 READ/WRITE BUFFER commands.
94
95 -v, --verbose
96 increase the level of verbosity, (i.e. debug output).
97
98 -V, --version
99 print the version string and then exit.
100
102 The SET TARGET PORT GROUPS command should be supported whenever the
103 TPGS value in a standard INQUIRY response is 2 or 3. [View with sg_inq
104 utility.]
105
106 Notice that the offline state is termed as a "secondary target port
107 asymmetric access state" and takes a relative target port identifier
108 (i.e. acts on a single target port). All the other states are termed
109 as "primary target port asymmetric access states" and each takes a tar‐
110 get port group identifier (i.e. acts on one or more target ports).
111
112 When --tp= is given then the same number of elements should be given to
113 the --state= option. If more than one list element is given to --tp=
114 and an equal number of elements is _not_ given to the the --state=
115 option, then if only one state is specified then it is repeated.
116
118 The exit status of sg_stpg is 0 when it is successful. Otherwise see
119 the sg3_utils(8) man page.
120
122 Written by Douglas Gilbert.
123
125 Report bugs to <dgilbert at interlog dot com>.
126
128 Copyright © 2007 Hannes Reinecke, Christophe Varoqui and Douglas
129 Gilbert
130 This software is distributed under a FreeBSD license. There is NO war‐
131 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
132 POSE.
133
135 sg_inq, sg_rtpg (sg3_utils)
136
137
138
139sg3_utils-1.25 September 2007 SG_STPG(8)