Live data from Hacker News

SD Memory Card Formatter for Linux

sdcard.org

51–60 of 60 posts

Re: SD Memory Card Formatter for Linux

#51
post #36

Earlier quoted context omitted.

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.

Re: SD Memory Card Formatter for Linux

#52

So much confusion in this discussion. Let me try to clarify (all of this is very very simplified). 1. NAND in SD cards has page size (minimum writeable piece) something like 4kB or 8KB, or maybe even 64KB. But as per spec SD cards must allow writes at 512 byte granularity. Aligning your file system clusters with these flash pages will allow SIGNIFICANTLY better performance and lower wear. How? Well in the CSD registe…

> Well in the CSD register (accessible using SD commands), the NAND geometry is given

Is this difficult to obtain (e.g., via ioctl(2)) and parse?

[edit] looks like it's readable from sysfs: https://www.kernel.org/doc/html/latest/driver-api/mmc/mmc-de...

Parsing is another matter. It would be really useful if e.g., parted could read/parse that and then automatically align created partitions!

Re: SD Memory Card Formatter for Linux

#53
post #44
post #8

Earlier quoted context omitted.

Is closed source not allowed for Linux? If you want an open source SD card formatter for Linux, you can mkfs.vfat /dev/mmcblk0 all day long, works just fine.

Would you entrust a software you can’t audit to format your computer’s disks?

Would you entrust a software you can’t audit to format a device with software you can’t audit?

Re: SD Memory Card Formatter for Linux

#54
post #36

Earlier quoted context omitted.

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.

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.

Re: SD Memory Card Formatter for Linux

#55
post #36

Earlier quoted context omitted.

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.

Re: SD Memory Card Formatter for Linux

#56
post #52

So much confusion in this discussion. Let me try to clarify (all of this is very very simplified). 1. NAND in SD cards has page size (minimum writeable piece) something like 4kB or 8KB, or maybe even 64KB. But as per spec SD cards must allow writes at 512 byte granularity. Aligning your file system clusters with these flash pages will allow SIGNIFICANTLY better performance and lower wear. How? Well in the CSD registe…

> Well in the CSD register (accessible using SD commands), the NAND geometry is given Is this difficult to obtain (e.g., via ioctl(2)) and parse? [edit] looks like it's readable from sysfs: https://www.kernel.org/doc/html/latest/driver-api/mmc/mmc-de... Parsing is another matter. It would be really useful if e.g., parted could read/parse that and then automatically align created partitions!

Partition alignment also depends on the file system options you plan to use to format it. Eg: depending on cluster size you choose, the size of the FAT differs, which in turn shifts the start sector of the first cluster. So, really, partitioning and formatting NEED to be done cooperatively and not independently. That’s the purpose of this tool, really.

Re: SD Memory Card Formatter for Linux

#57

Is "format_sd" going to find its way into all the Linux distributions as a standard command? Would it's license preclude doing so?

>Would it's license preclude doing so?

It would. Most distributions will never ship this, because it is closed source code of questionable usefulness.

Re: SD Memory Card Formatter for Linux

#58

18 months ago I whined to their devs it'd be nice to have a version of their SD formatter for Linux, et voilà!, 18 months later, BOOM! - Awesome!! ... I"m not sure if my petulant whining and life-draining email verbosity provided the underlying motivation to their acquiescence, but until I'm provided contrary proof I'll assume it's so ;o)

> Developed by Tuxera

https://www.tuxera.com/

Re: SD Memory Card Formatter for Linux

#59
post #52

Earlier quoted context omitted.

> Well in the CSD register (accessible using SD commands), the NAND geometry is given Is this difficult to obtain (e.g., via ioctl(2)) and parse? [edit] looks like it's readable from sysfs: https://www.kernel.org/doc/html/latest/driver-api/mmc/mmc-de... Parsing is another matter. It would be really useful if e.g., parted could read/parse that and then automatically align created partitions!

Partition alignment also depends on the file system options you plan to use to format it. Eg: depending on cluster size you choose, the size of the FAT differs, which in turn shifts the start sector of the first cluster. So, really, partitioning and formatting NEED to be done cooperatively and not independently. That’s the purpose of this tool, really.

Yeah good point. Back in the distant past, parted manged the creation of filesystems as well as the partitions on which they are created. It's a shame that was all removed because this is exactly why it's needed!

Re: SD Memory Card Formatter for Linux

#60
post #55

Earlier quoted context omitted.

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 le…

You are correct, I was thinking of MTP.

Thank you for the education.

Post reply on HN