{
    "mode": "man",
    "parameter": "sg_seek",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/sg_seek/8/json",
    "generated": "2026-10-09T10:20:40Z",
    "synopsis": "sgseek  [--10]  [--count=NC] [--grpnum=GN] [--help] [--immed] [--lba=LBA] [--num-blocks=NUM]\n[--pre-fetch] [--readonly] [--skip=SB] [--time]  [--verbose]  [--version]  [--wrap-offset=WO]\nDEVICE",
    "sections": {
        "NAME": {
            "content": "sgseek - send SCSI SEEK, PRE-FETCH(10) or PRE-FETCH(16) command\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "sgseek  [--10]  [--count=NC] [--grpnum=GN] [--help] [--immed] [--lba=LBA] [--num-blocks=NUM]\n[--pre-fetch] [--readonly] [--skip=SB] [--time]  [--verbose]  [--version]  [--wrap-offset=WO]\nDEVICE\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Sends a SCSI SEEK(10), PRE-FETCH(10) or PRE-FETCH(16) command to the DEVICE. The SEEK command\nhas  been obsolete since SBC-2 (2005) but still is supported on some hard disks and even some\nSSDs (solid state disks). The PRE-FETCH command can be viewed as SEEK's  modern  replacement.\nInstead of talking about moving the disk heads to the track containing the sort after LBA, it\ntalks about bringing the sort after LBA (and a given number of blocks) into the disk's cache.\nAlso the PRE-FETCH commands have an IMMED field.\n\nThe  PRE-FETCH  commands  can  report  \"real\"  errors but usually they will report one of two\n\"good\" statuses. To do this they return the rarely used CONDITION MET status. If  the  number\nof  blocks does actually fit in the cache (when IMMED=0) or there is enough room in the cache\nwhen the command arrives (when IMMED=1) then a CONDITION MET status is returned. If  the  re‐\nquested number of blocks did not fit (IMMED=0) or would not fit (IMMED=1) then status GOOD is\nreturned.  So if a disk has a large cache and PRE-FETCH is used sparingly then the command is\nmore likely to return CONDITION MET than GOOD. This presents some SCSI sub-systems with prob‐\nlems as due to its rareness they mishandle CONDITION MET and treat it as an error (see  NOTES\nsection below).\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Arguments to long options are mandatory for short options as well.\n",
            "subsections": [
                {
                    "name": "-T --10",
                    "content": "use a 10 byte cdb command, either SEEK(10) or PRE-FETCH(10) command. In the absence of\nthe  --pre-fetch  option,  the  SEEK(10) command is used. If the --pre-fetch option is\ngiven without this option then a PRE-FETCH(16) command is used.\n",
                    "flag": "-T",
                    "long": "--10"
                },
                {
                    "name": "-c --count",
                    "content": "NC is the number of commands (one of SEEK(10), PRE-FETCH(10)  or  PRE-FETCH(16))  that\nwill  be executed. The default value is 1. If an error occurs it is noted and the pro‐\ngram continues until NC is exhausted.  If NC is 0 then options are checked and the DE‐\nVICE is opened but no commands are sent.\n",
                    "flag": "-c",
                    "long": "--count"
                },
                {
                    "name": "-g --grpnum",
                    "content": "GN is the group number, a value between 0 and 63 (in hex: 0x3f). The default value  is\n0. This option is ignored if the selected command is SEEK(10).\n",
                    "flag": "-g",
                    "long": "--grpnum"
                },
                {
                    "name": "-h --help",
                    "content": "output the usage message then exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-i --immed",
                    "content": "this  option  only  applies to PRE-FETCH(10) and PRE-FETCH(16), setting the IMMED bit.\nWithout this option, the DEVICE returns after it has completed  transferring  all,  or\npart  of,  the requested blocks into the cache. If this option is given the DEVICE re‐\nturns after it has done sanity checks on the cdb (e.g. making sure the LBA is  greater\nthan the number of available blocks) and before it does the transfer into the cache.\nNote  that  even  when this option is given, the return status from the PRE-FETCH com‐\nmands is still either CONDITION MET status (if the cache seems  to  have  enough  free\nspace  for  the  transfer) or a GOOD status (if the cache does not seem to have enough\nfree space).\n",
                    "flag": "-i",
                    "long": "--immed"
                },
                {
                    "name": "-l --lba",
                    "content": "LBA is the starting logical block address that is placed  in  the  command  descriptor\nblock  (cdb)  of  the  selected  command.  Note  that  the  LBA  field in SEEK(10) and\nPRE-FETCH(10) is a 32 bit quantity, while with PRE-FETCH(16) it is a 64 bit  quantity.\nThe default value is 0 .\n",
                    "flag": "-l",
                    "long": "--lba"
                },
                {
                    "name": "-n --num-blocks",
                    "content": "NUM  is  the number of blocks, starting at and including LBA, to place in the DEVICE's\ncache. The SEEK(10) command does not use the NUM value. For PRE-FETCH(10) NUM is a  16\nbit  quantity, while for PRE-FETCH(16) it is a 32 bit quantity. The default value is 1\n. If NUM is 0 then the DEVICE will attempt to transfer all blocks from the  given  LBA\nto the end of the medium.\n",
                    "flag": "-n",
                    "long": "--num-blocks"
                },
                {
                    "name": "-p --pre-fetch",
                    "content": "this option selects either PRE-FETCH(10) or PRE-FETCH(16) commands. With the --10 also\ngiven, the PRE-FETCH(10) command is selected; without that option PRE-FETCH(16) is se‐\nlected.  The  default  (in  the  absence  of  this  and other 'selecting' options) the\nSEEK(10) command is selected.\n",
                    "flag": "-p",
                    "long": "--pre-fetch"
                },
                {
                    "name": "-r --readonly",
                    "content": "this option sets a 'read-only' flag when the underlying  operating  system  opens  the\ngiven  DEVICE.  This  may  not  work  since operating systems can not easily determine\nwhether a pass-through is a logical read or write operation so they take a risk averse\nstance and require read-write type DEVICE opens irrespective of what is  performed  by\nthe pass-through.\n",
                    "flag": "-r",
                    "long": "--readonly"
                },
                {
                    "name": "-s --skip",
                    "content": "SB is the number of logical block addresses to skip, between repeated commands when NC\nis  greater  than  1. The default value of SB is 1 . SB may be set to 0 so that all NC\nPRE-FETCH commands use the same LBA.\n",
                    "flag": "-s",
                    "long": "--skip"
                },
                {
                    "name": "-t --time",
                    "content": "if given the elapsed time to execute NC commands is recorded. This is printed out  be‐\nfore  this  utility  exits. If NC is greater than 1 then the the \"per command\" time is\nalso printed.\n",
                    "flag": "-t",
                    "long": "--time"
                },
                {
                    "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": "-w --wrap-offset",
                    "content": "WO is the number of blocks, relative to LBA, that when exceeded,  set  the  next  com‐\nmand's  logical  block  address back to LBA. Whether this \"reset-to-LBA\" action occurs\ndepends on the values NC and SB.\n",
                    "flag": "-w",
                    "long": "--wrap-offset"
                }
            ]
        },
        "NOTES": {
            "content": "Prior to Linux kernel 4.17 the CONDITION MET status was logged as an error.  Recent  versions\nof FreeBSD handle the CONDITION MET status properly.\n\nIf  either the --count=NC or --verbose option is given then a summary line like the following\nis output:\n\nCommand count=5, number of conditionmets=3, number of goods=2\n\nbefore the utility exits.\n",
            "subsections": []
        },
        "EXIT STATUS": {
            "content": "The exit status of sgseek is 0 (GOOD) or 25 (CONDITIONMET) when this utility is successful.\nIf multiple commands are executed (e.g. when NC is greater than 1) then  the  result  of  the\nlast  executed SEEK or PRE-FETCH command sets the exit status. 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 © 2018 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_vpd(sg3_utils); sdparm(sdparm)",
                    "content": "sg3utils-1.43                             September 2018                                 SGSEEK(8)"
                }
            ]
        }
    },
    "summary": "sgseek - send SCSI SEEK, PRE-FETCH(10) or PRE-FETCH(16) command",
    "flags": [
        {
            "flag": "-T",
            "long": "--10",
            "arg": null,
            "description": "use a 10 byte cdb command, either SEEK(10) or PRE-FETCH(10) command. In the absence of the --pre-fetch option, the SEEK(10) command is used. If the --pre-fetch option is given without this option then a PRE-FETCH(16) command is used."
        },
        {
            "flag": "-c",
            "long": "--count",
            "arg": null,
            "description": "NC is the number of commands (one of SEEK(10), PRE-FETCH(10) or PRE-FETCH(16)) that will be executed. The default value is 1. If an error occurs it is noted and the pro‐ gram continues until NC is exhausted. If NC is 0 then options are checked and the DE‐ VICE is opened but no commands are sent."
        },
        {
            "flag": "-g",
            "long": "--grpnum",
            "arg": null,
            "description": "GN is the group number, a value between 0 and 63 (in hex: 0x3f). The default value is 0. This option is ignored if the selected command is SEEK(10)."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "output the usage message then exit."
        },
        {
            "flag": "-i",
            "long": "--immed",
            "arg": null,
            "description": "this option only applies to PRE-FETCH(10) and PRE-FETCH(16), setting the IMMED bit. Without this option, the DEVICE returns after it has completed transferring all, or part of, the requested blocks into the cache. If this option is given the DEVICE re‐ turns after it has done sanity checks on the cdb (e.g. making sure the LBA is greater than the number of available blocks) and before it does the transfer into the cache. Note that even when this option is given, the return status from the PRE-FETCH com‐ mands is still either CONDITION MET status (if the cache seems to have enough free space for the transfer) or a GOOD status (if the cache does not seem to have enough free space)."
        },
        {
            "flag": "-l",
            "long": "--lba",
            "arg": null,
            "description": "LBA is the starting logical block address that is placed in the command descriptor block (cdb) of the selected command. Note that the LBA field in SEEK(10) and PRE-FETCH(10) is a 32 bit quantity, while with PRE-FETCH(16) it is a 64 bit quantity. The default value is 0 ."
        },
        {
            "flag": "-n",
            "long": "--num-blocks",
            "arg": null,
            "description": "NUM is the number of blocks, starting at and including LBA, to place in the DEVICE's cache. The SEEK(10) command does not use the NUM value. For PRE-FETCH(10) NUM is a 16 bit quantity, while for PRE-FETCH(16) it is a 32 bit quantity. The default value is 1 . If NUM is 0 then the DEVICE will attempt to transfer all blocks from the given LBA to the end of the medium."
        },
        {
            "flag": "-p",
            "long": "--pre-fetch",
            "arg": null,
            "description": "this option selects either PRE-FETCH(10) or PRE-FETCH(16) commands. With the --10 also given, the PRE-FETCH(10) command is selected; without that option PRE-FETCH(16) is se‐ lected. The default (in the absence of this and other 'selecting' options) the SEEK(10) command is selected."
        },
        {
            "flag": "-r",
            "long": "--readonly",
            "arg": null,
            "description": "this option sets a 'read-only' flag when the underlying operating system opens the given DEVICE. This may not work since operating systems can not easily determine whether a pass-through is a logical read or write operation so they take a risk averse stance and require read-write type DEVICE opens irrespective of what is performed by the pass-through."
        },
        {
            "flag": "-s",
            "long": "--skip",
            "arg": null,
            "description": "SB is the number of logical block addresses to skip, between repeated commands when NC is greater than 1. The default value of SB is 1 . SB may be set to 0 so that all NC PRE-FETCH commands use the same LBA."
        },
        {
            "flag": "-t",
            "long": "--time",
            "arg": null,
            "description": "if given the elapsed time to execute NC commands is recorded. This is printed out be‐ fore this utility exits. If NC is greater than 1 then the the \"per command\" time is also printed."
        },
        {
            "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": "-w",
            "long": "--wrap-offset",
            "arg": null,
            "description": "WO is the number of blocks, relative to LBA, that when exceeded, set the next com‐ mand's logical block address back to LBA. Whether this \"reset-to-LBA\" action occurs depends on the values NC and SB."
        }
    ],
    "examples": [],
    "see_also": []
}