Photo by Janekpfeifer

I recently noticed one of my SD card was dying. The seller I bought it from proposed to refund me when I send it back to him. That’s cool but… what about my data on it?

Simply deleting files is not an option. Recovering deleted files from a FAT filesystem is just a question of seconds!

I need to scratch data in a way it’s not recoverable.

The not-working ideas

My first idea was to fill the card partition with random data:

dd if=/dev/urandom of=/dev/mmcblk0p1

This raised lots of I/O errors on my system:

oct. 21 23:16:51 hostname kernel: print_req_error: 89 callbacks suppressed

oct. 21 23:16:51 hostname kernel: print_req_error: I/O error, dev mmcblk0, sector 196236928

oct. 21 23:16:51 hostname kernel: print_req_error: I/O error, dev mmcblk0, sector 196237952

oct. 21 23:16:51 hostname kernel: print_req_error: I/O error, dev mmcblk0, sector 196238976 oct. 21 23:16:51 hostname kernel: print_req_error: I/O error, dev mmcblk0, sector 196240000

oct. 21 23:16:51 hostname kernel: print_req_error: I/O error, dev mmcblk0, sector 196241024

oct. 21 23:16:51 hostname kernel: print_req_error: I/O error, dev mmcblk0, sector 196242048

oct. 21 23:16:51 hostname kernel: print_req_error: I/O error, dev mmcblk0, sector 196243072

oct. 21 23:16:51 hostname kernel: print_req_error: I/O error, dev mmcblk0, sector 196244096

oct. 21 23:16:51 hostname kernel: print_req_error: I/O error, dev mmcblk0, sector 196245120

oct. 21 23:16:51 hostname kernel: print_req_error: I/O error, dev mmcblk0, sector 196246144

oct. 21 23:16:52 hostname kernel: buffer_io_error: 55 callbacks suppressed

oct. 21 23:16:52 hostname kernel: Buffer I/O error on dev mmcblk0p1, logical block 1, lost async page write

oct. 21 23:16:52 hostname kernel: Buffer I/O error on dev mmcblk0p1, logical block 10751, lost async page write

oct. 21 23:16:52 hostname kernel: Buffer I/O error on dev mmcblk0p1, logical block 10752, lost async page write

oct. 21 23:16:52 hostname kernel: Buffer I/O error on dev mmcblk0p1, logical block 10753, lost async page write

oct. 21 23:16:52 hostname kernel: Buffer I/O error on dev mmcblk0p1, logical block 24011, lost async page write

oct. 21 23:16:52 hostname kernel: Buffer I/O error on dev mmcblk0p1, logical block 24012, lost async page write

oct. 21 23:16:52 hostname kernel: Buffer I/O error on dev mmcblk0p1, logical block 24013, lost async page write

oct. 21 23:16:52 hostname kernel: Buffer I/O error on dev mmcblk0p1, logical block 41279, lost async page write

oct. 21 23:16:52 hostname kernel: Buffer I/O error on dev mmcblk0p1, logical block 41280, lost async page write

oct. 21 23:16:52 hostname kernel: Buffer I/O error on dev mmcblk0p1, logical block 41281, lost async page write

Finally, it was useless as the partition could still be mounted an its data could be read.