Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 09 Nov 2016 10:58:53 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-arm@FreeBSD.org
Subject:   [Bug 214356] Non-optimal partition alignment in RPI2 image
Message-ID:  <bug-214356-7@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D214356

            Bug ID: 214356
           Summary: Non-optimal partition alignment in RPI2 image
           Product: Base System
           Version: 11.0-RELEASE
          Hardware: arm
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: arm
          Assignee: freebsd-arm@FreeBSD.org
          Reporter: jason.mann+freebsd@gmail.com

The prebuilt image file for FreeBSD 11.0-RELEASE for the Raspberry Pi 2
contains the following partition layout:

=3D>     63  2097089  md0  MBR  (1.0G)
       63   102375    1  !12  [active]  (50M)
   102438  1994714    2  freebsd  (974M)

=3D>      0  1994714  md0s2  BSD  (974M)
        0       90         - free -  (45K)
       90  1994496      1  freebsd-ufs  (974M)
  1994586      128         - free -  (64K)

The partitions are not aligned to any typical power-of-two flash page sizes,
which may lead to write amplification, decreasing write performance and
increasing the wear rate on the microSD card.

Slice 1, containing the firmware and bootloader, has an offset of 63 sector=
s.=20
This is probably in line with old MBR partitioning using CHS addressing, but
LBA has long since made this practice obsolete.  Most mainstream OSs now us=
e an
offset of 2048 sectors for the first MBR slice.

Slice 2 has an offset of 102438 sectors, and is further sub-partitioned usi=
ng
the BSD scheme.  BSD partition 1 has an offset of 90 sectors from the begin=
ning
of slice 2, for a total device offset of 102528 sectors.

SD cards commonly have a flash erase block size of 4MiB, so it may be
beneficial for the partitions to be aligned to multiples of 4MiB.  This may=
 be
less important for slice 1 which is usually only read from at boot, but very
important for slice 2 partition 1 which contains the read/write root
filesystem.

I have tried recreating the RPI2 image with altered partitioning, as follow=
s:

=3D>     63  2097089  md1  MBR  (1.0G)
       63     8129       - free -  (4.0M)
     8192   122880    1  !12  [active]  (60M)
   131072  1966080    2  freebsd  (960M)

=3D>      0  1966080  md1s2  BSD  (960M)
        0  1966080      1  freebsd-ufs  (960M)

After copying the partition contents from the official image, then writing =
the
new image to an SD card, my RPI2 was still able to successfully boot from i=
t.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-214356-7>