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