SD cards trim command

Many modern SD cards support the trim command () in Linux, the problem is that not many SD card readers (Mostly USB) do

So running () on a mounted card will usually return an error such as

fstrim -v /hds/usb
fstrim: /hds/usb: the discard operation is not supported

The command “lsblk –discard /dev/sdf” should tell you whether your SD card/adapter combination support trim right now, so the failure of the fstrim command above can be predicted in advance with this command

Now, assuming your SD card is not mounted, and you need to format it, Will formatting restore the speed ? unfortunately not, to restore the speed, before formatting your SD card, you might want to run the blkdiscard function, mind you, this command will delete all your data !

blkdiscard -f /dev/sdf

but even that might not work

blkdiscard: Operation forced, data will be lost!
blkdiscard: /dev/sdf: BLKDISCARD ioctl failed: Operation not supported

Leave a Reply

Your email address will not be published. Required fields are marked *