From owner-freebsd-arm@freebsd.org Wed Nov 9 10:58:53 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B355C37CA4 for ; Wed, 9 Nov 2016 10:58:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 517DE13A for ; Wed, 9 Nov 2016 10:58:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9AwrFE038902 for ; Wed, 9 Nov 2016 10:58:53 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-arm@FreeBSD.org Subject: [Bug 214356] Non-optimal partition alignment in RPI2 image Date: Wed, 09 Nov 2016 10:58:53 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: arm X-Bugzilla-Version: 11.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: jason.mann+freebsd@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-arm@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 10:58:53 -0000 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.=