1

Topic: SD card low-level reset/formatting CMD38

Hi all,

I have been looking for a way to reset a SD card or USB drive, i.e., to let the controller know all cells to be writable again.

E.g., I have overwritten a SD card from /dev/urandom to purge (visible) data remnants (nothing critical) and want to use the card for a new purpose (my raspberry pi...).

Since the device (USB reader controller+memory controller) does not support trim

  hdparm -I /dev/sdX | grep -i TRIM

I wonder, how the wear leaving would affect the card, since I suppose the controller does not know, that all cells are free to be written again.

Apparently, SD cards have a command 'CMD38'
https://www.sdcard.org/downloads/pls/pd … p;e=EN_SS1 (p. 38)
that afais 'resets' blocks on a card.

So far, I have found only an official tool for Win/Mac (near to the specifications) for such a low-level operation - but nothing under Linux.

Would something like that (if possible) be reasonable as an option for gparted? (probably a bit outside the formatting business)

Cheers and thanks,
  Thomas

2

Re: SD card low-level reset/formatting CMD38

GParted is mostly a graphical interface to other libraries and tools that support partition and file system operations.  If you know of a free libre open source software tool that performs the function you are looking for then we could consider including it in a future release.

3

Re: SD card low-level reset/formatting CMD38

blkdiscard may be able to do so for SD cards.
Would be a sensible addition to gparted anyway, to e.g. discard unpartitioned space or empty partitions on SSD's (and maybe SD cards).

4

Re: SD card low-level reset/formatting CMD38

Thanks Fredo for the tip on blkdiscard.

Do you have any information on whether it is safe to run on all cards or SSDs?