The prebuilt image file for FreeBSD 11.0-RELEASE for the Raspberry Pi 2 contains the following partition layout: => 63 2097089 md0 MBR (1.0G) 63 102375 1 !12 [active] (50M) 102438 1994714 2 freebsd (974M) => 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 sectors. 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 use an offset of 2048 sectors for the first MBR slice. Slice 2 has an offset of 102438 sectors, and is further sub-partitioned using the BSD scheme. BSD partition 1 has an offset of 90 sectors from the beginning 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 follows: => 63 2097089 md1 MBR (1.0G) 63 8129 - free - (4.0M) 8192 122880 1 !12 [active] (60M) 131072 1966080 2 freebsd (960M) => 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 it.
How have you confirmed the default layout increases write amplification?
I have not confirmed it. I don't know how to check for write amplification on an SD card. I understood it to be a well established principle that proper partition alignment on flash-based storage is just as important as it is on Advanced Format hard disks for performance reasons, if not more so due to the potential impact on the life of the storage. I will attempt to run some comparative testing between the release image and my one with partitions aligned to see if there are performance differences.
Some (non-authoritative) sources for the assertion that partitions should be properly aligned: http://3gfp.com/wp/2014/07/formatting-sd-cards-for-speed-and-lifetime/ https://lwn.net/Articles/428584/ It is suggested that the SD Association's own SD formatting utility aligns the single partition on an SD card to 4MiB. I will verify this.