SG_REASSIGN(8)
π SG_REASSIGN(8) π
the SG3_UTILS manual page, bestie π
β¨ NAME β¨
okay so sg_reassign is the tool that sends a SCSI REASSIGN BLOCKS command π
π¦ SYNOPSIS π¦
sg_reassign [--address=A,A...] [--dummy] [--eight=0|1] [--grown]
[--help] [--hex] [--longlist=0|1] [--primary] [--verbose] [--version]
DEVICE
πΈ DESCRIPTION πΈ
okay so this utility sends a SCSI REASSIGN BLOCKS command to DEVICE π₯ but wait, it can also count the elements in a "grown" or "primary" defect list using a SCSI READ DEFECT DATA (10) command π§ these commands are defined in SBC-2 for direct access devices (think disks) π
reassign blocks is built to move a logical block that is known or suspected to be defective over to a different spot on the media. disks usually come formatted with some spare blocks held in reserve for exactly this moment π«Ά
If neither --grown nor --primary is given, then you NEED to give one or more addresses π if the address (or every single address) fits into 4 bytes and --eight=1 is not used, the parameter block sent to DEVICE is built from 4 byte logical block addresses. if any address needs more than 4 bytes to represent (aka >= 2**32) or you pass --eight=1, then the parameter block is built from 8 byte logical block addresses β¨
π OPTIONS π
Arguments to long options are mandatory for short options as well. the options are arranged in alphabetical order based on the long option name π
-a,--address=A,A...β whereA,A...is a string of comma separated numbers π each number is read as decimal unless it's prefixed by0xor0X(or has a trailinghorH) π¦ if you give multiple logical block addresses they must be separated by a comma or a (single) space π a string with any space separators needs to be quoted π at least one address must be given π«Ά-a,--address=-β reads one or more logical block addresses from stdin π₯ these can be comma, space, tab or linefeed (newline) separated πΈ if a line contains "#" then the rest of that line gets ignored π otherwise each non separator sequence of characters should resolve to a decimal number unless prefixed by0xor0X(or has a trailingh) π at least one address must be given β¨ lines should not be longer than 1023 bytes π-d,--dummyβ prepare for the SCSI REASSIGN BLOCKS command but DO NOT actually run it π ββοΈ since REASSIGN BLOCKS is basically irreversible, paranoid queens may want to double check the invocation before reassigning defective blocks on a disk π pairs well with-vvif you want to peek at the parameter block that will go along with the command π-e,--eight=0 | 1β when the value is 1 it sets the 'LONGLBA' flag in the command, which tells the device the addresses in the parameter block are 8 byte quantities π₯ when the value is 0 it clears the 'LONGLBA' flag, meaning the addresses are 4 byte quantities π if this option isn't given, 4 byte quantities are assumed unless one of the addresses is too large π§-g,--grownβ uses the SCSI READ DEFECT DATA (10) command to find out how many elements are in the "grown defect list" π with this option there is NO reassignment of blocks (this utility is just being passive, bestie) π¦ the--address=option is not permitted when this is given π ββοΈ see the discussion below about how reassigned blocks relate to the grown defect list π this list is sometimes called the GLIST π-h,--helpβ outputs the usage message then exits π-H,--hexβ prints the response in hex (for-g,--grown,-por--primary) π-l,--longlist=0 | 1β sets the REASSIGN BLOCKS cdb field of the same name to the given value π only 1000 addresses are permitted, so there should be no need to specify a value of 1 π the short list variant limits the parameter block length to 2 ** 16 bytes (aka about 16000 4 byte addresses or 8000 8 byte addresses) β¨ this is here for completeness π«Ά-p,--primaryβ uses the SCSI READ DEFECT DATA (10) command to find out how many elements are in the "primary defect list" π this list is established during the manufacturing process π§ with this option there is NO reassignment of blocks (passive again, iykyk) π the--address=option is not permitted when this is given π ββοΈ this list is sometimes called the PLIST πΈ-v,--verboseβ increases the level of verbosity (aka debug output) π-V,--versionβ prints the version string then exits π
π NOTES π
okay bestie, listen up π if the ARRE field (for reads) and/or the AWRE field (for writes) are set in the "Read Write Error Recovery" mode page, then recoverable read and/or write errors cause the defective block to get reassigned automatically β¨ the PER bit in that same mode page controls whether a RECOVERED ERROR sense key gets reported or not (PER=1 means yes, do report) π¦ no matter what the ARRE, AWRE or PER settings are, the error counter log pages still reflect any errors (recovered or otherwise) π whenever a block gets reassigned, a new entry is added to the "grown" defect list π apart from running selftests regularly (see sg_senddiag or smartmontools), keeping an eye on the grown defect list of a disk is a solid metric of its health π«Ά if the grown list starts growing quickly, that is an ominous sign π± the best grown defect lists are empty ones π₯Ί you can check how many elements are in the grown defect list with the --grown option π and you can look at the contents of the grown defect list with the sginfo -G utility π
β οΈ if an unrecoverable error is detected at a logical block address then REASSIGN BLOCKS is needed to reassign the block π also, if the ARRE and/or AWRE fields are clear and a recoverable error is detected, the logical block in question may be reassigned with this utility π (otherwise the error counter log pages will keep getting incremented for each recovered access π)
the number of blocks held in reserve for REASSIGN BLOCKS is vendor specific and may well be limited to the zone within the media where the original (defective) block lived πΈ once that number is used up, later runs of this utility may give you a sense key of hardware error plus an additional sense of 'No defect spare location available' π the next step would be to reformat the disk (or get a replacement) π₯
β οΈ the SBC-2 draft standard (revision 16) notes that when multiple addresses are given to the SCSI REASSIGN BLOCKS command and there's a failure at one of the later addresses, then all the addresses before that have already been reassigned π be careful in that case π re-running the command with the same addresses will reassign the earlier addresses again π± at some stage the disk will run out of reserved locations π₯ so unless a large number of addresses are involved, it may be safer to reassign them one address at a time π§
π EXIT STATUS π
the exit status of sg_reassign is 0 when it is successful π otherwise, see the sg3_utils(8) man page π
π AUTHORS π
Written by Douglas Gilbert π
π REPORTING BUGS π
report bugs to <dgilbert at interlog dot com> π
π COPYRIGHT π
Copyright Β© 2005-2019 Douglas Gilbert this software is distributed under a BSD-2-Clause license π there is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE π ββοΈ
π SEE ALSO π
sg_format, sginfo, sg_senddiag (all in sg3_utils), sdparm (sdparm), smartmontools (internet, sourceforge) β¨
okay that's the whole tea β this was SG_REASSIGN(8) from sg3_utils-1.45, dated October 2019, and it's giving iconic ππ§π¦ stay hydrated and back up your disks, bestie π«Άπ
π¦ where this page comes from
- alpine 3.24: sg3_utils-doc 1.48-r0 Β· BSD-2-Clause AND GPL-2.0-or-later
- arch rolling: sg3_utils 1.49-1 Β· GPL-2.0-or-later AND BSD-2-Clause
- centos-stream 10: sg3_utils 1.48-11.el10 Β· GPL-2.0-or-later AND BSD-2-Clause
- debian trixie: sg3-utils 1.48-3~deb13u1
- fedora 43: sg3_utils 1.48-10.fc43 Β· GPL-2.0-or-later AND BSD-2-Clause
- fedora 43: sg3_utils 1.48-6.fc43 Β· GPL-2.0-or-later AND BSD-2-Clause
- fedora 44: sg3_utils 1.48-10.fc44 Β· GPL-2.0-or-later AND BSD-2-Clause
- fedora 44: sg3_utils 1.48-8.fc44 Β· GPL-2.0-or-later AND BSD-2-Clause
- nixos 26.05: sg3_utils 1.48
- nixpkgs unstable: sg3_utils 1.49
- ubuntu questing: sg3-utils 1.48-2ubuntu1
- ubuntu resolute: sg3-utils 1.48-3ubuntu3
- ubuntu resolute: sg3-utils 1.48-3ubuntu3.2
- ubuntu stonking: sg3-utils 1.48-3ubuntu5
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms