Does SD Expansion Card support discard?

I’m contemplating buying the new SD Card expansion module, but I’d like to know whether it supports erasing SD cards. The SD Card protocol specifies an erase command, and Linux does support invoking it on supporting hardware. The only device I have found where I can run blkdiscard to erase an SD card is my Raspberry Pi. It appears that most SD card adapters attach to USB and adopt the USB Mass Storage protocol, which does not provide any way to deliver an erase command to an inserted card. The SD Card slot in the Raspberry Pi is attached directly to GPIO pins on the CPU, so Linux can send any command it wants to the card without the interference of an abstraction layer. Mind you, I really am speaking of erasing, as distinct from overwriting with null bytes; the erase command in the SD protocol is analogous to the TRIM command in the ATA protocol. Note that fstrim works great on my Raspberry Pi and really erases vacant blocks on the SD card (much faster than overwriting them with null bytes would be). I would like to be able to use fstrim/blkdiscard on my FW Laptop too, thus my question. Thanks.

Since the Framework expansion cards are also connected using USB (and presumably Mass Storage, because what else would they use?), I think you have the answer there.

It isn’t quite so cut and dried. IIRC, the Framework SD Card expansion module supports UAS (USB-Attached SCSI) in addition to the standard USB Mass Storage Class. So maybe what I’m really asking is: does UAS add support for discard/trim/erase (and, if so, does the module implement it correctly)?

Edit: I might be misremembering. Maybe it’s only the storage expansion cards that support UAS, not the SD card expansion module.

1 Like