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. At least one
38 address must be given.
39
40 -a, --address=-
41 reads one or more logical block addresses from stdin. These may
42 be comma, space, tab or linefeed (newline) separated. If a line
43 contains "#" then the remaining characters on that line are
44 ignored. Otherwise each non separator sequence of characters
45 should resolve to a decimal number unless prefixed by '0x' or
46 '0X' (or has a trailing 'h'). At least one address must be
47 given.
48
49 -d, --dummy
50 prepare for but do not execute the SCSI REASSIGN BLOCKS command.
51 Since the REASSIGN BLOCKS command is essentially irreversible,
52 paranoid users may wish to check the invocation of this utility
53 before reassigning defective blocks on a disk. Useful with '-vv'
54 for those who wish to view the parameter block that will accom‐
55 pany the command.
56
57 -e, --eight=0 | 1
58 when value is 1 then it sets the 'LONGLBA' flag in the command
59 indicating that the addresses in the associated parameter block
60 are 8 byte quantities. When value is 0 then it clears the
61 'LONGLBA' flag in the command indicating that the addresses in
62 the associated parameter block are 4 byte quantities. If this
63 option is not given then 4 byte quantities are assumed unless
64 one of the address is too large.
65
66 -g, --grown
67 use the SCSI READ DEFECT DATA (10) command to determine the num‐
68 ber of elements in the "grown defect list". When this option is
69 given there is no reassignment of blocks (i.e. this utility is
70 passive). When this option is given then the --address= option
71 is not permitted. See the discussion below concerning the rela‐
72 tionship between reassigned blocks and the grown defect list.
73 This list is sometimes referred to as the GLIST.
74
75 -h, --help
76 output the usage message then exit.
77
78 -l, --longlist=0 | 1
79 sets the REASSIGN BLOCKS cdb field of the same name to the given
80 value. Only 1000 addresses are permitted so there should be no
81 need to specify a value of 1. The short list variant restricts
82 the parameter block length to 2 ** 16 bytes (i.e. about 16000 4
83 byte addresses or 8000 8 byte addresses). Added for complete‐
84 ness.
85
86 -p, --primary
87 use the SCSI READ DEFECT DATA (10) command to determine the num‐
88 ber of elements in the "primary defect list" which is estab‐
89 lished during the manufacturing process. When this option is
90 given there is no reassignment of blocks (i.e. this utility is
91 passive). When this option is given then the --address= option
92 is not permitted. This list is sometimes referred to as the
93 PLIST.
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 Note that if the ARRE field (for reads) and/or the AWRE field (for
103 writes) are set in the "Read Write Error Recovery" mode page then
104 recoverable read and/or write errors cause automatic reassignment of
105 the defective block. The PER bit in the same mode page controls whether
106 a RECOVERED ERROR sense key is reported on not (PER=1 implies do
107 report). Irrespective of the ARRE, AWRE or PER field settings, the
108 error counter log pages reflect any errors (recovered or otherwise).
109 Whenever a block is reassigned, a new entry is added in the "grown"
110 defect list. Apart from doing selftests (see sg_senddiag or smartmon‐
111 tools) regularly, monitoring the grown defect list of a disk is a rea‐
112 sonable metric of its health. If the grown list starts growing quickly
113 that is an ominous sign. The best grown defect lists are empty ones.
114 The number of elements in the grown defect list can be viewed with the
115 --grown option. The contents of the grown defect list can be viewed
116 with the 'sginfo -G' utility.
117
118 If an unrecoverable error is detected at a logical block address then
119 REASSIGN BLOCKS is needed to reassign the block. Also if the ARRE
120 and/or AWRE fields are clear and a recoverable error is detected then
121 the logical block in question may be reassigned with this utility (oth‐
122 erwise the error counter log pages will continually be incremented for
123 each recovered access).
124
125 The number of blocks held in reserve for the purposes of REASSIGN
126 BLOCKS is vendor specific and may well be limited to the zone within
127 the media where the original (defective) block lay. When this number is
128 exhausted subsequent invocations of this utility may result in a sense
129 key of hardware error and an additional sense of 'No defect spare loca‐
130 tion available'. The next step would be to reformat the disk (or get a
131 replacement).
132
133 The SBC-2 draft standard (revision 16) notes that when multiple
134 addresses are given to the SCSI REASSIGN BLOCKS command and there is
135 some failure at one of the later addresses then all addresses prior to
136 that have already be reassigned. Care should be taken in such a case.
137 Re-executing the command with the same addresses will cause the earlier
138 addresses to be reassigned again. At some stage the disk will run out
139 of reserved locations. So unless a large number of addresses are
140 involved it may be safer to reassign them one address at a time.
141
143 The exit status of sg_reassign is 0 when it is successful. Otherwise
144 see the sg3_utils(8) man page.
145
147 Written by Douglas Gilbert.
148
150 Report bugs to <dgilbert at interlog dot com>.
151
153 Copyright © 2005-2007 Douglas Gilbert
154 This software is distributed under a FreeBSD license. There is NO war‐
155 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
156 POSE.
157
159 sg_format,sginfo,sg_senddiag(all in sg3_utils), sdparm(sdparm), smart‐
160 montools(internet, sourceforge)
161
162
163
164sg3_utils-1.23 January 2007 SG_REASSIGN(8)