0

My SD card was stolen some weeks ago. I can't know which SD card is mine, because the thief formatted it. As such, I bought a new one.

In order to prevent such situations in the future, I thought of creating a hidden, undeletable file, which would persist, even in the event of the SD card being formatted.

Is this possible? How can I create such a file?

  • 1
    You appear to have an X/Y problem. You want to be able to identify a SD card, so you want this other process to work. What is your primary concern? To identify the card or to create an undeletable file? – schroeder May 13 at 13:06
  • my old SD card stolen & friend of mine told me someone of his friends sold him my SD card (We not sure) so i want a way to identify my new SD card in case this thing happened again – Esmail EL BoB May 13 at 14:05
  • Ok, then this specific solution is not what you are most concerned with. Why not just physically mark the card? – schroeder May 13 at 14:06
  • afraid to hurt the SD card – Esmail EL BoB May 13 at 14:07
  • 3
    magic marker works well – schroeder May 13 at 14:26
7

It's not possible to make an "un-deletable" file, because formatting an SD card doesn't delete the file. Formatting the SD card removes the data structure that tells you that the file ever existed.

Even if you were to use forensic tools to examine the SD card, the thief could simply overwrite the entire SD card with zeroes, random data or whatnot, and you would be out of luck again.

What you can do however is physically mark the SD card. Non-erasable pen with your initials should work just fine. This should physically mark your SD card as yours. While it doesn't prevent theft outright, it might cause someone like a classmate to hesitate from taking your SD card.

Other than that, I would recommend taking better care of your removable media.

  • Don't leave your SD card unattended. Always have an eye on it. If you have to lend it to someone, get it back as soon as possible.
  • Always have backups of critical data. The more "spread-out" your data is, the less likely it is to disappear in case of theft, damage to the SD card, accidental deletion, etc.
  • Don't transport potentially sensitive data unencrypted. Always use strong encryption with a long, random passphrase to ensure the confidentiality of your data.
  • Do any SD cards support configuring an HPA? – forest May 14 at 0:40
  • @forest None that I am aware at the top of my head. Theoretically, if they would, it might be possible, but for the average user it's probably not feasible to do. Buying a cheap non-erasable pan and writing "JD" on the card is probably the most practical "watermark" for most users. – MechMK1 May 14 at 4:42
3

Yes it is possible but not easy. If you can hack the SD microcontroller you can do that and much more. The theory was demonstrated back in 2014 at CCC event.

https://media.ccc.de/v/30C3_-5294-en-_saal_1_-201312291400-_the_exploration_and_exploitation_of_an_sd_memory_card_-bunnie-_xobs

The problem is that is hard and specific to the microcontroller the SD card is using.

0

Strictly speaking, this is impossible (you cannot create something that nobody else can delete), although you can make it unlikely that somebody would find the file. SD cards, like most "block storage devices", can be partitioned; split into multiple parts, each of which show up as their own "storage volume" (and, on Windows, typically each get their own drive letter). Each partition is (usually) formatted separately, so if your thief only formats one partition, they won't get data stored elsewhere in the device. In fact, you don't really format a disk or SD card, you format a volume, which is usually a single partition and (on removable media) often the only partition, but doesn't have to be.

If you shrink the default (single) partition of your SD card just slightly, you can create space at the end of the device that will not be touched by reformatting the (visible) partition. You can then:

  • Leave that space un-partitioned, but optionally put some data there anyhow. This is somewhat tricky to do, especially on Windows, but it can be done.
  • Create a partition there and leave it unformatted, but optionally put some data in it anyhow. This is also somewhat tricky and mostly the same as the previous option.
  • Create a partition and format it, but with some format Windows doesn't know how to read. This is slightly more likely to fail - with the right driver installed, Windows can read anything, and it will mount any volume it can read as a drive letter that a thief would readily see - and is of course hard to do from within Windows (but what says your thief uses Windows anyhow?).
  • Create a partition, format it with a Windows-readable file system, and mark it as a partition type that Windows does not normally assign a drive letter to and/or set a flag telling Windows not to give it a drive letter. This can technically be done with out-of-the-box Windows tools, but may require converting the SD card from "MBR" format (old but very widely supported) to "GPT" format (newer and with lots of new features, but stuff like cameras and whatnot may not be able to use it).

I should stress that none of this is SECURITY at all; you're just hoping the thief doesn't bother to look. There is no way to actually secure an SD card such that you can use it but nobody else can. (SD cards do support password locking, but most OSes can't set the password or work with password-locked cards, and an attacker who knows how can reset the password anyhow, destroying all data on the card but making it available for any use.)

  • its great idea (but i just want know more about last step "Create a partition, format it with a Windows-readable file system, and mark it as a partition type that Windows does not normally assign a drive letter to and/or set a flag telling Windows not to give it a drive letter. This can technically be done with out-of-the-box Windows tools, but may require converting the SD card from "MBR" format (old but very widely supported) to "GPT" format (newer and with lots of new features, but stuff like cameras and whatnot may not be able to use it)." i already changed SD card to GPT – Esmail EL BoB May 14 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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