{
    "mode": "man",
    "parameter": "sg_read_buffer",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/sg_read_buffer/8/json",
    "generated": "2026-06-10T16:08:30Z",
    "synopsis": "sgreadbuffer  [--help]  [--hex]  [--id=ID]  [--inhex=FN] [--length=LEN] [--mode=MO] [--off‐\nset=OFF] [--raw] [--readonly] [--specific=MS] [--verbose] [--version] DEVICE",
    "sections": {
        "NAME": {
            "content": "sgreadbuffer - send SCSI READ BUFFER command\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "sgreadbuffer  [--help]  [--hex]  [--id=ID]  [--inhex=FN] [--length=LEN] [--mode=MO] [--off‐\nset=OFF] [--raw] [--readonly] [--specific=MS] [--verbose] [--version] DEVICE\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Sends a SCSI READ BUFFER command to the DEVICE, and if there is a response either decodes it,\nprints  it  in  hexadecimal  or sends it in binary to stdout. If a response is received for a\n\"descriptor\" mode then, in the absence of --hex  and  --raw,  it  is  decoded.  Response  for\nnon-descriptor modes are output in hexadecimal unless the --raw option is given.\n\nThis  utility  may be called without a DEVICE but with a --inhex=FN option instead. FN is ex‐\npected to be a file name (or '-' for stdin). The contents of the file (or  stdin  stream)  is\nassumed  to  be  hexadecimal  (or binary) data that represents a SCSI READ BUFFER command re‐\nsponse and is decoded as such.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Arguments to long options are mandatory for short options as well.\n",
            "subsections": [
                {
                    "name": "-h --help",
                    "content": "output the usage message then exit. If used multiple times also prints the mode  names\nand their acronyms.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-H --hex",
                    "content": "output  the  response  in  hexadecimal. When given twice the response is output in hex\nwith the corresponding representation in ASCII to the right of each line.\n",
                    "flag": "-H",
                    "long": "--hex"
                },
                {
                    "name": "-i --id",
                    "content": "this option sets the buffer id field in the cdb. ID is a value between 0 (default) and\n255 inclusive.\n",
                    "flag": "-i",
                    "long": "--id"
                },
                {
                    "name": "-I --inhex",
                    "content": "FN  is  expected to be a file name (or '-' for stdin) which contains ASCII hexadecimal\nor binary representing a READ BUFFER response. If known this utility will then  decode\nthat  response.  It  is  preferable to also supply the --mode=MO and --specific=MS op‐\ntions, since these are not present in the response. The hexadecimal should be arranged\nas  1  or 2 digits representing a byte each of which is whitespace or comma separated.\nAnything from and including a hash mark to the end of line is ignored.  If  the  --raw\noption is also given then FN is treated as binary.\n",
                    "flag": "-I",
                    "long": "--inhex"
                },
                {
                    "name": "-l --length",
                    "content": "where  LEN is the length, in bytes, that is placed in the \"allocation length\" field in\nthe cdb. The default value is 4 (bytes). The device may respond with less bytes.\n",
                    "flag": "-l",
                    "long": "--length"
                },
                {
                    "name": "-m --mode",
                    "content": "this option sets the mode field in the cdb. MO is a value between 0 (default)  and  31\ninclusive.  Alternatively  an abbreviation can be given.  See the MODES section below.\nTo list the available mode abbreviations use an invalid one (e.g. '--mode=xxx'). As an\nexample, to fetch the read buffer descriptor give '--mode=desc' .\n",
                    "flag": "-m",
                    "long": "--mode"
                },
                {
                    "name": "-o --offset",
                    "content": "this  option  sets  the  buffer offset field in the cdb. OFF is a value between 0 (de‐\nfault) and 224-1 . It is a byte offset.\n",
                    "flag": "-o",
                    "long": "--offset"
                },
                {
                    "name": "-r --raw",
                    "content": "if a response is received then it is sent in binary to stdout.\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": "-S --specific",
                    "content": "this  option sets the mode specific field in the cdb. MS is a value between 0 and 7 as\nthis is a 3 bit field.\n",
                    "flag": "-S",
                    "long": "--specific"
                },
                {
                    "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"
                }
            ]
        },
        "MODES": {
            "content": "Following is a list of READ BUFFER command settings for the MODE field.  First is an  acronym\naccepted  by  the  MO argument of this utility.  Following the acronym in square brackets are\nthe corresponding decimal and hex values that may also be given for  MO.  The  following  are\nlisted in numerical order.\n\nhd  [0, 0x0]\nCombined header and data (obsolete in SPC-4).\n\nvendor  [1, 0x1]\nVendor specific.\n\ndata  [2, 0x2]\nData.\n\ndesc  [3, 0x3]\nDescriptor:  yields  4 bytes that contain an offset boundary field (1 byte) and buffer\ncapacity (3 bytes).\n\necho  [10, 0xa]\nRead data from echo buffer (was called \"Echo buffer\" in SPC-3).\n\nechodesc  [11, 0xb]\nEcho buffer descriptor: yields 4 bytes of which the last (lowest)  13  bits  represent\nthe echo buffer capacity. The maximum echo buffer size is 4096 bytes.\n\nrdmicrocst  [15, 0xf]\nRead microcode status. Added in spc5r20 .\n\nenex  [26, 0x1a]\nEnable expander communications protocol and Echo buffer. Made obsolete in SPC-4.\n\nerrhist  [28, 0x1c]\nError history. Introduced in SPC-4.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "All numbers given with options are assumed to be decimal.  Alternatively numerical values can\nbe given in hexadecimal preceded by either \"0x\" or \"0X\" (or has a trailing \"h\" or \"H\").\n",
            "subsections": []
        },
        "EXIT STATUS": {
            "content": "The exit status of sgreadbuffer is 0 when it is successful. Otherwise see the  sg3utils(8)\nman page.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Written by Luben Tuikov and Douglas Gilbert.\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "Report bugs to <dgilbert at interlog dot com>.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright © 2006-2019 Luben Tuikov and 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": "sgwritebuffer(sg3utils)\n\n\n\nsg3utils-1.45                                May 2019                             SGREADBUFFER(8)",
            "subsections": []
        }
    },
    "summary": "sgreadbuffer - send SCSI READ BUFFER command",
    "flags": [
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "output the usage message then exit. If used multiple times also prints the mode names and their acronyms."
        },
        {
            "flag": "-H",
            "long": "--hex",
            "arg": null,
            "description": "output the response in hexadecimal. When given twice the response is output in hex with the corresponding representation in ASCII to the right of each line."
        },
        {
            "flag": "-i",
            "long": "--id",
            "arg": null,
            "description": "this option sets the buffer id field in the cdb. ID is a value between 0 (default) and 255 inclusive."
        },
        {
            "flag": "-I",
            "long": "--inhex",
            "arg": null,
            "description": "FN is expected to be a file name (or '-' for stdin) which contains ASCII hexadecimal or binary representing a READ BUFFER response. If known this utility will then decode that response. It is preferable to also supply the --mode=MO and --specific=MS op‐ tions, since these are not present in the response. The hexadecimal should be arranged as 1 or 2 digits representing a byte each of which is whitespace or comma separated. Anything from and including a hash mark to the end of line is ignored. If the --raw option is also given then FN is treated as binary."
        },
        {
            "flag": "-l",
            "long": "--length",
            "arg": null,
            "description": "where LEN is the length, in bytes, that is placed in the \"allocation length\" field in the cdb. The default value is 4 (bytes). The device may respond with less bytes."
        },
        {
            "flag": "-m",
            "long": "--mode",
            "arg": null,
            "description": "this option sets the mode field in the cdb. MO is a value between 0 (default) and 31 inclusive. Alternatively an abbreviation can be given. See the MODES section below. To list the available mode abbreviations use an invalid one (e.g. '--mode=xxx'). As an example, to fetch the read buffer descriptor give '--mode=desc' ."
        },
        {
            "flag": "-o",
            "long": "--offset",
            "arg": null,
            "description": "this option sets the buffer offset field in the cdb. OFF is a value between 0 (de‐ fault) and 224-1 . It is a byte offset."
        },
        {
            "flag": "-r",
            "long": "--raw",
            "arg": null,
            "description": "if a response is received then it is sent in binary to stdout."
        },
        {
            "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": "-S",
            "long": "--specific",
            "arg": null,
            "description": "this option sets the mode specific field in the cdb. MS is a value between 0 and 7 as this is a 3 bit field."
        },
        {
            "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": "sgwritebuffer",
            "section": "sg3utils",
            "url": "https://www.chedong.com/phpMan.php/man/sgwritebuffer/sg3utils/json"
        }
    ]
}