{
    "mode": "man",
    "parameter": "sg_test_rwbuf",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/sg_test_rwbuf/8/json",
    "generated": "2026-10-05T14:45:49Z",
    "synopsis": "sgtestrwbuf  [--addrd=AR]  [--addwr=AW]  [--help] [--quick] --size=SZ [--times=NUM] [--ver‐\nbose] [--version] DEVICE\nor an older deprecated format sgtestrwbuf DEVICE SZ [AW] [AR]",
    "sections": {
        "NAME": {
            "content": "sgtestrwbuf - test a SCSI host adapter by issuing dummy writes and reads\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "sgtestrwbuf  [--addrd=AR]  [--addwr=AW]  [--help] [--quick] --size=SZ [--times=NUM] [--ver‐\nbose] [--version] DEVICE\n\nor an older deprecated format sgtestrwbuf DEVICE SZ [AW] [AR]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "sgtestrwbuf writes and reads back SZ bytes to the internal buffer of DEVICE (e.g.  /dev/sda\nor  /dev/sg0).  A pseudo random pattern is written to the data buffer on the device then read\nback. If the same pattern is found 'Success' is reported. If they do not match (checksums un‐\nequal) then this is reported and up to 24 bytes from the first  point  of  mismatch  are  re‐\nported;  the  first  line shows what was written and the second line shows what was received.\nFor testing purposes, you can ask it to write AW or read AR additional bytes.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Arguments to long options are mandatory for short options as well.\n",
            "subsections": [
                {
                    "name": "-r --addrd",
                    "content": "Read an additional AR bytes (more than indicated by SZ) from the data buffer. Checksum\nis performed over the first SZ bytes.\n",
                    "flag": "-r",
                    "long": "--addrd"
                },
                {
                    "name": "-w --addwr",
                    "content": "Write an additional AW bytes (more than indicated  by  SZ)  of  zeros  into  the  data\nbuffer. Checksum is generated over the first SZ bytes.\n",
                    "flag": "-w",
                    "long": "--addwr"
                },
                {
                    "name": "-h --help",
                    "content": "Print out a usage message the exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-q --quick",
                    "content": "Perform  a READ BUFFER descriptor command to find out the available data buffer length\nand offset, print them out then exit (without testing with write/read sequences).\n",
                    "flag": "-q",
                    "long": "--quick"
                },
                {
                    "name": "-s --size",
                    "content": "where SZ is the size of buffer in bytes to be written then read and checked. This num‐\nber needs to be less than or equal to the size of the device's data buffer  which  can\nbe  seen  from the --quick option.  Either this option or the --quick option should be\ngiven.\n",
                    "flag": "-s",
                    "long": "--size"
                },
                {
                    "name": "-t --times",
                    "content": "where NUM is the number of times to repeat the  write/read  to  buffer  test.  Default\nvalue is 1 .\n",
                    "flag": "-t",
                    "long": "--times"
                },
                {
                    "name": "-v --verbose",
                    "content": "increase verbosity of output.\n",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "-V --version",
                    "content": "print version number (and data of last change) then exit.\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "NOTES": {
            "content": "The  microcode  in  a  SCSI device is not modified by doing a WRITE BUFFER command with its\nmode set to \"data\" (0x2) as done by this utility. Therefore this utility is safe in that  re‐\nspect. [Mode values 0x4, 0x5, 0x6 and 0x7 are the dangerous ones :-)]\n\nWARNING:  If  you  access  the  device at the same time (e.g. because it's a hard disk with a\nmounted file system on it) the device's buffer may be used by the  device  itself  for  other\ndata  at  the same time, and overwriting it may or may not cause data corruption! HOWEVER the\nSPC-3 draft standard does state in its WRITE BUFFER command: \"This command  shall  not  alter\nany  medium  of  the logical unit when data mode ... is specified\". This implies that it is\nsafe to use this utility with devices that have mounted file systems on them.  Following this\ntheme further, a disk with active mounted file systems may cause the data  read  back  to  be\ndifferent (due to caching activity) to what was written and hence a checksum error.\n",
            "subsections": []
        },
        "EXIT STATUS": {
            "content": "The  exit  status of sgtestrwbuf is 0 when it is successful. Otherwise see the sg3utils(8)\nman page.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Written by D. Gilbert and K. Garloff\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright © 2000-2018 Douglas Gilbert, Kurt Garloff\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\nsg3utils-1.43                              January 2018                            SGTESTRWBUF(8)",
            "subsections": []
        }
    },
    "summary": "sgtestrwbuf - test a SCSI host adapter by issuing dummy writes and reads",
    "flags": [
        {
            "flag": "-r",
            "long": "--addrd",
            "arg": null,
            "description": "Read an additional AR bytes (more than indicated by SZ) from the data buffer. Checksum is performed over the first SZ bytes."
        },
        {
            "flag": "-w",
            "long": "--addwr",
            "arg": null,
            "description": "Write an additional AW bytes (more than indicated by SZ) of zeros into the data buffer. Checksum is generated over the first SZ bytes."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Print out a usage message the exit."
        },
        {
            "flag": "-q",
            "long": "--quick",
            "arg": null,
            "description": "Perform a READ BUFFER descriptor command to find out the available data buffer length and offset, print them out then exit (without testing with write/read sequences)."
        },
        {
            "flag": "-s",
            "long": "--size",
            "arg": null,
            "description": "where SZ is the size of buffer in bytes to be written then read and checked. This num‐ ber needs to be less than or equal to the size of the device's data buffer which can be seen from the --quick option. Either this option or the --quick option should be given."
        },
        {
            "flag": "-t",
            "long": "--times",
            "arg": null,
            "description": "where NUM is the number of times to repeat the write/read to buffer test. Default value is 1 ."
        },
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "increase verbosity of output."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "print version number (and data of last change) then exit."
        }
    ],
    "examples": [],
    "see_also": []
}