Hacker News new | ask | show | jobs
by idle_zealot 1155 days ago
I've always formatted SD cards like any other block device. This page mentions a secure section of the card that can somehow reduce performance if you don't treat it specially? What is this security section for, and do standard UNIXy partitioning tools have the ability to handle them properly, or do I have to use this proprietary(?) tarball if I want good SD performance?
3 comments

I don't think the page actually says that the security section has anything to do with the potential for poor performance; those are discussed in separate paragraphs. It's mentioning the security section to warn the user that this tool will not actually wipe every byte of the card, just the normal unsecured data storage area.

The performance pitfalls are not stated, but I'd guess they're referring to the possibility of using suboptimal file system block sizes or alignment. I wouldn't worry too much about recent tools getting alignment wrong or recent cards being overly sensitive to block sizes.

The official SD tool probably also ensures that it uses the exact filesystem called for by their standards (ie. when to use FAT32 and when to use exFAT), as a guarantee of compatibility with any device that interprets the standards too strictly.

IIRC there is a reserved area in the beginning of th SD cards flash which is used for internal housekeeping. When this area is overwritten/formatted the card is bricked. [add] The size depends on the size of the card. I think it is around 32KB on cards with a capacity under 2GB.
I do some development with dev boards and firmware stuff and regularly dd images onto SD-card without any skips or something like that. I never bricked any card.
You're right but it doesn't matter here as it is fully hidden. Unless you have an SD card with a buggy firmware or access to manufacturer-specific tool, it is not accessible even when you "deep" format it.
The reserved areas are managed by the ARM cores running inside the SD cards. Your host machine doesn't see them.

In some SD cards you can use proprietary magical commands to communicate with the firmware and update it or ask it to mess with the hidden sections for you, but those options aren't exposed to any disk copy tool I know of.

I'm dubious about this claim, I have completely destroyed the partition table and mkfs on the raw device...
Unless that was an mtd device then you weren't really writing to the raw device
It did show up as sda.. can mtd devices show up as MTD, i thought it had to use some "MTD" app to transfer files to it.
You might be thinking of MTP, used by eg. phones that don't present a block device over USB so that they can internally use a filesystem not supported by Windows; MTP is a higher-level interface more akin to a network file system protocol.

mtd is a Linux driver subsystem for accessing raw NAND or NOR flash devices that don't have an SSD's Flash Translation Layer (FTL) in front of them to provide features like wear leveling. It's most commonly encountered in embedded systems.

You are correct, I was thinking of MTP.

Thank you for the education.

As I understand it there is a controller on your device that emulates a disk drive. The controller is accessing the raw device on your behalf and _should_ not be overwriting any sensitive/forbidden areas of the flash that might brick the device.
This is really the first time I hear about special tools required for SD card formatting. Is it also “wrong” to use MacOS disk utility to format SD cards?