4

I always wondered why there is unallocated space at the beginning of any medium written with a Raspbian image file.

I usually use dd to do so, whatever medium I use (flash drive, SD card or USB drive) so I know this is the raw data from the image ; but I have always ~4MB of unallocated space at the beginning, before the boot partition.

Is there any reason to have this unallocated space between the MBR and the boot partition?

1 Answer 1

2

SD Cards can only erase blocks of a minimum size - usually 4MB.

Any files which overlap the Erase Block boundaries require 2 blocks to be erased (and possibly rewritten) so Raspbian partitions are arranged on 4MB boundaries.

5
  • 1
    ... and if using the very first 4MB block it will overwrite the Master Boot Record (MBR). So you have a gap of 4MB - 512 bytes.
    – Ingo
    Commented Mar 2, 2019 at 21:03
  • @Ingo Indeed, I understood the unallocated space gap was because of the need to write the MBR, because the erase block size is 4MB. It is indeed lacking in Millikays' answer. The only thing that is puzzling me is, from what the information I could gather, the erase block size could be different depending on the SD card. Am I missing something?
    – Paradox
    Commented Mar 12, 2019 at 7:02
  • @Paradox Quote: ".. the erase block size could be different depending on the SD card." Really? Haven't observed it. I'm not the storage specialist. Maybe the driver "asked" the SD Card for its erase block size (looking at a parameter table on the SD Card or so)?
    – Ingo
    Commented Mar 12, 2019 at 10:52
  • @Ingo "An erase block is the smallest unit that a NAND flash can erase, typically the size is 2 MB depending on the size of the actual NAND flash chips, although older NAND flashes sometimes have erase blocks as small as 128 KB.". The only thing I am sure is the driver does not know about the erase block size. Even for other trivial information, you can find a lot about "proper partioning" for SD cards/SSDs, e.g. here
    – Paradox
    Commented Mar 15, 2019 at 16:50
  • @Milliways maybe you know more about it?
    – Paradox
    Commented Mar 15, 2019 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.