I want to sell two hard drives. Both have been used in a software RAID5 with a logical volume manager.

I want to delete all data in order to sell them. But on the devices are no partitions.

Is it necessary to clean the drives? Are there any data saved on the drives? And if so, what is the action I need to take to delete all data from the drives?

  • 7
    I shit you not, we once bought some 2nd hand blades for a lab. Turns out they had come from a bank and some monkey had deleted the partitions, but done nothing else. For fun we tried to recover the data on them and almost died when they booted into RHEL. Needless to say we securely wiped them before going any further. Commented Mar 6, 2012 at 22:09
  • See?? It happens.
    – JohnThePro
    Commented Mar 6, 2012 at 22:11
  • @MarkHenderson That's scary! Commented Mar 6, 2012 at 22:11

6 Answers 6


The data would be relatively safe from being recovered given a couple of things. The RAID5 set was more than 3 drives and the drives are not going to be sold to the same person/company. But even then a close look at the drive's data could contain strings etc.

If the drives are going to one person/company then it's possible to force the RAID back together in a degraded state. From there you can recover the LVM metadata and reconstruct the logical volumes.

So I'd do a quick wipe using dd and call it a day. Using dd if=/dev/zero of=/dev/sdb bs=1M is probably the fastest way and is a good enough wipe to make whatever is on the drives now unrecoverable. Just make sure you change the of= device to be the appropriate drives.

If you're really paranoid you can use a better wiping tool but it's not really necessary unless there are some regulations on the data that you were storing.

  • Would a close look at drive data give any meaningful strings except RAID metadata? I thought the whole point was that all the data (+parity) was evenly spread over all the volumes meaning with one drive you could only get fragments of strings?
    – Robin Gill
    Commented Mar 6, 2012 at 22:14
  • 2
    hdparm --security-erase is faster than dd and puts less load on the system.
    – psusi
    Commented Mar 6, 2012 at 22:17
  • 2
    @RobinGill the default chunk-size is 512K. So while it does spread the data around for redundancy there are continuous blocks of data on any given drive. And 512K can hold quite a few social security numbers. Commented Mar 7, 2012 at 0:24
  • 1
    @psusi according to the man page even on my Ubuntu 12.04 system states that the security-* commands are Experimental. But looks interesting. I wasn't aware of that option within hdparm. What makes this really interesting is that it even erases blocks that were marked as bad. Commented Mar 7, 2012 at 0:33

If it is a boot disk, you may use DBAN tool for a secure wipe. http://www.dban.org/

  • +1 for DBAN, although from my experience it seems to get on better with commodity SATA controllers rather than server class SAS controllers.
    – Robin Gill
    Commented Mar 6, 2012 at 22:11
  • Never tried it with SAS, I only remember that I always had to use the latest unstable to have it recognize my new chipset Commented Mar 6, 2012 at 22:13

If you are running Linux, there are several commands that can be used to wipe a disk :

dd if=/dev/urandom of=/dev/sdx
shred -vn /dev/sdX
badblocks -c 10240 -s -w -t random -v /dev/sdx

where sdx is your HDD. These commands will fill the HDD with random data and are therefore very long to run (approx 1min/GB). You may also use /dev/zero (instead of /dev/urandom) which is faster but a little less secure.

You may also wipe the first megabytes (which imho provides good enough security) of you HDD with the following command :

dd if=/dev/zero bs=1000000 count=100 of=/dev/sdx

If you sell the two disks separately, it is quite unlikely that someone is able to extract data from one them so you can sell them without wiping data.


I like DiskWipe. Lots of different standards if you need them, and free. If you've thought about the data on there as already being of risk, do it. Save yourself the worries. It's not like you have to actually do it, haha. Start the software, let it do its thing.


If the data is not sensitive, then several of the suggestions above are fine. Write random data, write zeroes, use a commercial wipe tool, maybe run it a few times for good measure. The RAID stripe size will mean recoverable data without the wipe, but with it, you would need special tools for recovery.

If the drives had sensitive data on them (anything confidental, trade secret) or anything under a compliance regime such as HIPAA, PCI, etc. then just re-use or destroy them; don't sell them. There are many services that do secure data destruction, or just yank the platters out and sand them.


A few commenters have mentioned using hdparm --secure-erase, which sends an ATA SECURE ERASE command, and I thought it's worth a bit more detail.

On self-encrypting drives, a secure enhanced erase command can be nearly instant, as it will simply change the on-disk encryption key, rendering all the existing data unrecoverable. For other drives, the secure erase command will internally, efficientialy write nulls over the entire drive, including remapped sectors. This last point makes it more secure than any other writing to the drive, as they cannot touch remapped sectors.

A modern 1TB drive takes around 3 hours to erase, and because you aren't consuming bus bandwidth to do this erasure (it's all on-drive), you can erase as many drives as you can attach to your system in the same 3 hours (eg, I've erased 16 drives at a time).

Both ATA SECURE ERASE and "simple" methods like a single pass of dd if=/dev/zero might seem less secure than tools that do multiple passes, however in 2006 NIST recommended that a single overwrite pass was enough to protect modern drives (eg, manufactured since 2001) from recovery. Furthermore, NIST states that ATA SECURE ERASE is sufficient to "render sanitized data unrecoverable by laboratory attack methods".

CMRR followed up with a tutorial on disk drive data sanitization. CMRR rate the security of a "SECURE ERASE" as better than the old DoD 5520 Block Erasure standard, as well as pointing out it is significantly quicker. (I believe DBAN used to use the same kind of method as the DoD 5520 standard - multiple passes with different bit patters. I can't actually find what DBAN does now, the docs seem very vague on this)

Detailed instructions on using hdparm to perform are at the libata wiki. There are other tools, such as HDDErase, or the -PdClear command for the megacli utilitity for managing LSI RAID controllers.

The CMRR report also states that, based on the NIST report, ATA SECURE ERASE is sufficient to meet the security requirements of HIPAA, PIPEDA, GLBA, Sarbanes-Oxley, and some others. I've seen other reports that suggest it's good enough for PCI compliances as well, but I trust that source slightly less, although I see no reason why it wouldn't be sufficient for PCI.

  • A couple of comments on SECURE ERASE: When it works, it works well. But I have seen drives with firmware bugs which caused SECURE ERASE to fail. In one case, only about 2/3 of the drive was actually overwritten. In another case, the drive was completely bricked and had to be RMA'd. After you do any erase, do a simple sanity check with something like Testdisk/Photorec to make sure nothing is easily recoverable from the drive. Commented Aug 1, 2012 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .