Whether your kernel + SD card combination supports that or not a simple 'sudo fstrim -v /' might tell. The SD protocol defines a block erase command and tools like fstrim are supposed to do the job. But more recent SD card controllers especially when paired with many reserve sectors aren't that much affected.Įdit: A small note regarding 'SD cards don't support TRIM'. On 'the average' SD card this also might restore horribly low performance back to 'factory default' performance. It tells the card's controller that every sector/block of the card does not contain any real data any more and can be considered empty. So why using SD Formatter in the first place? Since this tool implements ERASE CMD38. This tool is used to format SD cards appropriately (partitions it while choosing the 'correct' file system which is either FAT or exFAT) which obviously is pretty useless from Armbian's perspective since burning an OS image as next step both overwrites the partition table and the filesystems present before. Just check articles explaining SSDs and keep in mind that SD cards behave like crappy SSDs from a decade ago containing slow/primitive controllers and do not support TRIM.īTW: This is the only great use case for SD Association's 'SD Formatter'. Now only the 'reserve sectors' are available to perform read/delete/write cycles and if this amount of sectors is small things slow down a lot on average SD cards (not those more recent Samsung). Since the controller has no idea which sectors contain real data and which not ( there's no TRIM support for SD cards) as soon as you completely fill the card once (all space partitioned) from now on the controller considers every sector containing useful data (even if you deleted the data in the meantime - since there's no TRIM support the controller doesn't know what's empty or not, from now on the whole capacity is considered in use). On flash media you can't overwrite directly, it's always a very time consuming read/delete/write cycle, the number a flash cell can be written to is determined by the count of program/erase (P/E) cycles it is designed for, the controller has to take care of this so that all flash cells wear out equally (wear leveling). This is used as reserve (if the controller detects bad sectors, then reserve sectors are mapped in) and to allow somewhat ok-ish write performance when the card gets full. Regarding 'reserve sectors' and overprovisioning: If a card claims it's n bytes in capacity it has internally a larger capacity. Other usesīesides quickly wiping out data for privacy, supposedly blkdiscard, similar to fstrim for an SSD, will improve wear-leveling and make some SD cards generally run a little bit faster. Hopefully someday Linux will allow blkdiscard to be run on removable devices without requiring root privileges which would make it much less dangerous. Unfortunately, using -force means that all checks, including if the drive is in use, are disabled. The current implementation requires the -f, -force option if the drive is already formatted, which is (almost) always going to be the case since SD cards come pre-formatted. That would be a nice safety feature, but it is not true as of this writing. The manpage claims that, to be safe, it will only work if the drive isn't already mounted. You better be sure that you are pointing it at the right device and then double-check again. Since blkdiscard must be run as root, it can easily destroy all of your data. If you do not have a device that can speak directly to the low-level SD card, it is possible to build one out of an Arduino and run SDFormatter.ino. The difference is that kernel needs to have access to the low-level MMC subsystem, which USB abstracts away as a generic "mass storage" device. Note that while this works on my laptop and Raspberry Pi, it would not work on a USB SD card reader. z, -zero zero-fill blocks rather than discard. Use -s if you wish to be a little more secure and force garbage collected blocks to also be erased. As has been pointed out elsewhere, a normal CMD38 will make some blocks appear empty, but leave others plainly visible due to garbage collection. This calls the Linux BLKDISCARD ioctl, which in turn passes CMD38, the same as SD Memory Card Formatter. To quickly erase an entire SD card, you can use the blkdiscard (8) command.
0 Comments
Leave a Reply. |