{
    "mode": "man",
    "parameter": "sg_reassign",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/sg_reassign/8/json",
    "generated": "2026-06-16T03:27:48Z",
    "synopsis": "sgreassign   [--address=A,A...]   [--dummy]   [--eight=0|1]   [--grown]   [--help]   [--hex]\n[--longlist=0|1] [--primary] [--verbose] [--version] DEVICE",
    "sections": {
        "NAME": {
            "content": "sgreassign - send SCSI REASSIGN BLOCKS command\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "sgreassign   [--address=A,A...]   [--dummy]   [--eight=0|1]   [--grown]   [--help]   [--hex]\n[--longlist=0|1] [--primary] [--verbose] [--version] DEVICE\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Send a SCSI REASSIGN BLOCKS command to DEVICE. Alternatively this utility can find the number\nof  element  in a \"grown\" or \"primary\" defect list with a SCSI READ DEFECT DATA (10) command.\nThese SCSI commands are defined in SBC-2 for direct access devices (e.g.  a  disk).  Reassign\nblocks  is  designed to change the physical location of a logical block that is known or sus‐\npected to be defective to another area on the  media.  Disks  are  typically  formatted  with\nblocks held in reserve for this situation.\n\nIf neither the --grown nor --primary option is supplied then one or more addresses need to be\ngiven. If the address (or all of the addresses) fit into 4 bytes and '--eight=1' is not given\nthen  the  parameter  block passed to DEVICE is made up of 4 byte logical block addresses. If\nany of the addresses need more than 4 bytes to represent (i.e. >= 232)  or  '--eight=1'  is\ngiven then the parameter block passed to DEVICE is made up of 8 byte logical block addresses.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Arguments  to long options are mandatory for short options as well.  The options are arranged\nin alphabetical order based on the long option name.\n",
            "subsections": [
                {
                    "name": "-a --address",
                    "content": "where A,A... is a string of comma separated numbers. Each  number  is  interpreted  as\ndecimal unless prefixed by '0x' or '0X' (or it has a trailing 'h' or 'H'). If multiple\nlogical block addresses are given they must be separated by  a  comma  or  a  (single)\nspace.  A  string  that contains any space separators needs to be quoted. At least one\naddress must be given.\n",
                    "flag": "-a",
                    "long": "--address"
                },
                {
                    "name": "-a --address",
                    "content": "reads one or more logical block addresses from stdin. These may be comma,  space,  tab\nor  linefeed (newline) separated. If a line contains \"#\" then the remaining characters\non that line are ignored. Otherwise each non separator sequence of  characters  should\nresolve  to  a decimal number unless prefixed by '0x' or '0X' (or has a trailing 'h').\nAt least one address must be given. Lines should not be longer than 1023 bytes.\n",
                    "flag": "-a",
                    "long": "--address"
                },
                {
                    "name": "-d --dummy",
                    "content": "prepare for but do not execute the SCSI REASSIGN BLOCKS command.  Since  the  REASSIGN\nBLOCKS command is essentially irreversible, paranoid users may wish to check the invo‐\ncation of this utility before reassigning defective blocks  on  a  disk.  Useful  with\n'-vv' for those who wish to view the parameter block that will accompany the command.\n",
                    "flag": "-d",
                    "long": "--dummy"
                },
                {
                    "name": "-e --eight",
                    "content": "when value is 1 then it sets the 'LONGLBA' flag in the command indicating that the ad‐\ndresses in the associated parameter block are 8 byte quantities.  When value is 0 then\nit clears the 'LONGLBA' flag in the command indicating that the addresses in the asso‐\nciated parameter block are 4 byte quantities.  If this option is not given then 4 byte\nquantities are assumed unless one of the address is too large.\n",
                    "flag": "-e",
                    "long": "--eight"
                },
                {
                    "name": "-g --grown",
                    "content": "use  the SCSI READ DEFECT DATA (10) command to determine the number of elements in the\n\"grown defect list\". When this option is given there  is  no  reassignment  of  blocks\n(i.e.  this  utility is passive). When this option is given then the --address= option\nis not permitted. See the discussion below concerning the relationship  between  reas‐\nsigned  blocks  and  the  grown defect list. This list is sometimes referred to as the\nGLIST.\n",
                    "flag": "-g",
                    "long": "--grown"
                },
                {
                    "name": "-h --help",
                    "content": "output the usage message then exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-H --hex",
                    "content": "print response in hex (for -g, --grown, -p or --primary).\n",
                    "flag": "-H",
                    "long": "--hex"
                },
                {
                    "name": "-l --longlist",
                    "content": "sets the REASSIGN BLOCKS cdb field of the same name to the given value.  Only 1000 ad‐\ndresses  are  permitted  so there should be no need to specify a value of 1. The short\nlist variant restricts the parameter block length to 2  16 bytes (i.e. about 16000 4\nbyte addresses or 8000 8 byte addresses). Added for completeness.\n",
                    "flag": "-l",
                    "long": "--longlist"
                },
                {
                    "name": "-p --primary",
                    "content": "use  the SCSI READ DEFECT DATA (10) command to determine the number of elements in the\n\"primary defect list\" which is established during the manufacturing process. When this\noption  is  given  there  is no reassignment of blocks (i.e. this utility is passive).\nWhen this option is given then the --address= option is not permitted.  This  list  is\nsometimes referred to as the PLIST.\n",
                    "flag": "-p",
                    "long": "--primary"
                },
                {
                    "name": "-v --verbose",
                    "content": "increase the level of verbosity, (i.e. debug output).\n",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "-V --version",
                    "content": "print the version string and then exit.\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "NOTES": {
            "content": "Note  that  if  the  ARRE field (for reads) and/or the AWRE field (for writes) are set in the\n\"Read Write Error Recovery\" mode page then recoverable read and/or write errors  cause  auto‐\nmatic reassignment of the defective block. The PER bit in the same mode page controls whether\na RECOVERED ERROR sense key is reported on not (PER=1 implies do report). Irrespective of the\nARRE,  AWRE  or PER field settings, the error counter log pages reflect any errors (recovered\nor otherwise). Whenever a block is reassigned, a new entry is added  in  the  \"grown\"  defect\nlist. Apart from doing selftests (see sgsenddiag or smartmontools) regularly, monitoring the\ngrown defect list of a disk is a reasonable metric of its health. If the  grown  list  starts\ngrowing quickly that is an ominous sign. The best grown defect lists are empty ones. The num‐\nber of elements in the grown defect list can be viewed with the --grown option. The  contents\nof the grown defect list can be viewed with the 'sginfo -G' utility.\n\nIf  an  unrecoverable  error  is  detected at a logical block address then REASSIGN BLOCKS is\nneeded to reassign the block. Also if the ARRE and/or AWRE fields are clear and a recoverable\nerror  is  detected  then  the  logical block in question may be reassigned with this utility\n(otherwise the error counter log pages will continually be incremented for each recovered ac‐\ncess).\n\nThe  number  of blocks held in reserve for the purposes of REASSIGN BLOCKS is vendor specific\nand may well be limited to the zone within the media where  the  original  (defective)  block\nlay.  When  this  number  is exhausted subsequent invocations of this utility may result in a\nsense key of hardware error and an additional sense of 'No defect spare location  available'.\nThe next step would be to reformat the disk (or get a replacement).\n\nThe  SBC-2  draft  standard (revision 16) notes that when multiple addresses are given to the\nSCSI REASSIGN BLOCKS command and there is some failure at one of the later addresses then all\naddresses  prior  to  that  have  already be reassigned. Care should be taken in such a case.\nRe-executing the command with the same addresses will cause the earlier addresses to be reas‐\nsigned  again.  At some stage the disk will run out of reserved locations.  So unless a large\nnumber of addresses are involved it may be safer to reassign them one address at a time.\n",
            "subsections": []
        },
        "EXIT STATUS": {
            "content": "The exit status of sgreassign is 0 when it is successful. Otherwise see the sg3utils(8) man\npage.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Written by Douglas Gilbert.\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "Report bugs to <dgilbert at interlog dot com>.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright © 2005-2019 Douglas Gilbert\nThis software is distributed under a FreeBSD license. There is NO warranty; not even for MER‐\nCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "sgformat,sginfo,sgsenddiag(all  in  sg3utils),   sdparm(sdparm),   smartmontools(internet,",
            "subsections": [
                {
                    "name": "sourceforge)",
                    "content": "sg3utils-1.45                              October 2019                              SGREASSIGN(8)"
                }
            ]
        }
    },
    "summary": "sgreassign - send SCSI REASSIGN BLOCKS command",
    "flags": [
        {
            "flag": "-a",
            "long": "--address",
            "arg": null,
            "description": "where A,A... is a string of comma separated numbers. Each number is interpreted as decimal unless prefixed by '0x' or '0X' (or it has a trailing 'h' or 'H'). If multiple logical block addresses are given they must be separated by a comma or a (single) space. A string that contains any space separators needs to be quoted. At least one address must be given."
        },
        {
            "flag": "-a",
            "long": "--address",
            "arg": null,
            "description": "reads one or more logical block addresses from stdin. These may be comma, space, tab or linefeed (newline) separated. If a line contains \"#\" then the remaining characters on that line are ignored. Otherwise each non separator sequence of characters should resolve to a decimal number unless prefixed by '0x' or '0X' (or has a trailing 'h'). At least one address must be given. Lines should not be longer than 1023 bytes."
        },
        {
            "flag": "-d",
            "long": "--dummy",
            "arg": null,
            "description": "prepare for but do not execute the SCSI REASSIGN BLOCKS command. Since the REASSIGN BLOCKS command is essentially irreversible, paranoid users may wish to check the invo‐ cation of this utility before reassigning defective blocks on a disk. Useful with '-vv' for those who wish to view the parameter block that will accompany the command."
        },
        {
            "flag": "-e",
            "long": "--eight",
            "arg": null,
            "description": "when value is 1 then it sets the 'LONGLBA' flag in the command indicating that the ad‐ dresses in the associated parameter block are 8 byte quantities. When value is 0 then it clears the 'LONGLBA' flag in the command indicating that the addresses in the asso‐ ciated parameter block are 4 byte quantities. If this option is not given then 4 byte quantities are assumed unless one of the address is too large."
        },
        {
            "flag": "-g",
            "long": "--grown",
            "arg": null,
            "description": "use the SCSI READ DEFECT DATA (10) command to determine the number of elements in the \"grown defect list\". When this option is given there is no reassignment of blocks (i.e. this utility is passive). When this option is given then the --address= option is not permitted. See the discussion below concerning the relationship between reas‐ signed blocks and the grown defect list. This list is sometimes referred to as the GLIST."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "output the usage message then exit."
        },
        {
            "flag": "-H",
            "long": "--hex",
            "arg": null,
            "description": "print response in hex (for -g, --grown, -p or --primary)."
        },
        {
            "flag": "-l",
            "long": "--longlist",
            "arg": null,
            "description": "sets the REASSIGN BLOCKS cdb field of the same name to the given value. Only 1000 ad‐ dresses are permitted so there should be no need to specify a value of 1. The short list variant restricts the parameter block length to 2 16 bytes (i.e. about 16000 4 byte addresses or 8000 8 byte addresses). Added for completeness."
        },
        {
            "flag": "-p",
            "long": "--primary",
            "arg": null,
            "description": "use the SCSI READ DEFECT DATA (10) command to determine the number of elements in the \"primary defect list\" which is established during the manufacturing process. When this option is given there is no reassignment of blocks (i.e. this utility is passive). When this option is given then the --address= option is not permitted. This list is sometimes referred to as the PLIST."
        },
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "increase the level of verbosity, (i.e. debug output)."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "print the version string and then exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "sdparm",
            "section": "sdparm",
            "url": "https://www.chedong.com/phpMan.php/man/sdparm/sdparm/json"
        }
    ]
}