Navigation:  Screen shots and commands >

Erase

Print this Topic Previous pageReturn to chapter overviewNext page

EraseW

Command-Line Invocation and Application Notes

The -format option is used to perform a low-level format of a SCSI, Fibre channel, or IBM SSA type disk drive. This command sends out the FORMAT UNIT command which performs a physical formatting of the disk drive. Depending on the options you supply, and the capabilities of the disk drive, you can use this feature to clear the grown defects (GLIST) table, change the layout of the remapped data or specify a certain data pattern to be written over the disk drive.

 

The -format option will only be accepted for disk drives. If you try to format a CDROM, for example, you will get an error. The command will also be rejected for ATA type disks as well, as there is arguably no reason why this command should ever be issued to an ATA family disk drive.  Also, the command will only format one drive at a time, and the program will stay "locked up" until the operation has been completed. It will not send any additional commands to the drive until the format is complete.  If your command-line uses wild-cards, or if you give it the device name for more than one disk drive, only the first disk will be selected for formatting.

 

Usage

smartmon-ux -format DeviceName

 

Example

smartmon-ux -format \\.\SCSI2Port2Path0Target19Lun0

SMARTMon-ux [Release 1.25-RC2, Build 13-MAR-2004] - Copyright 2001-2004 SANtools, Inc. http://www.SANtools.com

***************************************************************************************

* Warning:  You have instructed the software to reformat the selected disk. No checks *

*           will be made to verify that the disk isn't mounted or in use in any way.  *

*           (Although reformatting your boot disk will blow the O/S, it will work.)   *

*                                                                                     *

*           The process could take several hours to complete, and this program will   *

*           lock up until either the formatting is complete or the drive rejects the  *

*           command.  Once the command is sent to the device, the software will       *

*           suspend and wait for the action to complete.                              *

*                                                                                     *

*           Your operating system may attempt to query the disk unless you have       *

*           unmounted it (unassigned drive letter in Windows, umount in UNIX/LINUX).  *

*                                                                                     *

*           As a formatting disk is going to appear dead to your operating system,    *

*           you may have to endure some error or system log messages, or even force   *

*           the system to rediscover devices after the process has formatting has     *

*           been completed.  WARNING:  If the formatting is interrupted due to        *

*           a power failure or an external hardware/software problem, then you must   *

*           reformat the disk as this is the only way to recover from an incomplete   *

*           format.                                                                   *

*                                                                                     *

*           If you are formatting a disk as part of a disk drive firmware update and  *

*           drive cloning procedure, don't forget to also clone the mode pages        *

*           BEFORE reformatting, as the disk topology (sector sizes) and defect       *

*           layout are defined in the mode pages and used by the disk as part of      *

*           the formatting process.                                                   *

***************************************************************************************

 

This will format the SEAGATE ST336605FC disk at \\.\SCSI2Port2Path0Target19Lun0

Do you want to clear the grown defects (GLIST) as the disk is formatted? <Y/N>: N

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

Are you sure you want to do this? Answer "YES" to begin the low-level format, anything else exits program: YES

 

Sending command .... This will be last text you see until format complete or rejected.

Formatting ... [This is where the cursor will stay until format complete] completed ... Program terminating.

 

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!

 

WRITE-SAME Function

