We all use usb thumb memories, or memory cards like SD or microSD for our cellphones, cameras, or just to exchange data between computers.
But when you share yours with a colleague or friend, you would want to erase that important project you are working on, or those pictures of your kids, before lend it to him.
If you are working with Linux Operating System, and I’m sure you are as you’re reading this, you have a very strong tool available for this job.
Warning: If you use this how-to and you’ve made no backup, or you use it with the wrong disk, you are going to LOOSE all your data, so be aware of that
I’m sure there are other methods, but the one I prefer to use is the one that uses dd to copy zeros, or random data in the file system I want to wipe.
So, run this command if you want to erase your… let’s say microSD card.
Suppose it is mounted on /dev/sdd1
dd if=/dev/urandom of=/dev/sdd1
If you do not want to wait too much, you can fill the partition with zeros instead of random data
dd if=/dev/zero of=/dev/sdd1
Both are secure, but IMHO the first one may be better, but of course I can be wrong.
Once again, be sure to double check, or better triple check on which partition you are going to apply this, you will not be warned by Linux, and the result can not be undone.
A good practice could be to first make an image of the disk and then wipe it. If you want to proceed that way, do this.
dd if=/dev/[partition-to-wipe] of=/tmp/backup.img
Then wipe it
dd if=/dev/urandom of=/dev/[partition-to-wipe]
You can then recover the data by doing
dd if=/tmp/backup.img of=/dev/[partition-to-wipe]
If you enjoyed the article, please share it