1SG_REASSIGN(8) SG3_UTILS SG_REASSIGN(8)
2
3
4
6 sg_reassign - send SCSI REASSIGN BLOCKS command
7
9 sg_reassign [--address=A,A...] [--dummy] [--eight=0|1] [--grown]
10 [--help] [--hex] [--longlist=0|1] [--primary] [--verbose] [--version]
11 DEVICE
12
14 Send a SCSI REASSIGN BLOCKS command to DEVICE. Alternatively this util‐
15 ity can find the number of element in a "grown" or "primary" defect
16 list with a SCSI READ DEFECT DATA (10) command. These SCSI commands are
17 defined in SBC-2 for direct access devices (e.g. a disk). Reassign
18 blocks is designed to change the physical location of a logical block
19 that is known or suspected to be defective to another area on the
20 media. Disks are typically formatted with blocks held in reserve for
21 this situation.
22
23 If neither the --grown nor --primary option is supplied then one or
24 more addresses need to be given. If the address (or all of the
25 addresses) fit into 4 bytes and '--eight=1' is not given then the
26 parameter block passed to DEVICE is made up of 4 byte logical block
27 addresses. If any of the addresses need more than 4 bytes to represent
28 (i.e. >= 2**32) or '--eight=1' is given then the parameter block passed
29 to DEVICE is made up of 8 byte logical block addresses.
30
32 Arguments to long options are mandatory for short options as well. The
33 options are arranged in alphabetical order based on the long option
34 name.
35
36 -a, --address=A,A...
37 where A,A... is a string of comma separated numbers. Each number
38 is interpreted as decimal unless prefixed by '0x' or '0X' (or it
39 has a trailing 'h' or 'H'). If multiple logical block addresses
40 are given they must be separated by a comma or a (single) space.
41 A string that contains any space separators needs to be quoted.
42 At least one address must be given.
43
44 -a, --address=-
45 reads one or more logical block addresses from stdin. These may
46 be comma, space, tab or linefeed (newline) separated. If a line
47 contains "#" then the remaining characters on that line are
48 ignored. Otherwise each non separator sequence of characters
49 should resolve to a decimal number unless prefixed by '0x' or
50 '0X' (or has a trailing 'h'). At least one address must be
51 given. Lines should not be longer than 1023 bytes.
52
53 -d, --dummy
54 prepare for but do not execute the SCSI REASSIGN BLOCKS command.
55 Since the REASSIGN BLOCKS command is essentially irreversible,
56 paranoid users may wish to check the invocation of this utility
57 before reassigning defective blocks on a disk. Useful with '-vv'
58 for those who wish to view the parameter block that will accom‐
59 pany the command.
60
61 -e, --eight=0 | 1
62 when value is 1 then it sets the 'LONGLBA' flag in the command
63 indicating that the addresses in the associated parameter block
64 are 8 byte quantities. When value is 0 then it clears the
65 'LONGLBA' flag in the command indicating that the addresses in
66 the associated parameter block are 4 byte quantities. If this
67 option is not given then 4 byte quantities are assumed unless
68 one of the address is too large.
69
70 -g, --grown
71 use the SCSI READ DEFECT DATA (10) command to determine the num‐
72 ber of elements in the "grown defect list". When this option is
73 given there is no reassignment of blocks (i.e. this utility is
74 passive). When this option is given then the --address= option
75 is not permitted. See the discussion below concerning the rela‐
76 tionship between reassigned blocks and the grown defect list.
77 This list is sometimes referred to as the GLIST.
78
79 -h, --help
80 output the usage message then exit.
81
82 -H, --hex
83 print response in hex (for -g, --grown, -p or --primary).
84
85 -l, --longlist=0 | 1
86 sets the REASSIGN BLOCKS cdb field of the same name to the given
87 value. Only 1000 addresses are permitted so there should be no
88 need to specify a value of 1. The short list variant restricts
89 the parameter block length to 2 ** 16 bytes (i.e. about 16000 4
90 byte addresses or 8000 8 byte addresses). Added for complete‐
91 ness.
92
93 -p, --primary
94 use the SCSI READ DEFECT DATA (10) command to determine the num‐
95 ber of elements in the "primary defect list" which is estab‐
96 lished during the manufacturing process. When this option is
97 given there is no reassignment of blocks (i.e. this utility is
98 passive). When this option is given then the --address= option
99 is not permitted. This list is sometimes referred to as the
100 PLIST.
101
102 -v, --verbose
103 increase the level of verbosity, (i.e. debug output).
104
105 -V, --version
106 print the version string and then exit.
107
109 Note that if the ARRE field (for reads) and/or the AWRE field (for
110 writes) are set in the "Read Write Error Recovery" mode page then
111 recoverable read and/or write errors cause automatic reassignment of
112 the defective block. The PER bit in the same mode page controls whether
113 a RECOVERED ERROR sense key is reported on not (PER=1 implies do
114 report). Irrespective of the ARRE, AWRE or PER field settings, the
115 error counter log pages reflect any errors (recovered or otherwise).
116 Whenever a block is reassigned, a new entry is added in the "grown"
117 defect list. Apart from doing selftests (see sg_senddiag or smartmon‐
118 tools) regularly, monitoring the grown defect list of a disk is a rea‐
119 sonable metric of its health. If the grown list starts growing quickly
120 that is an ominous sign. The best grown defect lists are empty ones.
121 The number of elements in the grown defect list can be viewed with the
122 --grown option. The contents of the grown defect list can be viewed
123 with the 'sginfo -G' utility.
124
125 If an unrecoverable error is detected at a logical block address then
126 REASSIGN BLOCKS is needed to reassign the block. Also if the ARRE
127 and/or AWRE fields are clear and a recoverable error is detected then
128 the logical block in question may be reassigned with this utility (oth‐
129 erwise the error counter log pages will continually be incremented for
130 each recovered access).
131
132 The number of blocks held in reserve for the purposes of REASSIGN
133 BLOCKS is vendor specific and may well be limited to the zone within
134 the media where the original (defective) block lay. When this number is
135 exhausted subsequent invocations of this utility may result in a sense
136 key of hardware error and an additional sense of 'No defect spare loca‐
137 tion available'. The next step would be to reformat the disk (or get a
138 replacement).
139
140 The SBC-2 draft standard (revision 16) notes that when multiple
141 addresses are given to the SCSI REASSIGN BLOCKS command and there is
142 some failure at one of the later addresses then all addresses prior to
143 that have already be reassigned. Care should be taken in such a case.
144 Re-executing the command with the same addresses will cause the earlier
145 addresses to be reassigned again. At some stage the disk will run out
146 of reserved locations. So unless a large number of addresses are
147 involved it may be safer to reassign them one address at a time.
148
150 The exit status of sg_reassign is 0 when it is successful. Otherwise
151 see the sg3_utils(8) man page.
152
154 Written by Douglas Gilbert.
155
157 Report bugs to <dgilbert at interlog dot com>.
158
160 Copyright © 2005-2019 Douglas Gilbert
161 This software is distributed under a FreeBSD license. There is NO war‐
162 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
163 POSE.
164
166 sg_format,sginfo,sg_senddiag(all in sg3_utils), sdparm(sdparm), smart‐
167 montools(internet, sourceforge)
168
169
170
171sg3_utils-1.45 October 2019 SG_REASSIGN(8)