Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a CF card I'd like to erase. My CF card reader is connected to my Linux machine via USB. How do I do a secure erase (i.e., the ATA Secure Erase functionality) of the CF card?

I have tried hdparm --security-erase NULL /dev/sdc, but I get an error: ERASE_PREPARE: Invalid exchange. In fact, any hdparm command gives me the same error:

# hdparm -I /dev/sdc

 HDIO_DRIVE_CMD(identify) failed: Invalid exchange

I read somewhere that hdparm can't do an ATA Secure Erase of a drive that is connected over USB. Is this true? I tried using sdparm, but sdparm doesn't seem to have the capability to send the ATA Secure Erase command to the CF card. So, what is the proper way to do this?

share|improve this question

You'll be all well with a single overwrite, but if you are paranoid, with multiple overwrites (let's say five times). I suggest you use the dd command.

dd if=/dev/urandom of=/dev/<yourdevice> bs=1M count=8000

Tweak the bs parameters until the operation will be fast enough, then adjust the count (now it is writing 8000 times 1 megabytes of random data). Be very cautious what parameter you give to of, although you can only target unmounted devices, you wouldn't want to randomize a partition that, say, contains all of your works.

share|improve this answer
An overwrite is a good first start, but an overwrite does not erase remnant data that may be left on bad blocks or on remapped blocks. I understand that there can be a significant amount of data left behind, even after a single overwrite. ATA Secure Erase is designed to address this problem. And every source I've ever read says that for flash-based media, it is very important to use ATA Secure Erase: an overwrite is not secure enough. That's why I'd like to use ATA Secure Erase, instead of an overwrite. So, any suggestions on how to do the ATA Secure Erase? – D.W. Aug 10 '11 at 21:28
Let's do some lite Common Criteria then. Do you value the possible damage of a suspected leak of data higher than the CF card? If you do, the simply burn the CF card to ashes. – karatedog Aug 26 '11 at 10:58
@D.W.: Yes, that is true. However, accessing bad or remapped blocks requires some technical investment. You will have to replace the the card's firmware with a hacked version (if that is possible), or directly access the flash memory chips. This probably involves soldering and intricate knowledge of the card's internals. Very probably doable, but definitely not for a few hundred dollars. The CIA will most likely be able to pull it off - a nosy person poking through the card, most likely not. – sleske Dec 26 '14 at 10:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.