I recently bought a second-hand camera – but this is not specific to photography (but perhaps particularly relevant). The seller threw in an old SD card which was nice of them (although unnecessary for me).
After doing the photo thing with the new-to-me camera, and having carefully replaced the SD card, it occurred to me that I could test a file recovery tool to see if there was any previously shot photos on the card.
Using photorec, I fired it off and came back 30m later – not because it’s particularly slow but I have spent far too much time watching the equivalent of a progress bar, and I would rather get on and do something useful.
By the time I came back, it had recovered in excess of 1,000 images and videos. It turns out to be probably the most boring collection of photos you can imagine – an ordinary collection of family (not your own) photos would be interesting in comparison.
I won’t be including any of those recovered photos here because that would be unprofessional and potentially embarrassing to the camera seller (although they would most likely never find out).
But you can easily imagine how such a recovery could be potentially embarrassing; even distressing. We usually choose whether a photo should be made public or not.
So how do you protect such things from happening? Is it sufficient to format a card in camera?
No it isn’t. Tools such as photorec are designed to recover images from cards where the images have been deleted or when the card has been formatted. Surprisingly enough, formatting a card does not overwrite all of the data blocks on a storage device; it merely replaces the data structures that allows an operating system to find files with a new blank structure.
So what are the solutions to keep your private photos to yourself?
It should be emphasised that this is advice intended to protect you from personal embarrassment; if there are legal or risk to life issues involved, seek professional advice.
The first rather obvious solution is to never give away or sell old cards; if you want to dispose of the cards, destroy them. It is not as if you could recover much by selling them – who wants a 5-year old 512Mbyte SD card?
If you do want to let others use your old cards, then use a special utility to destroy the contents completely; optionally (but nice for the recipient) is to then format the cards afterwards.
If you are using Windows (or macOS although the following Linux recipe can be adapted), then you will need a tool such as SafeWiper. There are those who claim that Windows format can do the job, but I wouldn’t trust it – the “quick format” option is the default which definitely doesn’t erase the data from the disk, and I have not personally checked that a “slow format” really removes the data beyond recovery with normal tools.
Whatever method you choose, check, double-check, and triple-check that the device you are erasing really
The first step under Linux is to identify the block device path to erase. You may well find that your SD card is automatically mounted when you plug it in. So running df from the command-line will give you a device path (/dev/sdb
But to double check, run lsblk
✓ mike@Michelin» lsblk -o NAME,FSTYPE,MOUNTPOINT,VENDOR,MODEL,SIZE | grep -v loop NAME FSTYPE MOUNTPOINT VENDOR MODEL SIZE sda ATA SAMSUNG MZNTY128 119.2G ├─sda1 vfat /boot/efi 512M ├─sda2 ext4 /boot 732M └─sda3 crypto_LUKS 118G └─sda3_crypt LVM2_member 118G ├─ubuntu--vg-root ext4 / 114.1G └─ubuntu--vg-swap_1 swap [SWAP] 3.9G sdb Generic USB SD Reader 3.8G └─sdb1 vfat /media/mike/disk 3.8G
Note that how we have “USB SD Reader” alongside /dev/sdb and that it’s size is just 4Gbytes. So we have three confirmations that this is the device we want to erase.
To erase it, first we unmount it, run a hdparm command to erase it, and erase it a second time :-
✓ mike@Michelin» umount /dev/sdb1 ✓ mike@Michelin» sudo hdparm --security-erase NULL /dev/sdb security_password: "" /dev/sdb: Issuing SECURITY_ERASE command, password="", user=user SG_IO: bad/missing sense data, sb: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 SG_IO: bad/missing sense data, sb: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 SG_IO: bad/missing sense data, sb: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ✓ mike@Michelin» sudo dd if=/dev/zero of=/dev/sdb bs=64M
Whilst we’re waiting for the “dd” command to finish writing zeros all over the SD card, why are we erasing this twice?
We’re using hdparm
And I then suggest using the old slow method of “dd” as well because there is nothing wrong with being cautious in this area.