How do I do something similar on a SD card ?
Like reformating the SD card, but at a lower-level to avoid the automatic wear-leveling.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
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.
MMC_ERASE low level command allows for TRIM-like functionality on SD cards (and eMMC chips).
Not all SD Cards and eMMC chips which support the
MMC_ERASE command (and/or newer extensions to it), but most modern (genuine) brand-name and OEM SD cards now support it (e.g. Sasmung EVO brand cards).
USB to SD card adapters ("SD card readers") could support this command by advertising the
UNMAP commands via the USB storage interface, and translating these to the
MMC_ERASE command, but I've yet to find a USB adapter which does this.
This means that to use
MMC_ERASE a "direct" mmc interface is likely to be needed, such as the types which are supported by the Linux
mmcblk device driver, and implemented by hardware in some laptops and other devices such as the Raspberry Pi.
The example below shows the use of
MMC_ERASE on a 2008 1GB SD Card:
~# echo 'some data' > /dev/mmcblk0 ~# dd if=/dev/mmcblk0 count=1 | hd 00000000 73 6f 6d 65 20 64 61 74 61 0a 00 00 00 00 00 00 |some data.......| 1+0 records in 1+0 records out 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000200 512 bytes copied, 0.0138109 s, 37.1 kB/s ~# lsblk -D /dev/mmcblk0 NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO mmcblk0 0 4M 2.7G 0 ~# blkdiscard -v /dev/mmcblk0 /dev/mmcblk0: Discarded 1019215872 bytes from the offset 0 ~# dd if=/dev/mmcblk0 count=1 | hd 1+0 records in 1+0 records out 512 bytes copied, 0.0114608 s, 44.7 kB/s 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000200
Storage tools claims defragging you SD card increases performance, however they sell the product so they can claim whatever suits them.
Though there are other programs that claim it helps:
Fragmentation refers to the tendency of files, stored in the FAT file system, to become broken into pieces that can end up in very different places within a storage card volume. Fragmentation occurs naturally with time when a storage card is used frequently - creating, deleting, and modifying files. This process is entirely invisible to users.
Werner Ruotsalainen at the PPC Magazine blog shares some good information on whether or not Pocket PC memory cards need to be defragmented, and how to do it.
- Yes, it's worth defragmenting them every 2-3 months, if there are frequent writes to the card.
- Never use a Pocket PC utility to do the defragmenting
- Do consider getting a card reader
If you have a card reader, the process is simple: Copy the files to your hard drive, reformat the card (E.g. "format i: /q /u" but make sure you use the correct drive letter!), and then copy your files back to the card.
But here's some Storage Tools info anyway ;-)
Storage Tools Description
The most comprehensive storage card management solution, StorageTools is the first product to offer defragmentation functionality for Pocket PC devices, providing dramatic speed improvements by resolving file fragmentations.
With StorageTools you can get detailed device and file system information about your storage cards, analysis of file allocations (slack space) and fragmentation level.
StorageTools works with all media types available on PocketPC/Windows CE devices, including industry standards: ATA compliant memory cards, Compact Flash cards, MicroDrives, Secure Digital (SD) cards, MultiMedia Cards (MMC) and PCMCIA memory cards. You can format storage media with different file system and cluster size.
Scan tool diagnoses and repairs a variety of media problems. It performs several tests, checking everything from the boot sector to its physical surface. If StorageTools finds a problem, it notifies you before making repairs. Optionally allows making all necessary repairs automatically.
With StorageTools defragmenter you achieve maximum performance under Pocket PC/Windows CE with minimum effort! It includes the most professional and user-friendly features ever found in defragmentation software. You must eliminate fragmentation to eliminate the most basic performance bottleneck on your PocketPC device as you can on your powerful desktop computer.
The StorageTools includes full support for all storage/media cards even transparently encrypted volumes by Sentry 2020 for PocketPC, and includes options to choose FAT type and cluster size when formatting, plus the ability to create a backup FAT to improve storage reliability.
First backup all your data on the SD card. Then you can use the SD Formatter tool and in options select FULL (Erase): https://www.sdcard.org/downloads/formatter_4/