{
    "content": [
        {
            "type": "text",
            "text": "# sg_get_lba_status (man)\n\n## NAME\n\nsggetlbastatus - send SCSI GET LBA STATUS(16 or 32) command\n\n## SYNOPSIS\n\nsggetlbastatus  [--16]  [--32]  [--brief] [--element-id=EI] [--help] [--hex]  [--inhex=FN]\n[--lba=LBA] [--maxlen=LEN] [--raw] [--readonly]  [--report-type=RT]  [--scan-len=SL]  [--ver‐\nbose] [--version] DEVICE\n\n## DESCRIPTION\n\nSend  the  SCSI GET LBA STATUS(16) or GET LBA STATUS(32) command to the DEVICE and output the\nresponse. The 16 byte command variant was introduced in (draft) SBC-3 revision 20 and devices\nthat  support  logical block provisioning should support this command. The GET LBA STATUS(32)\ncommand was added in (draft) SBC-4 revision 14.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (15 subsections)\n- **NOTES**\n- **EXIT STATUS**\n- **AUTHORS**\n- **REPORTING BUGS**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "sg_get_lba_status",
        "section": "",
        "mode": "man",
        "summary": "sggetlbastatus - send SCSI GET LBA STATUS(16 or 32) command",
        "synopsis": "sggetlbastatus  [--16]  [--32]  [--brief] [--element-id=EI] [--help] [--hex]  [--inhex=FN]\n[--lba=LBA] [--maxlen=LEN] [--raw] [--readonly]  [--report-type=RT]  [--scan-len=SL]  [--ver‐\nbose] [--version] DEVICE",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "-S",
                "long": "--16",
                "arg": null,
                "description": "send SCSI GET LBA STATUS(16) command which is the 16 byte variant. In the absence of the --16 or the --32 options the SCSI GET LBA STATUS(16) command is sent. If both --16 and the --32 options are given then the GET LBA STATUS(16) command is sent."
            },
            {
                "flag": "-T",
                "long": "--32",
                "arg": null,
                "description": "send SCSI GET LBA STATUS(32) command which is the 32 byte variant. When given together with the --16 option then this option is ignored (so the GET LBA STATUS(16) command is sent)."
            },
            {
                "flag": "-b",
                "long": "--brief",
                "arg": null,
                "description": "when use once then one LBA status descriptor per line is output to stdout. Each line has this format: \"0x<descriptorLBA> 0x<blocks> <provisioningstatus> <addi‐ tionalstatus>\". So the descriptor's starting LBA and number of blocks are output in hex while the provisioning status and additional status are in decimal. When used twice (e.g. '-bb' or '--brief --brief') then the provisioning status of the given LBA (or LBA 0 if the --lba option is not given) is output to stdout. A check is made that the given LBA lies in the range of the first returned LBA status descriptor (as it should according to SBC-3 revision 20) and warnings are sent to stderr if it doesn't."
            },
            {
                "flag": "-e",
                "long": "--element-id",
                "arg": null,
                "description": "where EI is the element identifier of the physical element for which the LBAs shall be reported based on the value in the report type field (i.e. RT). This option is only active with the SCSI GET LBA STATUS(32) command (i.e. it is ignored if the GET LBA STATUS(16) command is sent). Valid element identifiers are non-zero. The default value of EI is 0 which means in the context that no element identifier is specified."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "output the usage message then exit."
            },
            {
                "flag": "-H",
                "long": "--hex",
                "arg": null,
                "description": "output response to this command in ASCII hex."
            },
            {
                "flag": "-i",
                "long": "--inhex",
                "arg": null,
                "description": "where FN is a filename whose contents are assumed to be ASCII hexadecimal bytes. See the \"FORMAT OF FILES CONTAINING ASCII HEX\" section in the sg3utils manpage for more information. If DEVICE is also given then it is ignored. If the --raw option is also given then the contents of FN are treated as binary."
            },
            {
                "flag": "-l",
                "long": "--lba",
                "arg": null,
                "description": "where LBA is the starting Logical Block Address (LBA) to check the provisioning status for. Note that the DEVICE chooses how many following blocks that it will return provi‐ sioning status for."
            },
            {
                "flag": "-m",
                "long": "--maxlen",
                "arg": null,
                "description": "where LEN is the (maximum) response length in bytes. It is placed in the cdb's \"allo‐ cation length\" field. If not given then 24 is used. 24 is enough space for the re‐ sponse header and one LBA status descriptor. LEN should be 8 plus a multiple of 16 (e.g. 24, 40, and 56 are suitable)."
            },
            {
                "flag": "-r",
                "long": "--raw",
                "arg": null,
                "description": "output response in binary (to stdout) unless the --inhex=FN option is also given. In that case the input file name (FN) is decoded as binary (and the output is not in binary)."
            },
            {
                "flag": "-R",
                "long": "--readonly",
                "arg": null,
                "description": "open the DEVICE read-only (e.g. in Unix with the ORDONLY flag). The default is to open it read-write."
            },
            {
                "flag": "-t",
                "long": "--report-type",
                "arg": null,
                "description": "where RT is 0 for report all LBAs; 1 for report LBAs using non-zero provisioning sta‐ tus; 2 for report LBAs that are mapped; 3 for report LBAs that are de-allocated; 4 for report LBAs that are anchored; 16 for report LBAs that may return an unrecovered er‐ ror. The REPORT TYPE field was added to the GET LBA STATUS cdb in sbc4r12. Since the REPORT TYPE field is newer than the command, the response contains the RTP bit to indicate whether or not the DEVICE acts on the REPORT TYE field (set when it does act on it, clear otherwise)."
            },
            {
                "flag": "-s",
                "long": "--scan-len",
                "arg": null,
                "description": "where SL is the scan length which is the maximum number of contiguous logical blocks to be scanned for logical blocks that meet the given report type (i.e. RT). This op‐ tion is only active with the SCSI GET LBA STATUS(32) command (i.e. it is ignored if the GET LBA STATUS(16) command is sent). The default value of SL is 0 which should be interpreted by the DEVICE as there is no limits to the number of LBAs that shall be scanned."
            },
            {
                "flag": "-v",
                "long": "--verbose",
                "arg": null,
                "description": "increase the level of verbosity, (i.e. debug output). Additional output caused by this option is sent to stderr."
            },
            {
                "flag": "-V",
                "long": "--version",
                "arg": null,
                "description": "print the version string and then exit."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "sgwritesame",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/sgwritesame/8/json"
            },
            {
                "name": "sgunmap",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/sgunmap/8/json"
            },
            {
                "name": "sg3utils",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/sg3utils/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "-S --16",
                        "lines": 4,
                        "flag": "-S",
                        "long": "--16"
                    },
                    {
                        "name": "-T --32",
                        "lines": 4,
                        "flag": "-T",
                        "long": "--32"
                    },
                    {
                        "name": "-b --brief",
                        "lines": 9,
                        "flag": "-b",
                        "long": "--brief"
                    },
                    {
                        "name": "-e --element-id",
                        "lines": 7,
                        "flag": "-e",
                        "long": "--element-id"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-H --hex",
                        "lines": 2,
                        "flag": "-H",
                        "long": "--hex"
                    },
                    {
                        "name": "-i --inhex",
                        "lines": 5,
                        "flag": "-i",
                        "long": "--inhex"
                    },
                    {
                        "name": "-l --lba",
                        "lines": 4,
                        "flag": "-l",
                        "long": "--lba"
                    },
                    {
                        "name": "-m --maxlen",
                        "lines": 5,
                        "flag": "-m",
                        "long": "--maxlen"
                    },
                    {
                        "name": "-r --raw",
                        "lines": 4,
                        "flag": "-r",
                        "long": "--raw"
                    },
                    {
                        "name": "-R --readonly",
                        "lines": 3,
                        "flag": "-R",
                        "long": "--readonly"
                    },
                    {
                        "name": "-t --report-type",
                        "lines": 8,
                        "flag": "-t",
                        "long": "--report-type"
                    },
                    {
                        "name": "-s --scan-len",
                        "lines": 7,
                        "flag": "-s",
                        "long": "--scan-len"
                    },
                    {
                        "name": "-v --verbose",
                        "lines": 3,
                        "flag": "-v",
                        "long": "--verbose"
                    },
                    {
                        "name": "-V --version",
                        "lines": 2,
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "NOTES",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "EXIT STATUS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "sggetlbastatus - send SCSI GET LBA STATUS(16 or 32) command\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "sggetlbastatus  [--16]  [--32]  [--brief] [--element-id=EI] [--help] [--hex]  [--inhex=FN]\n[--lba=LBA] [--maxlen=LEN] [--raw] [--readonly]  [--report-type=RT]  [--scan-len=SL]  [--ver‐\nbose] [--version] DEVICE\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Send  the  SCSI GET LBA STATUS(16) or GET LBA STATUS(32) command to the DEVICE and output the\nresponse. The 16 byte command variant was introduced in (draft) SBC-3 revision 20 and devices\nthat  support  logical block provisioning should support this command. The GET LBA STATUS(32)\ncommand was added in (draft) SBC-4 revision 14.\n\nThe default action is to decode the response into one LBA status  descriptor  per  line  then\noutput  a  header  and  the status descriptors to stdout. The descriptor LBA is output in hex\n(prefixed by '0x') and the number of blocks is output in decimal followed by the provisioning\nstatus  and additional status in decimal. The provisioning status can be in the range 0 to 15\nof which only 0 (mapped or unknown), 1 (unmapped), 2 (anchored), 3 (mapped) and  4  (unknown)\nare used currently. The amount of output can be reduced by the --brief option.\n\nRather  than  send  this  SCSI command to DEVICE, if the --inhex=FN option is given, then the\ncontents of the file named FN are decoded as ASCII hex and then processed if it was  the  re‐\nsponse of this command.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "Arguments to long options are mandatory for short options as well.\n",
                "subsections": [
                    {
                        "name": "-S --16",
                        "content": "send  SCSI  GET LBA STATUS(16) command which is the 16 byte variant. In the absence of\nthe --16 or the --32 options the SCSI GET LBA STATUS(16) command is sent. If both --16\nand the --32 options are given then the GET LBA STATUS(16) command is sent.\n",
                        "flag": "-S",
                        "long": "--16"
                    },
                    {
                        "name": "-T --32",
                        "content": "send SCSI GET LBA STATUS(32) command which is the 32 byte variant. When given together\nwith the --16 option then this option is ignored (so the GET LBA STATUS(16) command is\nsent).\n",
                        "flag": "-T",
                        "long": "--32"
                    },
                    {
                        "name": "-b --brief",
                        "content": "when  use once then one LBA status descriptor per line is output to stdout.  Each line\nhas  this  format:  \"0x<descriptorLBA>    0x<blocks>   <provisioningstatus>   <addi‐\ntionalstatus>\".  So  the descriptor's starting LBA and number of blocks are output in\nhex while the provisioning status and additional status  are  in  decimal.  When  used\ntwice  (e.g. '-bb' or '--brief --brief') then the provisioning status of the given LBA\n(or LBA 0 if the --lba option is not given) is output to stdout. A check is made  that\nthe  given  LBA  lies  in the range of the first returned LBA status descriptor (as it\nshould according to SBC-3 revision 20) and warnings are sent to stderr if it doesn't.\n",
                        "flag": "-b",
                        "long": "--brief"
                    },
                    {
                        "name": "-e --element-id",
                        "content": "where EI is the element identifier of the physical element for which the LBAs shall be\nreported  based  on the value in the report type field (i.e.  RT). This option is only\nactive with the SCSI GET LBA STATUS(32) command (i.e. it is ignored  if  the  GET  LBA\nSTATUS(16) command is sent).\nValid  element  identifiers  are non-zero. The default value of EI is 0 which means in\nthe context that no element identifier is specified.\n",
                        "flag": "-e",
                        "long": "--element-id"
                    },
                    {
                        "name": "-h --help",
                        "content": "output the usage message then exit.\n",
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-H --hex",
                        "content": "output response to this command in ASCII hex.\n",
                        "flag": "-H",
                        "long": "--hex"
                    },
                    {
                        "name": "-i --inhex",
                        "content": "where FN is a filename whose contents are assumed to be ASCII hexadecimal  bytes.  See\nthe  \"FORMAT  OF FILES CONTAINING ASCII HEX\" section in the sg3utils manpage for more\ninformation. If DEVICE is also given then it is ignored. If the --raw option  is  also\ngiven then the contents of FN are treated as binary.\n",
                        "flag": "-i",
                        "long": "--inhex"
                    },
                    {
                        "name": "-l --lba",
                        "content": "where LBA is the starting Logical Block Address (LBA) to check the provisioning status\nfor. Note that the DEVICE chooses how many following blocks that it will return provi‐\nsioning status for.\n",
                        "flag": "-l",
                        "long": "--lba"
                    },
                    {
                        "name": "-m --maxlen",
                        "content": "where  LEN is the (maximum) response length in bytes. It is placed in the cdb's \"allo‐\ncation length\" field. If not given then 24 is used. 24 is enough  space  for  the  re‐\nsponse  header  and  one LBA status descriptor.  LEN should be 8 plus a multiple of 16\n(e.g. 24, 40, and 56 are suitable).\n",
                        "flag": "-m",
                        "long": "--maxlen"
                    },
                    {
                        "name": "-r --raw",
                        "content": "output response in binary (to stdout) unless the --inhex=FN option is also  given.  In\nthat  case  the  input file name (FN) is decoded as binary (and the output is not in\nbinary).\n",
                        "flag": "-r",
                        "long": "--raw"
                    },
                    {
                        "name": "-R --readonly",
                        "content": "open the DEVICE read-only (e.g. in Unix with the ORDONLY flag).  The  default  is  to\nopen it read-write.\n",
                        "flag": "-R",
                        "long": "--readonly"
                    },
                    {
                        "name": "-t --report-type",
                        "content": "where  RT is 0 for report all LBAs; 1 for report LBAs using non-zero provisioning sta‐\ntus; 2 for report LBAs that are mapped; 3 for report LBAs that are de-allocated; 4 for\nreport  LBAs  that are anchored; 16 for report LBAs that may return an unrecovered er‐\nror. The REPORT TYPE field was added to the GET LBA STATUS cdb in sbc4r12.\nSince the REPORT TYPE field is newer than the command, the response contains  the  RTP\nbit  to  indicate  whether or not the DEVICE acts on the REPORT TYE field (set when it\ndoes act on it, clear otherwise).\n",
                        "flag": "-t",
                        "long": "--report-type"
                    },
                    {
                        "name": "-s --scan-len",
                        "content": "where SL is the scan length which is the maximum number of contiguous  logical  blocks\nto  be  scanned for logical blocks that meet the given report type (i.e. RT). This op‐\ntion is only active with the SCSI GET LBA STATUS(32) command (i.e. it  is  ignored  if\nthe GET LBA STATUS(16) command is sent).\nThe  default value of SL is 0 which should be interpreted by the DEVICE as there is no\nlimits to the number of LBAs that shall be scanned.\n",
                        "flag": "-s",
                        "long": "--scan-len"
                    },
                    {
                        "name": "-v --verbose",
                        "content": "increase the level of verbosity, (i.e. debug output). Additional output caused by this\noption is sent to stderr.\n",
                        "flag": "-v",
                        "long": "--verbose"
                    },
                    {
                        "name": "-V --version",
                        "content": "print the version string and then exit.\n",
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            "NOTES": {
                "content": "In  SBC-3  revision 25 the calculation associated with the Parameter Data Length field in the\nresponse was modified. Prior to that the byte offset was 8 and in revision 25 it was  changed\nto 4.\n\nFor   a  discussion  of  logical  block  provisioning  see  section  4.7  of  sbc4r14.pdf  at\nhttp://www.t10.org (or the corresponding section of a later draft).\n",
                "subsections": []
            },
            "EXIT STATUS": {
                "content": "The exit status  of  sggetlbastatus  is  0  when  it  is  successful.  Otherwise  see  the\nsg3utils(8) man page.\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 © 2009-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": "sgwritesame(8), sgunmap(8), sg3utils(8)\n\n\n\nsg3utils-1.45                               August 2019                        SGGETLBASTATUS(8)",
                "subsections": []
            }
        }
    }
}