Subject: Re: disabling disk error recovery/wiping a defective disk
To: None <netbsd-users@netbsd.org>
From: Wolfgang S. Rupprecht <wolfgang+gnus20050530T091854@dailyplanet.dontspam.wsrcc.com>
List: netbsd-users
Date: 05/30/2005 09:52:54
"Steven M. Bellovin" <smb@cs.columbia.edu> writes:
> I have a disk with enough unreadable portions that it's being replaced 
> under warranty by the vendor.  I would like to overwrite whatever 
> portions of the disk I can.  Trying to do that in a straight-forward 
> fashion runs afoul of the error recovery code; it slows down the 
> attempt or even prevents it.  Any suggestions on what to do?  (This is 
> an SATA disk on -current/i386.)

(The method I'm partial to is getting a machine shop person to run the
disk through a band-saw length-wise.  Then send the disk halves out
for grinding / melting.)

Some of the current ATA-type disks seem to have a security erase
function.  I'd be tempted to grab the bits from openbsd's atactl(1)
and give this command a try:

     secerase user|master [enhanced]
              Erases all user data and unlocks the specified device.  Execu-
              tion of this command with the master password is the only way to
              unlock a device locked at maximum security level with the
              secsetpass command if the user's password is lost or unknown.
              There are two erase modes: normal and enhanced.  Default erase
              mode is normal.  In the normal erase mode this command will
              write binary zeroes to all user data areas.  The enhanced erase
              mode is optional and may not be supported by the device.  When
              enhanced erase mode is specified, the device will write prede-
              termined data patterns to all user data areas.  In enhanced
              erase mode, all previously written user data will be overwrit-
              ten, including sectors that are no longer in use due to reallo-
              cation.  This command will disable the device lock mode, howev-
              er, the master password will still be stored internally within
              the device and may be reactivated later when a new user password
              is set.

I'm not sure I'd entirely trust the erase without spot checking a
random selection of blocks near the end of the disk.

As an aside, I've had very few disks truly fail, but many disks I own
have had flurries of bad blocks during one portion of its life.  It
was almost always a cabling / motherboard / powersupply / ventilation
issue.  Fixing the underlying problem and dd-ing zeros over the whole
raw disk always seemed to make a perfect disk that had many happy
years without any further bad block problems.

-wolfgang