Note: Unlike hard disks, SD cards cannot actually be securely wiped such that data is fully unrecoverable. The only way to do that would be using an erase functionality of its firmware, if it has one. Else physical destruction of the SD card! 🙂
SD cards are commonly used in cameras and smartphones to store photos and other personal content. Even after these files are deleted they can be easily recovered from the SD card. So, it may be essential to completely erase the SD card such that data recovery is very difficult (but not impossible).
- Find out the partition the SD card is mounted as. For example, a SD card I use in my camera is formatted as a FAT32 partition. I plug it into my Ubuntu computer and it is mounted automatically. I can find out its partition by either of these commands:
$ sudo fdisk -l $ sudo blkid
- Unmount the SD card. (Note: Do not eject it.) If you do not unmount it you might get this error while wiping it:
failed to open for writing: Read-only file system
Use the shred program to erase the SD card partition. For example, I find that the FAT32 partition on my SD card is at
/dev/sdb1. I wipe the SD card partition using:
$ sudo shred -v /dev/sdb1
By default, shred will overwrite the entire partition 3 times, making it really difficult to recover any old content from it.
Tried with: CoreUtils 8.23 and Ubuntu 15.10