{
    "mode": "man",
    "parameter": "sg_requests",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/sg_requests/8/json",
    "generated": "2026-10-04T15:44:01Z",
    "synopsis": "sgrequests  [--desc]  [--error]  [--help]  [--hex] [--maxlen=LEN] [--num=NUM] [--number=NUM]\n[--progress] [--raw] [--status] [--time] [--verbose] [--version] DEVICE",
    "sections": {
        "NAME": {
            "content": "sgrequests - send one or more SCSI REQUEST SENSE commands\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "sgrequests  [--desc]  [--error]  [--help]  [--hex] [--maxlen=LEN] [--num=NUM] [--number=NUM]\n[--progress] [--raw] [--status] [--time] [--verbose] [--version] DEVICE\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Send SCSI REQUEST SENSE command to DEVICE and output the parameter data response which is ex‐\npected to be in sense data format. Both fixed and descriptor  sense  data  formats  are  sup‐\nported.\n\nMultiple  REQUEST  SENSE commands can be sent with the --num=NUM option. This can be used for\ntiming purposes or monitoring the progress indication.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Arguments to long options are mandatory for short options as well.\n",
            "subsections": [
                {
                    "name": "-d --desc",
                    "content": "sets the DESC bit in the REQUEST SENSE SCSI cdb. The DEVICE should return  sense  data\nin  descriptor  (rather  than fixed) format. This will only occur if the DEVICE recog‐\nnizes descriptor format (SPC-3 and later). If the device is pre SPC-3 then  setting  a\nbit  in  a  reserved  field may cause a check condition status with an illegal request\nsense key, but will most likely be ignored.\n",
                    "flag": "-d",
                    "long": "--desc"
                },
                {
                    "name": "-e --error",
                    "content": "when used once it changes the REQUEST SENSE opcode from 0x3 to 0xff  which  should  be\nrejected by the DEVICE. There is a small chance that the device vendor has implemented\na  vendor  specific  command  at that opcode (0xff).  When used twice the pass-through\ncall to send the SCSI command is bypassed.  The idea here is to measure the user space\noverhead of this package's library to set up and process the response of a  SCSI  com‐\nmand.  This  option will be typically used with the --num=NUM and --time options where\nNUM is a large number (e.g. 1000000).\n",
                    "flag": "-e",
                    "long": "--error"
                },
                {
                    "name": "-h --help",
                    "content": "output the usage message then exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-H --hex",
                    "content": "output response in ASCII hexadecimal.\n",
                    "flag": "-H",
                    "long": "--hex"
                },
                {
                    "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 (or LEN is zero) then 252 is used. The maximum\nvalue of LEN is 255 (but SPC-4 recommends 252).\n",
                    "flag": "-m",
                    "long": "--maxlen"
                },
                {
                    "name": "-n --num",
                    "content": "perform NUM SCSI REQUEST SENSE commands, stopping when either NUM is reached or an er‐\nror occurs. The default value for NUM is 1 .\n\n--number=NUM\nsame action as --num=NUM. Added for compatibility with sgturs.\n",
                    "flag": "-n",
                    "long": "--num"
                },
                {
                    "name": "-p --progress",
                    "content": "show progress indication (a percentage) if available. If --num=NUM is  given,  NUM  is\ngreater than 1 and an initial progress indication was detected then this utility waits\n30  seconds  before subsequent checks.  Exits when NUM is reached or there are no more\nprogress indications.  Ignores --hex, --raw and --time options. See NOTES section  be‐\nlow.\n",
                    "flag": "-p",
                    "long": "--progress"
                },
                {
                    "name": "-r --raw",
                    "content": "output response in binary (to stdout).\n",
                    "flag": "-r",
                    "long": "--raw"
                },
                {
                    "name": "-s --status",
                    "content": "if  the REQUEST SENSE command finished without error (as indicated by its SCSI status)\nthen the contents of the parameter data are analysed as sense data and the exit status\nis set accordingly. The default action (i.e. when this option is not given) is to  ig‐\nnore  the  contents of the parameter data for the purposes of setting the exit status.\nSome types of error set a sense key of \"NO SENSE\" with non-zero information in the ad‐\nditional sense code (e.g. the FAILURE PREDICTION THRESHOLD EXCEEDED group  of  codes);\nthis  results  in  an exit status value of 10. If the sense key is \"NO SENSE\" and both\nasc and ascq are zero then the exit status is set to 0 . See the sg3utils(8) man page\nfor exit status values.\n",
                    "flag": "-s",
                    "long": "--status"
                },
                {
                    "name": "-t --time",
                    "content": "time the SCSI REQUEST SENSE command(s) and calculate the average number of  operations\nper second.\n",
                    "flag": "-t",
                    "long": "--time"
                },
                {
                    "name": "-v --verbose",
                    "content": "increase  the  level of verbosity, (i.e. debug output).  Additionally the response (if\nreceived) is output in ASCII-HEX. Use this option  multiple  times  for  greater  ver‐\nbosity.\n",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "-V --version",
                    "content": "print the version string and then exit.\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "NOTES": {
            "content": "In SCSI 1 and 2 the REQUEST SENSE command was very important for error and warning processing\nin SCSI. The autosense capability rendered this command almost superfluous.\n\nHowever  recent  SCSI drafts (e.g. SPC-4 rev 14 and SBC-3 rev 14) increase the utility of the\nREQUEST SENSE command. Idle and standby (low) power conditions can be detected with this com‐\nmand.\n\nThe REQUEST SENSE command is not marked as mandatory in SPC-3 (i.e. for all SCSI devices) but\nis marked as mandatory in SBC-2 (i.e. for disks), SSC-3 (i.e. for tapes) and MMC-4 (i.e.  for\nCD/DVD/HD-DVD/BD drives).\n\nThe progress indication is optionally part of the sense data. When a prior command that takes\na long time to complete (and typically precludes other media access commands) is still under‐\nway,  the  progress indication can be used to determine how long before the device returns to\nits normal state.\n\nThe SCSI FORMAT command for disks used with the IMMED bit set is an example of  an  operation\nthat  takes  a  significant amount of time and precludes other media access during that time.\nThe IMMED bit set instructs the FORMAT command to return control to  the  application  client\nonce  the  format  has  commenced (see SBC-3). Several long duration SCSI commands associated\nwith tape drives also use the progress indication (see SSC-3).\n\nEarly standards suggested that the SCSI TEST UNIT READY  command  be  used  for  polling  the\nprogress  indication  (see  the  sgturs utility). Since SPC-3 the standards suggest that the\nSCSI REQUEST SENSE command should be used instead.\n\nThe DEVICE is opened with a read-only flag (e.g. in Unix with the ORDONLY flag).\n",
            "subsections": []
        },
        "EXIT STATUS": {
            "content": "The exit status of sgrequests 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 © 2004-2017 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": "",
            "subsections": [
                {
                    "name": "sg_turs (sg3_utils)",
                    "content": "sg3utils-1.45                                July 2018                               SGREQUESTS(8)"
                }
            ]
        }
    },
    "summary": "sgrequests - send one or more SCSI REQUEST SENSE commands",
    "flags": [
        {
            "flag": "-d",
            "long": "--desc",
            "arg": null,
            "description": "sets the DESC bit in the REQUEST SENSE SCSI cdb. The DEVICE should return sense data in descriptor (rather than fixed) format. This will only occur if the DEVICE recog‐ nizes descriptor format (SPC-3 and later). If the device is pre SPC-3 then setting a bit in a reserved field may cause a check condition status with an illegal request sense key, but will most likely be ignored."
        },
        {
            "flag": "-e",
            "long": "--error",
            "arg": null,
            "description": "when used once it changes the REQUEST SENSE opcode from 0x3 to 0xff which should be rejected by the DEVICE. There is a small chance that the device vendor has implemented a vendor specific command at that opcode (0xff). When used twice the pass-through call to send the SCSI command is bypassed. The idea here is to measure the user space overhead of this package's library to set up and process the response of a SCSI com‐ mand. This option will be typically used with the --num=NUM and --time options where NUM is a large number (e.g. 1000000)."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "output the usage message then exit."
        },
        {
            "flag": "-H",
            "long": "--hex",
            "arg": null,
            "description": "output response in ASCII hexadecimal."
        },
        {
            "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 (or LEN is zero) then 252 is used. The maximum value of LEN is 255 (but SPC-4 recommends 252)."
        },
        {
            "flag": "-n",
            "long": "--num",
            "arg": null,
            "description": "perform NUM SCSI REQUEST SENSE commands, stopping when either NUM is reached or an er‐ ror occurs. The default value for NUM is 1 . --number=NUM same action as --num=NUM. Added for compatibility with sgturs."
        },
        {
            "flag": "-p",
            "long": "--progress",
            "arg": null,
            "description": "show progress indication (a percentage) if available. If --num=NUM is given, NUM is greater than 1 and an initial progress indication was detected then this utility waits 30 seconds before subsequent checks. Exits when NUM is reached or there are no more progress indications. Ignores --hex, --raw and --time options. See NOTES section be‐ low."
        },
        {
            "flag": "-r",
            "long": "--raw",
            "arg": null,
            "description": "output response in binary (to stdout)."
        },
        {
            "flag": "-s",
            "long": "--status",
            "arg": null,
            "description": "if the REQUEST SENSE command finished without error (as indicated by its SCSI status) then the contents of the parameter data are analysed as sense data and the exit status is set accordingly. The default action (i.e. when this option is not given) is to ig‐ nore the contents of the parameter data for the purposes of setting the exit status. Some types of error set a sense key of \"NO SENSE\" with non-zero information in the ad‐ ditional sense code (e.g. the FAILURE PREDICTION THRESHOLD EXCEEDED group of codes); this results in an exit status value of 10. If the sense key is \"NO SENSE\" and both asc and ascq are zero then the exit status is set to 0 . See the sg3utils(8) man page for exit status values."
        },
        {
            "flag": "-t",
            "long": "--time",
            "arg": null,
            "description": "time the SCSI REQUEST SENSE command(s) and calculate the average number of operations per second."
        },
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "increase the level of verbosity, (i.e. debug output). Additionally the response (if received) is output in ASCII-HEX. Use this option multiple times for greater ver‐ bosity."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "print the version string and then exit."
        }
    ],
    "examples": [],
    "see_also": []
}