Provided by: scsitools_0.12-3ubuntu1_amd64 bug

NAME

       scsiformat - low level format an scsi disk device

SYNOPSIS

       scsiformat [-options...] device

DESCRIPTION

       Low  level formats the SCSI device identified by the scsi disk or generic scsi device node
       device.  You must be root to  perform  this  operation.   scsiformat  will  ask  a  simple
       question  to  get  your  confirmation and check if partitions on device are still mounted.
       Possible swap spaces on device are swapoff(8)'ed prior to formatting.

       During formatting a file like /tmp/scsiformat.xx:xx:xx:xx:xxxxxxxx is used  to  hold  some
       status information.

OPTIONS

       scsiformat supports the following option switches:

   a) Controlling a/synchronous operation
       -b n   block  during  the  format  operation.  This  makes  any  display  of real progress
              indicators impossible. However, cheesy  SCSI  devices   will  need  it.  Scsiformat
              assumes  that  the  operation  will need about n seconds and provides some progress
              indication according to that.  -b0 does not print any process indication, just sits
              and blocks until formatting completes.

              Read the BUGS section below!

       -T     just   check   for  a  running  format  command  and  output  statistics.   A  file
              /tmp/scsiformat.*  is used to hold the starting time of the  format  operation.  If
              formatting completed, this file is removed by the formatting scsiformat call (which
              forks of a child just for this purpose).  The exit state of scsiformat is  true  as
              long  as  the  format operation is still in progress. A left over /tmp/scsiformat.*
              file will make scsiformat think a program still runs. It will not accept and remove
              files older than 48h nevertheless.

       -t n   check progress every n seconds (default is 5).  -t0 makes scsiformat return without
              displaying progress.

   b) Interleave factor
       -i n   sets the sector interleave factor to be used. Usually you  should  stick  with  the
              default -i0 which selects a vendor specific default.

   c) Initialisation pattern
       By  default  the  target will initialise the formatted sectors with a vendor specific test
       pattern.

       -I sequence of bytes in hex
              the bytes given in hex characters are repeated and used to init all blocks  on  the
              device.

       -L     The  first  four  bytes  of each logical block are set to the number of the logical
              block.

       -P     The first four bytes of each physical block are set to the number of logical block,
              it will occur in.

   c) Defect management
       -e     Erase  the grown defect list prior to formatting. You can issue new defects for the
              grown defect list nevertheless and media certification may add defects too.

       -p     Ignore the vendor's primary defect list. This is  not  recommended  as  the  vendor
              probably had a reason to specify these primary defects.

       -c     Do  not  perform a media surface certification. This may speed up formatting but is
              also not recommended.

       -s     Stop when unable to access primary or grown defects due to some internal  error  in
              the  target  device.  When  not given, formatting continues but returns a recovered
              error upon completion. (Which is probably not well supported by scsiformat).

       -S     Erase MODE SELECT settings stored in NVRAM.  These  are  those  you  can  set  with
              scsiinfo(8) or scsi-config(8).

       -d int, ...
              A  comma  separated  list  of  logical  blocks to mark as defect. Using this defect
              format is discouraged as there no clear concept of what a  logical  block  is  here
              because  the format command may move around logical blocks and change the number of
              available blocks.

              The number can be preceded by 0 or 0x for octal or hexadecimal notation.

       -D int:int:int, ...
              A comma separated list of expressions of the form  C:H:S  specifying  a  defect  at
              physical  location  Cylinder:Head:Sector. A Sector S of -1 marks the whole track as
              bad.

              The number can be preceded by 0 or 0x for octal or hexadecimal notation.

       -B int:int:int, ...
              A comma separated list of expressions of  the  from  C:H:B  specifying  defects  at
              Cylinder:Head:Bytes  from  Index. Again, a Bytes from Index value B of -1 marks the
              whole track as bad.

              The number can be preceded by 0 or 0x for octal or hexadecimal notation.

       You can specify more than one of the -d, -D, -B options but you must stick to  one  defect
       format!

   d) Simple partitioning
       For your convenience, scsiformat allow to preset the partition table in a simple way which
       often suffices for removable medias.  This is not intended as a replacement  for  fdisk(8)
       though.

       -f arg perform  simple  partitioning.   -fdos  sets up begin and start of the partition on
              cylinder boundaries.  -ftight does use as much of the disk  as  possible  (but  may
              confuse OS's other than Linux).

              If  you  do  not  specify  -f  at all, scsiformat will not initialise the partition
              table. As it has to tell the kernel that the disk was reformatted  and  the  kernel
              will  try  to to read the partition table, you are like to get some kernel warnings
              then.

       -G headsxsectors
              set the disk geometry (Heads x Sectors) as DOS will see it for use in the partition
              table.  If  you don't specify it, scsiformat will ask the kernel what it thinks DOS
              will get from the adapters BIOS. This call might fail or return bogus data  though.
              A  wrong  setting  will  not affect linux, but other OS's and esp. DOS and the BIOS
              (for booting).

       -y type
              set the type for the partition to set.   type  is  a  two  digit  hex  number.  See
              fdisk(8),command t for a list. Defaults to 83 (Linux native).

       -M size
              Create  a  primary  partition  number 1 of maximal size sizeMB.  When size is 0, no
              partition is created, and thus the partition table  is  simply  initialised  to  be
              valid  (but  empty). If the size exceeds the disk capacity, a partition as large as
              possible is made. Defaults to 99999.

   e) Miscellaneous
       -H     print some command line help to stdout.

       -v     print version information.

       -F arg forced   operation,   do   not   ask   prior    to    format.     arg    must    be
              'Ene Mene Meck, und Du bist weg!'   with proper spaces and capitalisation. (this is
              a German child rhyme kissing someone goodbye...)

       -V     print some debugging information.

       -X     all output is printed in numerics, useful for GUI interfaces like tk_scsiformat(8).
              Also  makes  all  operations non blocking. (By forking of a child process for those
              scsi operations which would block).

       -o     The settings of the flags -c, -p, -s, -S, -I, -L, -P are obeyed.   If  you  specify
              one  of  these, -o is silently added. Without -o or one of these flags some factory
              default is used.  Specifying -o explicitly will allow you to not use any  of  these
              options which might not be the default chosen by the target device otherwise.

RETURN CODES

       Apart  from  the  codes  returned  by  the -T flag, scsiformat will generally return 1 for
       system errors, 2 for user errors, and 0 for successful operation.

BUGS

       Old status files in /tmp will confuse the -T option. However, they are  removed  after  48
       hours.

       I  was  unable  to get hold of a disk supporting querying the progress status (and which I
       could stand to lose all data on). Therefore I commented out the support for this from  the
       source code using a BLOCKING_ONLY#define.  You are welcome to try and make this work.

       Restrictions  of  the  SCSI_IOCTL_SEND_COMMAND  ioctl(2) call for the sd(4) device make it
       impossible to issue a FORMAT_UNIT command with more than 4096  bytes  of  arguments.  This
       could  be avoided by using the proper generic scsi device /dev/sg* instead, at least where
       the kernel is compiled to support it. Most of the time this is not needed though and  thus
       I'm myself to lazy to do it.

FILES

       /tmp/scsiformat.xx:xx:xx:xx:xxxxxxxx
       /dev/sd*
       /dev/sg*

SEE ALSO

       tk_scsiformat(8), scsiinfo(8), scsi-config(8), fdisk(8), sd(4).

AUTHOR

       Michael Weller <eowmob@exp-math.uni-essen.de>