Can I use something like the SSD TRIM command on a SD card?

My understanding is that the current SDCARD spec does not include a TRIM command. Although I am not on the committee, Windows 7's support for TRIM will bring it to the attention of many engineers, and it's reasonable to expect that the command will show up in the SD spec within the next few years.

The OS uses the TRIM command to tell the flash device that a sector will not be read again until it is written. This tells the flash device that the sectors do not need to be copied from one page to another before the first page is erased. This can result in significantly improved performance and improved data privacy.

It would be nice if SD cards could give performance similar to SSDs. I don't see any fundamental reason why the small form factor could not support high-speed access. At the moment, though, if you want high-speed performance, you should use an SSD, not a SD card.


I don't know if this is a bogus, but it seems that in Linux fstrim works. I am bit surprised.

fstrim -v /media/32G_SD/
/media/32G_SD/: 7,2 GiB (7705051136 bytes) trimmed

It's 32GiB card formatted with btrfs and I indeed removed around 8GiB. The label is Kingston model: sd10vg2 (grey SD card)

I have to add that you should be careful with fstrim in SSD. And more careful on sdcards. Too much bugs on firmwares. I trust only Intel enterprise series. I had one meltdown with fstrim and SD-card (inaccessible data). I will not fstrim too often on this sdcard and general on sd's.


On Linux:

  • blkdiscard on the unmounted block device (e.g. /dev/mmcblk0) to discard all blocks (renders data inaccessible through normal means, but does not promise to securely erase them).
  • fstrim (on the mounted file system) if you want to keep the data but discard the blocks that are unused.