# phpman > man > SG_SEEK(8)

[SG_SEEK(8)](https://www.chedong.com/phpMan.php/man/SGSEEK/8/markdown)                                    SG3_UTILS                                   [SG_SEEK(8)](https://www.chedong.com/phpMan.php/man/SGSEEK/8/markdown)



## NAME
       sg_seek - send SCSI SEEK, [PRE-FETCH(10)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/10/markdown) or [PRE-FETCH(16)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/16/markdown) command

## SYNOPSIS
       **sg**___**seek**  [_--10_]  [_--count=NC_] [_--grpnum=GN_] [_--help_] [_--immed_] [_--lba=LBA_] [_--num-blocks=NUM_]
       [_--pre-fetch_] [_--readonly_] [_--skip=SB_] [_--time_]  [_--verbose_]  [_--version_]  [_--wrap-offset=WO_]
       _DEVICE_

## DESCRIPTION
       Sends a SCSI [SEEK(10)](https://www.chedong.com/phpMan.php/man/SEEK/10/markdown), [PRE-FETCH(10)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/10/markdown) or [PRE-FETCH(16)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/16/markdown) command to the _DEVICE_. The SEEK command
       has been obsolete since SBC-2 (2005) but still is supported on some hard disks and even  some
       SSDs  (solid  state disks). The PRE-FETCH command can be viewed as SEEK's modern replacement.
       Instead of talking about moving the disk heads to the track containing the sort after LBA, it
       talks about bringing the sort after LBA (and a given number of blocks) into the disk's cache.
       Also the PRE-FETCH commands have an IMMED field.

       The PRE-FETCH commands can report "real" errors but usually  they  will  report  one  of  two
       "good"  statuses.  To do this they return the rarely used CONDITION MET status. If the number
       of blocks does actually fit in the cache (when IMMED=0) or there is enough room in the  cache
       when  the  command arrives (when IMMED=1) then a CONDITION MET status is returned. If the re‐
       quested number of blocks did not fit (IMMED=0) or would not fit (IMMED=1) then status GOOD is
       returned.  So if a disk has a large cache and PRE-FETCH is used sparingly then the command is
       more likely to return CONDITION MET than GOOD. This presents some SCSI sub-systems with prob‐
       lems  as due to its rareness they mishandle CONDITION MET and treat it as an error (see NOTES
       section below).

## OPTIONS
       Arguments to long options are mandatory for short options as well.

### -T --10
              use a 10 byte cdb command, either [SEEK(10)](https://www.chedong.com/phpMan.php/man/SEEK/10/markdown) or [PRE-FETCH(10)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/10/markdown) command. In the absence of
              the  _--pre-fetch_  option,  the  [SEEK(10)](https://www.chedong.com/phpMan.php/man/SEEK/10/markdown) command is used. If the _--pre-fetch_ option is
              given without this option then a [PRE-FETCH(16)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/16/markdown) command is used.

### -c --count
              _NC_ is the number of commands (one of [SEEK(10)](https://www.chedong.com/phpMan.php/man/SEEK/10/markdown), [PRE-FETCH(10)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/10/markdown)  or  [PRE-FETCH(16)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/16/markdown))  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.

### -g --grpnum
              _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)](https://www.chedong.com/phpMan.php/man/SEEK/10/markdown).

### -h --help
              output the usage message then exit.

### -i --immed
              this option only applies to [PRE-FETCH(10)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/10/markdown) and [PRE-FETCH(16)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/16/markdown), 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).

### -l --lba
              _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)](https://www.chedong.com/phpMan.php/man/SEEK/10/markdown)  and
              [PRE-FETCH(10)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/10/markdown)  is a 32 bit quantity, while with [PRE-FETCH(16)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/16/markdown) it is a 64 bit quantity.
              The default value is 0 .

### -n --num-blocks
              _NUM_ is the number of blocks, starting at and including _LBA_, to place in  the  _DEVICE_'s
              cache.  The [SEEK(10)](https://www.chedong.com/phpMan.php/man/SEEK/10/markdown) command does not use the _NUM_ value. For [PRE-FETCH(10)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/10/markdown) _NUM_ is a 16
              bit quantity, while for [PRE-FETCH(16)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/16/markdown) 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.

### -p --pre-fetch
              this option selects either [PRE-FETCH(10)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/10/markdown) or [PRE-FETCH(16)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/16/markdown) commands. With the _--10_ also
              given, the [PRE-FETCH(10)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/10/markdown) command is selected; without that option [PRE-FETCH(16)](https://www.chedong.com/phpMan.php/man/PRE-FETCH/16/markdown) is se‐
              lected. The default (in the  absence  of  this  and  other  'selecting'  options)  the
              [SEEK(10)](https://www.chedong.com/phpMan.php/man/SEEK/10/markdown) command is selected.

### -r --readonly
              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.

### -s --skip
              _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_.

### -t --time
              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.

### -v --verbose
              increase the level of verbosity, (i.e. debug output).

### -V --version
              print the version string and then exit.

### -w --wrap-offset
              _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_.

## NOTES
       Prior  to Linux kernel 4.17 the CONDITION MET status was logged as an error.  Recent versions
       of FreeBSD handle the CONDITION MET status properly.

       If either the _--count=NC_ or _--verbose_ option is given then a summary line like the  following
       is output:

           Command count=5, number of condition_mets=3, number of goods=2

       before the utility exits.

## EXIT STATUS
       The exit status of sg_seek is 0 (GOOD) or 25 (CONDITION_MET) when this utility is successful.
       If multiple commands are executed (e.g. when _NC_ is greater than 1) then  the  result  of  the
       last  executed SEEK or PRE-FETCH command sets the exit status. Otherwise see the [sg3_utils(8)](https://www.chedong.com/phpMan.php/man/sg3utils/8/markdown)
       man page.

## AUTHORS
       Written by Douglas Gilbert.

## REPORTING BUGS
       Report bugs to <dgilbert at interlog dot com>.

## COPYRIGHT
       Copyright © 2018 Douglas Gilbert
       This software is distributed under a FreeBSD license. There is NO warranty; not even for MER‐
       CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## SEE ALSO
       **sg**___**vpd(sg3**___**utils);** **sdparm(sdparm)**



sg3_utils-1.43                             September 2018                                 [SG_SEEK(8)](https://www.chedong.com/phpMan.php/man/SGSEEK/8/markdown)
