Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jul 2022 18:20:05 -0300
From:      "Dr. Rolf Jansen" <freebsd-rj@cyclaero.com>
To:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: Partition layout of ARM SD card images
Message-ID:  <45F48B1C-05D3-4786-B40E-57F281FDE558@cyclaero.com>
In-Reply-To: <512e33ac-1165-61c2-62b9-717a67676873@denninger.net>
References:  <1F42EED0-B39F-4E33-986A-FB70A3AA4362@cyclaero.com> <YssxIgm/ulr0%2Bp4L@phouka1.phouka.net> <512e33ac-1165-61c2-62b9-717a67676873@denninger.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_50CFE346-C2DF-485B-8723-DA15CDB2408D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

> Am 10.07.2022 um 18:09 schrieb Karl Denninger <karl@denninger.net>:
>=20
> On 7/10/2022 16:05, John Kennedy wrote:
>> On Sun, Jul 10, 2022 at 04:26:02PM -0300, Dr. Rolf Jansen wrote:
>>=20
>>> ... 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 =3D 104448, which as a matter of =
fact is 4k aligned (104448*512/4096 =3D 13056) and 1M aligned as well =
(104448*512/1024/1024 =3D 51), however all this keeps looking strange.
>>>=20
>>> Are there reasons for this partition layout besides making it look =
more interesting? If yes, some insights would be good.
>>>=20
>>  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.
>>=20
> =46rom 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.

This is common knowledge for more than a decade, and therefore I skipped =
the explanation on why this is important.

The question in the first place is why the official images, which the =
installation instructions tell us to copy via dd to the SD card are not =
aligned by 100%. However, perhaps I am missing some points regarding the =
internals of SD cards, of the MBR, of the Fat32 scheme. Perhaps the =
actual useful data here starts at an uneven block - I don't know =
therefore the question why, despite of the common knowledge, the =
partition table look strange.=

--Apple-Mail=_50CFE346-C2DF-485B-8723-DA15CDB2408D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" =
class=3D""><blockquote type=3D"cite" style=3D"font-family: =
SourceCodePro-Light; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D"">Am 10.07.2022 um 18:09 schrieb Karl =
Denninger &lt;<a href=3D"mailto:karl@denninger.net" =
class=3D"">karl@denninger.net</a>&gt;:<br class=3D""><br class=3D"">On =
7/10/2022 16:05, John Kennedy wrote:<br class=3D""><blockquote =
type=3D"cite" class=3D"">On Sun, Jul 10, 2022 at 04:26:02PM -0300, Dr. =
Rolf Jansen wrote:<br class=3D""><br class=3D""><blockquote type=3D"cite" =
class=3D"">... 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 =3D 104448, which as a matter of =
fact is 4k aligned (104448*512/4096 =3D 13056) and 1M aligned as well =
(104448*512/1024/1024 =3D 51), however all this keeps looking =
strange.<br class=3D""><br class=3D"">Are there reasons for this =
partition layout besides making it look more interesting? If yes, some =
insights would be good.<br class=3D""><br class=3D""></blockquote>&nbsp;I =
think there are historical reasons, probably more with not "wasting"<br =
class=3D"">space on small SD cards (~512 byte blocks). &nbsp;I haven't =
had it bite me<br class=3D"">recently, at least, but I imagine the =
FreeBSD folks are trying (perhaps<br class=3D"">vainly) to keep image =
count to a minimum. &nbsp;I think I was tweaking my<br class=3D"">images =
from RPI2 and later to 4K and 1M like you are to line up with the<br =
class=3D"">storage I had them stored on and the filesystems inside the =
partitions.<br class=3D""><br class=3D""></blockquote>=46rom 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. =
&nbsp;Never mind serious performance problems you may run into on =
writes. &nbsp;This is true for both SD and uSD cards, but particularly =
the latter (e.g for Pis and similar.<br class=3D""></blockquote><br =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: =
SourceCodePro-Light; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
0); color: rgb(0, 0, 0); font-family: SourceCodePro-Light; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: =
normal; letter-spacing: normal; orphans: auto; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: =
auto; word-spacing: 0px; -webkit-text-size-adjust: auto; =
-webkit-text-stroke-width: 0px; text-decoration: none; display: inline =
!important; float: none;" class=3D"">This is common knowledge for more =
than a decade, and therefore I skipped the explanation on why this is =
important.</span><br style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, =
0, 0); font-family: SourceCodePro-Light; font-size: 12px; font-style: =
normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
0); color: rgb(0, 0, 0); font-family: SourceCodePro-Light; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: =
normal; letter-spacing: normal; orphans: auto; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: =
auto; word-spacing: 0px; -webkit-text-size-adjust: auto; =
-webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: =
SourceCodePro-Light; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =
text-decoration: none; display: inline !important; float: none;" =
class=3D"">The question in the first place is why the official images, =
which the installation instructions tell us to copy via dd to the SD =
card are not aligned by 100%. However, perhaps I am missing some points =
regarding the internals of SD cards, of the MBR, of the Fat32 scheme. =
Perhaps the actual useful data here starts at an uneven block - I don't =
know therefore the question why, despite of the common knowledge, the =
partition table look strange.</span></body></html>=

--Apple-Mail=_50CFE346-C2DF-485B-8723-DA15CDB2408D--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45F48B1C-05D3-4786-B40E-57F281FDE558>