Wednesday, October 19, 2011

Quick fix for secure erase of used SSD

I just bought a Corsair Force3 SSD on-sale at Fry's.  I saved money coming and going, in fact, as there was a mail-in rebate and the drive had been returned by someone else -- so it was discounted another $15.  These particular drives use the new 'SandForce' SSD controller which have lots of reliability problems so they probably need to offer the rebates to move them off the shelves...  Now, why did I bother buying one??

The first thing I checked was the firmware on the drive.  'Fortunately' it was not running the current v1.3.2 which tells me any problems the original purchaser had might have been fixed by this firmware upgrade.  I proceeded to install the new firmware and had no problems.  Now all that remained was to do a secure-erase, to ensure I got the correct 'New Drive' performance.  (The write-speed on SSDs gradually drops as they get full and the 'free space' becomes fragmented. Since the physical memory 'sectors' are remapped 'logical sectors' you can't use a traditional OS or application defragger.)

Most of the online instructions said to download the Parted Magic ISO, boot from it, then select the 'Erase this drive' option in the GUI.  You also need to select the 'Internal' mode (which tells the drive to do it's built-in erase command) rather than 'External' mode (which manually rewrites the entire drive and just adds wear to an SSD).  I knew that Parted Magic just relies on the same Gparted and 'hdparm' commands on my beloved Ubuntu, so I decided to just use an Ubuntu boot-drive I already had setup.

Here's where the problem came in, and the fix:

For whatever reason the Ubuntu flash-boot and/or the BIOS locked the drive.  I was able to run the basic-query hdparm command successfully,
 > sudo hdparm -i /dev/sda

But when I tried to run the advanced query,
 > sudo hdparm -I /dev/sda

or when I tried to trigger the internal secure-erase command,
 > sudo hdparm --security-erase NULL /dev/sda

I got an error message re "Input/Output Error"

After much googling I finally found one discussion (on the Intel SSD forums) which made passing reference to either hot-swapping the drive or sleeping/waking the machine.  From my Ubuntu 10.10 flash-drive boot, I was able to click the 'Suspend' command, then power-on again, and the hdparm command now worked.