9

I'm formatting my SDHC 4GB card before putting an OS on it for my Raspberry Pi.

It says "allocation unit size" 32 KB and gives me options of up to 1024 MB.

What do I do about that?

3 Answers 3

3

You need to select a cluster size, and in Windows this is referred to as "allocation unit size". The data is not read at the byte level, but rather in blocks. Generally, the smallest unit of storage is a sector (traditionally 512 bytes, 4096 bytes for Advanced Format drives), but even that is not how files are stored in file-systems, but rather sectors are grouped together into clusters.

Raspberry Pi itself doesn’t really have a restriction on cluster size, but the operating system you use may. Usually, any standard size will work, but typically, it depends on what kind of files you will be storing on it.

If you are going to be storing lots of tiny files, then select the smallest cluster size possible (one sector; 512 for memory cards). This way you avoid wasting space by having lots of partially unused clusters. If you are going to be storing lots of giant files, then use the largest clusters size possible (usually 64KB; I’ve never seen 1MB clusters :-o). That way you minimize the file-system’s file-management overhead which frees up a little more space for storage.

When not sure, just use 4KB clusters; that works for most general-purpose usage which is why it is usually the default.

1

For an sdhc card, it's wise to choose a size that matches and is aligned with the size used by the controller on the sd card. You'll get much better performance out of a card where the filesystem is aligned on an erase block boundary, and does it's I.O in internal segment sized units.

The size needed varies from card to card. You can use flashbench to work out what the allocation unit and erase size are.

1

I had difficulties to find the right cluster size to make the card work in the phone (Samsung S7 Edge, with Samsung Evo 128 GB). For me, finally what worked is to format the SD Card using USB Flash SD Formatter 4.00, with default cluster size settings. It is available at SDCard.org, here https://www.sdcard.org/downloads/formatter_4/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .