Re: Partition layout of ARM SD card images
- Reply: Dr. Rolf Jansen: "Re: Partition layout of ARM SD card images"
- In reply to: John Kennedy : "Re: Partition layout of ARM SD card images"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 10 Jul 2022 21:09:58 UTC
On 7/10/2022 16:05, John Kennedy wrote: > On Sun, Jul 10, 2022 at 04:26:02PM -0300, Dr. Rolf Jansen wrote: >> ... The start of the fat32 boot slice s1 (containing the u-boot) stuff is neither aligned to 1M nor to 4k, it starts on an odd base. The start of the BSD payload slice s2 and its size are odd as well. The padding of 57 blocks within s2 lets the UFS partition start on a globally even base, namely 104391+57 = 104448, which as a matter of fact is 4k aligned (104448*512/4096 = 13056) and 1M aligned as well (104448*512/1024/1024 = 51), however all this keeps looking strange. >> >> Are there reasons for this partition layout besides making it look more interesting? If yes, some insights would be good. > I think there are historical reasons, probably more with not "wasting" > space on small SD cards (~512 byte blocks). I haven't had it bite me > recently, at least, but I imagine the FreeBSD folks are trying (perhaps > vainly) to keep image count to a minimum. I think I was tweaking my > images from RPI2 and later to 4K and 1M like you are to line up with the > storage I had them stored on and the filesystems inside the partitions. From my experience it is an EXTREMELY bad idea to NOT align SD card images; these cards are notorious for suffering from severe write-amplification problems and if you want to kill them don't align your partitions. Never mind serious performance problems you may run into on writes. This is true for both SD and uSD cards, but particularly the latter (e.g for Pis and similar.) I align partitions for them in my Crochet builds on 4m boundaries (I do not care about wasting a few megabytes per *partition* or filesystem slice). Yes, I know 4m is overkill (1m is probably more than sufficient for current cards) but I prefer not to screw with this in the future as card capacity continues to go up, and it both has and does, and I know of no way to get the *physical* block size that the controller on the card is actually using (what it presents to the interface is not necessarily what it uses internally.) I have a number of devices that boot from these cards and then run from RAM, and if I update something in the booted area (e.g. "mount -o rw /; copy something-from-here-to-there; mount -o ro /") the time for that second command to come back if I do NOT align the partitions is often tens of seconds .vs. a second or two if I do. That's a pretty solid indication that the system is waiting for the controller on the card to do the read/reallocate/re-write thing and its not real happy with what I just asked it to do. Thus I always align them. -- Karl Denninger karl@denninger.net /The Market Ticker/ /[S/MIME encrypted email preferred]/