1SG_GET_LBA_STATUS(8) SG3_UTILS SG_GET_LBA_STATUS(8)
2
3
4
6 sg_get_lba_status - send SCSI GET LBA STATUS(16 or 32) command
7
9 sg_get_lba_status [--16] [--32] [--brief] [--element-id=EI] [--help]
10 [--hex] [--inhex=FN] [--lba=LBA] [--maxlen=LEN] [--raw] [--readonly]
11 [--report-type=RT] [--scan-len=SL] [--verbose] [--version] DEVICE
12
14 Send the SCSI GET LBA STATUS(16) or GET LBA STATUS(32) command to the
15 DEVICE and output the response. The 16 byte command variant was intro‐
16 duced in (draft) SBC-3 revision 20 and devices that support logical
17 block provisioning should support this command. The GET LBA STATUS(32)
18 command was added in (draft) SBC-4 revision 14.
19
20 The default action is to decode the response into one LBA status
21 descriptor per line then output a header and the status descriptors to
22 stdout. The descriptor LBA is output in hex (prefixed by '0x') and the
23 number of blocks is output in decimal followed by the provisioning sta‐
24 tus and additional status in decimal. The provisioning status can be in
25 the range 0 to 15 of which only 0 (mapped or unknown), 1 (unmapped), 2
26 (anchored), 3 (mapped) and 4 (unknown) are used currently. The amount
27 of output can be reduced by the --brief option.
28
29 Rather than send this SCSI command to DEVICE, if the --inhex=FN option
30 is given, then the contents of the file named FN are decoded as ASCII
31 hex and then processed if it was the response of this command.
32
34 Arguments to long options are mandatory for short options as well.
35
36 -S, --16
37 send SCSI GET LBA STATUS(16) command which is the 16 byte vari‐
38 ant. In the absence of the --16 or the --32 options the SCSI GET
39 LBA STATUS(16) command is sent. If both --16 and the --32
40 options are given then the GET LBA STATUS(16) command is sent.
41
42 -T, --32
43 send SCSI GET LBA STATUS(32) command which is the 32 byte vari‐
44 ant. When given together with the --16 option then this option
45 is ignored (so the GET LBA STATUS(16) command is sent).
46
47 -b, --brief
48 when use once then one LBA status descriptor per line is output
49 to stdout. Each line has this format: "0x<descriptor_LBA>
50 0x<blocks> <provisioning_status> <additional_status>". So the
51 descriptor's starting LBA and number of blocks are output in hex
52 while the provisioning status and additional status are in deci‐
53 mal. When used twice (e.g. '-bb' or '--brief --brief') then the
54 provisioning status of the given LBA (or LBA 0 if the --lba
55 option is not given) is output to stdout. A check is made that
56 the given LBA lies in the range of the first returned LBA status
57 descriptor (as it should according to SBC-3 revision 20) and
58 warnings are sent to stderr if it doesn't.
59
60 -e, --element-id=EI
61 where EI is the element identifier of the physical element for
62 which the LBAs shall be reported based on the value in the
63 report type field (i.e. RT). This option is only active with
64 the SCSI GET LBA STATUS(32) command (i.e. it is ignored if the
65 GET LBA STATUS(16) command is sent).
66 Valid element identifiers are non-zero. The default value of EI
67 is 0 which means in the context that no element identifier is
68 specified.
69
70 -h, --help
71 output the usage message then exit.
72
73 -H, --hex
74 output response to this command in ASCII hex.
75
76 -i, --inhex=FN
77 where FN is a filename whose contents are assumed to be ASCII
78 hexadecimal bytes. See the "FORMAT OF FILES CONTAINING ASCII
79 HEX" section in the sg3_utils manpage for more information. If
80 DEVICE is also given then it is ignored. If the --raw option is
81 also given then the contents of FN are treated as binary.
82
83 -l, --lba=LBA
84 where LBA is the starting Logical Block Address (LBA) to check
85 the provisioning status for. Note that the DEVICE chooses how
86 many following blocks that it will return provisioning status
87 for.
88
89 -m, --maxlen=LEN
90 where LEN is the (maximum) response length in bytes. It is
91 placed in the cdb's "allocation length" field. If not given then
92 24 is used. 24 is enough space for the response header and one
93 LBA status descriptor. LEN should be 8 plus a multiple of 16
94 (e.g. 24, 40, and 56 are suitable).
95
96 -r, --raw
97 output response in binary (to stdout) unless the --inhex=FN
98 option is also given. In that case the input file name (FN) is
99 decoded as binary (and the output is _not_ in binary).
100
101 -R, --readonly
102 open the DEVICE read-only (e.g. in Unix with the O_RDONLY flag).
103 The default is to open it read-write.
104
105 -t, --report-type=RT
106 where RT is 0 for report all LBAs; 1 for report LBAs using
107 non-zero provisioning status; 2 for report LBAs that are mapped;
108 3 for report LBAs that are de-allocated; 4 for report LBAs that
109 are anchored; 16 for report LBAs that may return an unrecovered
110 error. The REPORT TYPE field was added to the GET LBA STATUS cdb
111 in sbc4r12.
112 Since the REPORT TYPE field is newer than the command, the
113 response contains the RTP bit to indicate whether or not the
114 DEVICE acts on the REPORT TYE field (set when it does act on it,
115 clear otherwise).
116
117 -s, --scan-len=SL
118 where SL is the scan length which is the maximum number of con‐
119 tiguous logical blocks to be scanned for logical blocks that
120 meet the given report type (i.e. RT). This option is only active
121 with the SCSI GET LBA STATUS(32) command (i.e. it is ignored if
122 the GET LBA STATUS(16) command is sent).
123 The default value of SL is 0 which should be interpreted by the
124 DEVICE as there is no limits to the number of LBAs that shall be
125 scanned.
126
127 -v, --verbose
128 increase the level of verbosity, (i.e. debug output). Additional
129 output caused by this option is sent to stderr.
130
131 -V, --version
132 print the version string and then exit.
133
135 In SBC-3 revision 25 the calculation associated with the Parameter Data
136 Length field in the response was modified. Prior to that the byte off‐
137 set was 8 and in revision 25 it was changed to 4.
138
139 For a discussion of logical block provisioning see section 4.7 of
140 sbc4r14.pdf at http://www.t10.org (or the corresponding section of a
141 later draft).
142
144 The exit status of sg_get_lba_status is 0 when it is successful. Other‐
145 wise see the sg3_utils(8) man page.
146
148 Written by Douglas Gilbert.
149
151 Report bugs to <dgilbert at interlog dot com>.
152
154 Copyright © 2009-2019 Douglas Gilbert
155 This software is distributed under a FreeBSD license. There is NO war‐
156 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
157 POSE.
158
160 sg_write_same(8), sg_unmap(8), sg3_utils(8)
161
162
163
164sg3_utils-1.45 August 2019 SG_GET_LBA_STATUS(8)