Home > Reformatting, Security > SCSI Format Unit Command options

SCSI Format Unit Command options

January 2nd, 2009

 The SCSI FORMAT UNIT command is used to format a SCSI, FC, SAS, or any disk that utilizes the SCSI command set into logical blocks.   One would send this command (or run an application that sends this command) to to zero all of the data on the disk (if the command is used correctly).   If you just changed the block size of the disk from 512, to 520/528 or vise-versa, then you must also make sure the disk is reformatted before you can use it.  

In order to have the desired effect, you must make sure that whatever format utility you use sets the parameters you desire.  The various built-ins that come with IRIX, Solaris, etc, don’t provide a mechanism that lets you control all of the settings you may need. Furthermore, the default values may or may not be reasonable.  

(In all fairness, they are pretty reasonable if you want to reformat a disk that came with the computer, or you bought from the manufacturer.)
SCSI Command Data Block (CDB) for Format Unit 

SCSI Format Unit Command
Bit 0 1 2 3 4 5 6 7
+0 Operation Code = 0×04
+8 LUN FmtData CmpLst Defect List Format
+16 Vendor-specific
+24 Interleave
+32
+40 Control

The special parameter fields in the CDB have the following meaning:

  • FmtData – Format Data – if this is one then the command is followed by two or three extra parameters:
    • defect list header -
    • initialization pattern descriptor -
    • defect descriptors (optional) -
  • CmpLst – Complete List:
    • 0 – the initiator will send a partial list of defects, to be added to the existing list
    • 1 – the initiator will send a complete list of defects, overwriting the existing list
  • Defect list format – if the FmtData bit is one then this describes the defect options:
    • 000 – block format – 32-bit LBAs
    • 100 – bytes from index format – cylinder + head + byte-offset
    • 101 – physical sector format – cylinder + head + sector
    • 110 – vendor-specific
  • Interleave -
    • 0000h – the target can use its default interleave
    • 0001h – consecutive LBAs must be contiguous
    • all other values are vendor-specific

Here are my suggestions

If you have a high-end server system, or the disks came from, or will go into a RAID subsystem, then be aware that the defect list format may not be the standard block format (Value = 0).   If you chose the wrong format, then the O/S may reject the disk. If this happens, reformat with the other permutations until the O/S accepts it.

For security reasons, you want the disk to remap and reformat the grown defects.  This insures that any disks that were previously marked bad (that will have old data on them) will get zeroed out.  This is vital if you don’t have time or desire to perform a DoD Secure Erase.  Unfortunately, if you reformat the  grown defects, then all weak and bad blocks that failed earlier will eventually fail again. This can lead to data loss unless you use the disk in a RAID configuration. 

So, after you reformat the disk, burn it in with some data integrity testing that writes and reads the entire disk.  Better to remap bad blocks before you put live data on them.

More information below, directly from SANtools SMART Disk Monitor manual/

Command Options

Once you see the warning message after you invoke this command, you will be given the opportunity to select some additional features which must be defined before the format command is sent to the disk drive. The reason is these additional functions can only be performed on a disk at the time you format it. This is not a SMARTMonUX limitation. These constraints are within the ANSI SCSI specification.

Do not combine the -format command with any other options. As this feature is destructive, it may not be run in batch mode, and requires you to enter YES before the program begins reformatting your disk drive.

 

You may add the -confirm command which will suppress the are-you-sure. We strongly recommend you only use this in a batch test environment where you know exactly what you are doing. You will not be able to stop the process once you press return.

Clear Grown Defects

Disks typically (but not always) maintain a list of factory (called primary defects, or PLIST) and grown defects, called the GLIST. There may also be a DLIST. The primary defect list is created at time of manufacture and cannot be altered. The GLIST is built after time of manufacture and grow as either the disk detects areas as data is written, or the operating system detects a problem with an area of the disk and reassigns the data to another location.

SMARTMonUX allows you to clear the grown defect list at the time you format the disk, or more correctly, allows you to turn on this feature that is inherent in the disk drive, when the SCSI command to reformat is sent to the disk.   Ordinarily you would rarely want to clear the grown defects, as they are built over time whenever the disk detects a bad area of the disk and decides data should not be kept there. If you clear the defect list then you run risk of data loss when data is written to a bad sector that is not marked as bad.  We will not editorialize further on the merits of clearing the GLIST and suggest you contact your storage vendor to determine whether clearing the GLIST is something you need to do.  We will say that the only time we ever clear the defect list is when we reformat the disk to use a different sector size, and we follow the operation with a program that fully exercises every sector in the disk to properly rebuild the GLIST before any live data is put on the drive.

Specifying the Defect List Format

The ANSI specification allows for numerous formats that the defect lists can be presented to a program when it sends the appropriate SCSI commands to retrieve the data. Basically you have vendor unique, bytes-from-index, and physical sector format.  Ordinarily you would take the defaults, format 0, which is mandatory per the ANSI spec for all disk drives.  This might not be the correct format for drives that have special OEM firmware on them or are placed behind some RAID controllers. If you do not know what format to use, ask your storage vendor.

Formatting Disk with Full Parameter Control

SMARTMonUX provides the user a mechanism to specify the complete SCSI CDB. This allows you to do anything from force a certain interleave factor to provide custom defect layouts or even pass vendor/drive unique commands to the disk to perform tasks that are only documented under customer/vendor non-disclosure agreements.  If you need to format your disk with non-standard parameters, answer Y to the “Do you want to assign a custom (non-zero) defect list format or assign vendor-unique settings” question. You would then see:

Do you want to assign a custom (non-zero) defect list format or assign vendor-unique settings? <Y/N>: y

Please enter the last 5 bytes of the FORMAT UNIT CDB in hex. If you don’t know what they
should be, then it is highly probable you should NOT be sending vendor-unique info.
CDB[0] = 04
CDB[1] =
 
You would enter the hex byte for the 2nd CDB byte and continue the process until all 6 bytes of the SCSI CDB were filled in. The reason the first byte of the CDB is 04 is because that value represents the op-code to perform the FORMAT UNIT command, so that would not change. After all 6 bytes have been entered (red represents what the computer displays, blue is what the user typed in this example), the format would begin provided you entered YES after entering the rest of the command. In the example below, we instructed the drive to clear the GLIST, use defect format #4, and set the interleave factor to 2. To repeat an earlier warning, if you do not know what all of this means, you should probably not be doing this. We strongly recommend contacting your storage vendor to determine whether or not a special format command should be sent rather than the default.
Do you want to assign a custom (non-zero) defect list format or assign vendor-unique settings? <Y/N>: y
Please enter the last 5 bytes of the FORMAT UNIT CDB in hex. If you don’t know what they
should be, then it is highly probable you should NOT be sending vendor-unique info.
CDB[0] = 04
CDB[1] = 0B
CDB[2] = 00
CDB[3] = 00
CDB[4] = 02
CDB[5] = 00
 
Will send CDB = 04 0B 00 00 02 00
Are you sure you want to do this? Answer “YES” to begin the low-level format, anything else exits program: NO
 
Low level formatting aborted. Program exiting now!

  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.