Another feature added to the diagnostic suite in release 1.26 is support for writing data to the entire device. This feature utilizes the SCSI-only WRITE SAME command which instructs the device to fill a block of data with a user-specified pattern. (The command works on SCSI, SAS, SSA, and fibre channel random-access devices.   (SMARTMonUX will return an error if you attempt to perform this command on an unsupported device).

 

Both the -wsbyte and -wsbyteconfirm commands initiate the same WRITE SAME function. The -wsbyteconfirm just suppresses the are-you-sure type message, which allows you to automate this data destructive command. This function will write the pattern starting on block #0 of the disk, and it will continue through the last addressable block.   It will not write your pattern on reserved areas, nor will it write the pattern on blocks that may go beyond the reported drive capacity. If you need to insure that your pattern writes every addressable block on the disk, then you should send the command, -capacity 0 which will reset the disk to maximum addressable capacity.

 

One would ordinarily use this command variant as part of a automated process. As this test is destructive, we suggest you only use the -wsbyteconfirm command on systems and scripts that have been fully tested.   We also allow you to combine -wsbyte and -confirm on the same command-line. These options together are equivalent to the -wsbyteconfirm command.

 

Add the optional -wsc operator if you want the program to immediately terminate the operation after the first error.

 

Usage

./smartmon-ux -wsbyte [-16] hexbyte [-wsc] Device_list

./smartmon-ux -wsbyteconfirm [-16] hexbyte [-wsc] Device_list

 

Where hexbyte is the byte that you wish to fill the disk with.

 

If  you want every block of the disk to be zeroed, set hexbyte to 00.  If you want to write a pattern which would be used as part of a stress disk write test, we have been told that Seagate suggests sending the E6 byte as a pattern.

 

If you use wild-cards or enter more than one disk in the device list, the program will continue with all disks in the list after the first disk has been written (or skipped by the operator). If there is a problem with flashing any disk, the program immediately terminates with an appropriate error message. (If it is a result of a disk error, sense information will be provided to lend insight into the problem.

 

(Note, there is no 12-byte version of the WRITE SAME command, so there is no -12 flag).

 

Example (write E6h pattern to every byte on the disk)

[root@rh90 smartmon]# ./smartmon-ux -wsbyte E6 /dev/sg5

SMARTMon-ux [Release 1.26, Build 22-APR-2004] - Copyright 2001-2004 SANtools, Inc. http://www.SANtools.com

Discovered SEAGATE ST336753FC S/N "3HX00LE3" on /dev/sg5 [SES] (Not Enabling SMART)(35003 MB)

 

***************************************************************************************

* Warning:  You have initiated the WRITE SAME function which instructs this software  *

*           to destroy all of your data and write a single byte pattern over every    *

*           block on the selected disk drive, DESTROYING YOUR DATA.  No checks        *

*           will be made to verify that the disk isn't mounted or in use in any way.  *

*                                                                                     *

*           The process will generally complete in 15 - 30 minutes, and status        *

*           information will appear on the screen as the process progresses.          *

*                                                                                     *

*           Your operating system may attempt to query the disk unless you have       *

*           unmounted it (unassigned drive letter in Windows, umount in UNIX/LINUX).  *

*                                                                                     *

*           If you used a wildcard, or a list of devices, and do not answer YES       *

*           to write data on the disk described below, then it will be skipped and    *

*           the program will select the next disk in the list and repeat this message *

*           until all disks have been skipped or formatted with the supplied byte.    *

*                                                                                     *

***************************************************************************************

 

This will write the byte E6h across the entire SEAGATE ST336753FC disk at /dev/sg5

Are you sure you want to do this? Answer "YES" to begin the operation, anything else exits program: YES

 

Beginning WRITE SAME formatting for SEAGATE ST336753FC at /dev/sg5 (71687371 blocks, blocksize=512)

99%    0.1 Mins Remaining (< --- This line is updated after every 1% completion)

 

WRITE SAME completed.

 

Program Ended.

 

Persistent Device Names Warning

Unless your operating system uses persistent device names, you should not automate any tests that are destructive in nature unless there are fail-safes to verify you are performing the action on the device you want to perform the action on.  That is because if you add or remove hardware, reboot your machine, the device name for a particular peripheral may change.

 

 

Frequently Asked Questions

What is the -wsbyte command good for?

There is generally no faster way to destroy data on your disk (without smashing it into little bits) then by using this command. Since you can also set the byte pattern, you can make multiple passes to prevent data from ever being recovered (except for the types of government agencies that can recover anything).

 

If you are trying to certify a disk drive, or do burn-in, send the E6 pattern with the -wsbyte or -wsbyteconfirm, follow up with the -scrub family of read commands, run the -steb, and repeat. This tests every component of the device including every block of media as well as the electronics components. Seagate recommends using the E6 pattern as it will generally sniff out more weak sectors that would need to be remapped.

 

What about host overhead?

SMARTMonUX sends only one I/O command to write 30MB at a time. Even measuring this amount of overhead generates a higher load then zeroing your disk. (Note, due to the pass-through I/O limitations unique to SGI's IRIX operating system, the -scrub family of commands will run significantly slower on that platform. (That is because the O/S does not support multiple concurrent pass-through commands to the same device, the handle must be opened & closed between I/Os.). These limitations will not affect the ANSI-type self-test commands, and they will not be noticeable with the write same commands since they might generate only one or two I/Os per second.

 

Is this a safe operation?

It is safe to do this on any disk other than your O/S disk and any disks required by your O/S, such as swap, to stay alive. Of course, all data will be destroyed on that disk, but it will not hurt the drive.  In fact, storage manufacturers use the write-same command as means of stress testing drives to make weak sectors fail so those defects can be remapped.

 

How long does this take?

A fast 73 GB disk typically completes in around 15 minutes.

 

How do I test really large devices, like a 5 TB LUN on a RAID controller?

Append the -16 function, which instructs the software to send 16-byte SCSI commands.  These commands are required for devices greater than the approximately 2.1 TB limitation for the 10-byte SCSI commands.

 

 


Page url: http://www.santools.com/santool/index.html?erase.htm