{
    "content": [
        {
            "type": "text",
            "text": "# sg_read_long (man)\n\n## NAME\n\nsgreadlong - send a SCSI READ LONG command\n\n## SYNOPSIS\n\nsgreadlong  [--16]  [--correct]  [--help]  [--lba=LBA]  [--out=OF]  [--pblock] [--readonly]\n[--verbose] [--version] [--xferlen=BTL] DEVICE\n\n## DESCRIPTION\n\nSend SCSI READ LONG command to DEVICE. The read buffer is output in hex and ASCII  to  stdout\nor  placed  in a file. Note that the data returned includes the logical block data (typically\n512 bytes for a disk) plus ECC information (whose  format  is  proprietary)  plus  optionally\nother proprietary data. Note that the logical block data may be encoded or encrypted.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (10 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_read_long",
        "section": "",
        "mode": "man",
        "summary": "sgreadlong - send a SCSI READ LONG command",
        "synopsis": "sgreadlong  [--16]  [--correct]  [--help]  [--lba=LBA]  [--out=OF]  [--pblock] [--readonly]\n[--verbose] [--version] [--xferlen=BTL] DEVICE",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "-S",
                "long": "--16",
                "arg": null,
                "description": "uses a SCSI READ LONG(16) command. The default action is to use a SCSI READ LONG(10) command. The READ LONG(10) command has a 32 bit field for the lba while READ LONG(16) has a 64 bit field."
            },
            {
                "flag": "-c",
                "long": "--correct",
                "arg": null,
                "description": "sets the 'CORRCT' bit in the SCSI READ LONG command. When set the data is corrected by the ECC before being transferred back to this utility. The default is to leave the 'CORRCT' bit clear in which case the data is not corrected."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "output the usage message then exit."
            },
            {
                "flag": "-l",
                "long": "--lba",
                "arg": null,
                "description": "where LBA is the logical block address of the sector to read. Assumed to be in decimal unless prefixed with '0x' (or has a trailing 'h'). Defaults to lba 0. If the lba is larger than can fit in 32 bits then the --16 option should be used."
            },
            {
                "flag": "-o",
                "long": "--out",
                "arg": null,
                "description": "instead of outputting ASCII hex to stdout, send it in binary to the file called OF. If '-' is given for OF then the (binary) output is sent to stdout. Note that all informa‐ tive and error output is sent to stderr."
            },
            {
                "flag": "-p",
                "long": "--pblock",
                "arg": null,
                "description": "sets the 'PBLOCK' bit in the SCSI READ LONG command. When set the physical block (plus ECC data) containing the requested logical block address is read. The default is to leave the 'PBLOCK' bit clear in which case the logical block (plus any ECC data) is read."
            },
            {
                "flag": "-r",
                "long": "--readonly",
                "arg": null,
                "description": "opens the DEVICE read-only rather than read-write which is the default. The Linux sg driver needs read-write access for the SCSI READ LONG command but other access methods may require read-only access."
            },
            {
                "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."
            },
            {
                "flag": "-x",
                "long": "--xfer",
                "arg": null,
                "description": "where BTL is the byte transfer length (default to 520). If the given value (or the de‐ fault) does not match the \"long\" block size of the device, the appropriate BTL is de‐ duced from the error response and printed (to stderr). The idea is that the user will retry this utility with the correct transfer length."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "-S --16",
                        "lines": 4,
                        "flag": "-S",
                        "long": "--16"
                    },
                    {
                        "name": "-c --correct",
                        "lines": 4,
                        "flag": "-c",
                        "long": "--correct"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-l --lba",
                        "lines": 4,
                        "flag": "-l",
                        "long": "--lba"
                    },
                    {
                        "name": "-o --out",
                        "lines": 4,
                        "flag": "-o",
                        "long": "--out"
                    },
                    {
                        "name": "-p --pblock",
                        "lines": 5,
                        "flag": "-p",
                        "long": "--pblock"
                    },
                    {
                        "name": "-r --readonly",
                        "lines": 4,
                        "flag": "-r",
                        "long": "--readonly"
                    },
                    {
                        "name": "-v --verbose",
                        "lines": 2,
                        "flag": "-v",
                        "long": "--verbose"
                    },
                    {
                        "name": "-V --version",
                        "lines": 2,
                        "flag": "-V",
                        "long": "--version"
                    },
                    {
                        "name": "-x --xfer",
                        "lines": 5,
                        "flag": "-x",
                        "long": "--xfer"
                    }
                ]
            },
            {
                "name": "NOTES",
                "lines": 12,
                "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": "sgreadlong - send a SCSI READ LONG command\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "sgreadlong  [--16]  [--correct]  [--help]  [--lba=LBA]  [--out=OF]  [--pblock] [--readonly]\n[--verbose] [--version] [--xferlen=BTL] DEVICE\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Send SCSI READ LONG command to DEVICE. The read buffer is output in hex and ASCII  to  stdout\nor  placed  in a file. Note that the data returned includes the logical block data (typically\n512 bytes for a disk) plus ECC information (whose  format  is  proprietary)  plus  optionally\nother proprietary data. Note that the logical block data may be encoded or encrypted.\n\nIn  SBC-4  revision 7 the SCSI READ LONG (10 and 16 byte) commands were made obsolete. In the\nsame revision all uses of SCSI WRITE LONG (10 and 16 byte) commands were made obsolete  apart\nfrom the case in which the WRUNCOR bit is set.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "Arguments to long options are mandatory for short options as well.\n",
                "subsections": [
                    {
                        "name": "-S --16",
                        "content": "uses  a  SCSI READ LONG(16) command. The default action is to use a SCSI READ LONG(10)\ncommand. The READ LONG(10) command has a 32 bit field for the lba while READ  LONG(16)\nhas a 64 bit field.\n",
                        "flag": "-S",
                        "long": "--16"
                    },
                    {
                        "name": "-c --correct",
                        "content": "sets the 'CORRCT' bit in the SCSI READ LONG command. When set the data is corrected by\nthe ECC before being transferred back to this utility. The default  is  to  leave  the\n'CORRCT' bit clear in which case the data is not corrected.\n",
                        "flag": "-c",
                        "long": "--correct"
                    },
                    {
                        "name": "-h --help",
                        "content": "output the usage message then exit.\n",
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-l --lba",
                        "content": "where LBA is the logical block address of the sector to read. Assumed to be in decimal\nunless prefixed with '0x' (or has a trailing 'h'). Defaults to lba 0. If  the  lba  is\nlarger than can fit in 32 bits then the --16 option should be used.\n",
                        "flag": "-l",
                        "long": "--lba"
                    },
                    {
                        "name": "-o --out",
                        "content": "instead of outputting ASCII hex to stdout, send it in binary to the file called OF. If\n'-' is given for OF then the (binary) output is sent to stdout. Note that all informa‐\ntive and error output is sent to stderr.\n",
                        "flag": "-o",
                        "long": "--out"
                    },
                    {
                        "name": "-p --pblock",
                        "content": "sets the 'PBLOCK' bit in the SCSI READ LONG command. When set the physical block (plus\nECC data) containing the requested logical block address is read. The  default  is  to\nleave  the  'PBLOCK'  bit clear in which case the logical block (plus any ECC data) is\nread.\n",
                        "flag": "-p",
                        "long": "--pblock"
                    },
                    {
                        "name": "-r --readonly",
                        "content": "opens the DEVICE read-only rather than read-write which is the default. The  Linux  sg\ndriver needs read-write access for the SCSI READ LONG command but other access methods\nmay require read-only access.\n",
                        "flag": "-r",
                        "long": "--readonly"
                    },
                    {
                        "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"
                    },
                    {
                        "name": "-x --xfer",
                        "content": "where BTL is the byte transfer length (default to 520). If the given value (or the de‐\nfault)  does not match the \"long\" block size of the device, the appropriate BTL is de‐\nduced from the error response and printed (to stderr). The idea is that the user  will\nretry this utility with the correct transfer length.\n",
                        "flag": "-x",
                        "long": "--xfer"
                    }
                ]
            },
            "NOTES": {
                "content": "If a defective block is found and its contents, if any, has been retrieved then \"sgreassign\"\ncould be used to map out the defective block. Associated with such an action  the  number  of\nelements  in  the  \"grown\" defect list could be monitored (with \"sgreassign --grown\") as the\ndisk could be nearing the end of its useful lifetime.\n\nVarious numeric arguments (e.g. LBA) may include multiplicative suffixes or be given in hexa‐\ndecimal. See the \"NUMERIC ARGUMENTS\" section in the sg3utils(8) man page.\n\nAs  a data point, Fujitsu uses a 54 byte ECC (per block) which is capable of correcting up to\na single burst error or 216 bits \"on the fly\". [Information obtained from  MAV20xxrc  product\nmanual.]\n",
                "subsections": []
            },
            "EXIT STATUS": {
                "content": "The  exit  status  of sgreadlong is 0 when it is successful. Otherwise see the sg3utils(8)\nman 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 © 2004-2016 Douglas Gilbert\nThis software is distributed under the GPL version 2. There is NO warranty; not even for MER‐\nCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "sgreassign, sgwritelong, sgdd\n\n\n\nsg3utils-1.42                              November 2015                            SGREADLONG(8)",
                "subsections": []
            }
        }
    }
}