scsiformat(8)

πŸ’… scsiformat β€” from the Scsiinfo User's Guide, bestie πŸŽ€

okay so real talk: this is scsiformat(8), the tool that does a low level format on your SCSI disk. it's giving ancient-but-iconic, it's giving "back up your data first, girlie". let's go πŸ¦‹


✨ NAME ✨

scsiformat β€” low level format an scsi disk device


🌸 SYNOPSIS 🌸

scsiformat [-options...] device

πŸ’– DESCRIPTION πŸ’–

So. What this does is low level format the SCSI device you point at with the scsi disk node or the generic scsi device node, that's device. no cap.

You must be root to perform this operation. like, actually root, not "I know a guy" root. πŸ‘‘

Before it touches anything, scsiformat will ask you a simple question to get your confirmation, and it checks whether any partitions on device are still mounted. Any possible swap spaces sitting on device get swapoff(8)'ed prior to formatting. so considerate of her honestly 🫢

While formatting is happening, a file like /tmp/scsiformat.xx:xx:xx:xx:xxxxxxxx is used to hold some status information. it's her little diary. πŸ’œ


⭐ OPTIONS ⭐

scsiformat supports the following option switches, babes:

🌈 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 off 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. ✨ trust the vendor on this one

🌈 c) Initialisation pattern

By default the target will initialise the formatted sectors with a vendor specific test pattern. cute!

  • -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

(yes bestie, there are two c) headings in this manpage. we do not fix the original, we love her as she is πŸ’€)

  • -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. like, they were being thorough, don't disrespect them πŸ™ˆ
  • -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! pick a lane, bestie πŸ›£οΈ

🌈 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. she's a shortcut, not a whole personality πŸ’…

  • -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...) πŸ’€ iconic honestly
  • -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. 1 for system errors
  2. 2 for user errors
  3. 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. πŸ‘‘ (author is being so real)

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. 😭 (again: real)


πŸ¦‹ 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>


and that's the whole page bestie, no notes, we ate πŸ’…βœ¨

this was scsiinfo 1.7, dated 23 August 1997 β€” a genuine vintage icon, main character energy since the 90s, mwah πŸ«ΆπŸŽ€πŸŒˆ