[Bug 211361] suggested boot partition size is too small, bsdinstall creates unaligned partitions

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Jul 25 07:51:55 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211361

            Bug ID: 211361
           Summary: suggested boot partition size is too small, bsdinstall
                    creates unaligned partitions
           Product: Base System
           Version: 11.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: misc
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: des at FreeBSD.org

The gpart(4) man page suggests creating a 44 kB boot partition.  This was fine
for 9 and 10 where gptzfsboot is 42 kB, but 11's gptzfsboot is twice that size.
 Users who followed that recommendation will not be able to install a new
gptzfsboot in their existing boot partition.

The man page should be updated, and the problem should probably be documented
in the release notes.

Standard operating procedure (i.e. what the gpart(4) man page recommends and
what bsdinstall does) is to place the swap partition immediately after the boot
partition, so it is possible to fix this issue on a live system (after
upgrading but before rebooting) by deleting the boot and swap partitions,
creating a new, appropriately sized boot partition, then creating a new,
slightly smaller swap partition.  Here is an example for a two-disk system with
striped swap and either striped or mirrored ZFS:

# swapoff -a
# gpart delete -i 1 ada0
# gpart delete -i 2 ada0
# gpart add -b 40 -s $((512-40)) -t freebsd-boot -i 1 -l boot0 ada0
# gpart add -t freebsd-swap -l swap0 ada0
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
# gpart delete -i 1 ada1
# gpart delete -i 2 ada1
# gpart add -b 40 -s $((512-40)) -t freebsd-boot -i 1 -l boot1 ada1
# gpart add -t freebsd-swap -l swap1 ada1
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1
# swapon -a

The point of $((512-40)) is that we want both the boot partition and the swap
partition that follows it to be aligned on (at least) 4096-byte boundaries. 
The partition table is normally 34 sectors long (see `gpart list | grep
first`), so we round up to 40 and place the boot partition there, and the swap
partition at 512.

Note that bsdinstall creates an unaligned 512 kB boot partition, so all
subsequent partitions will be unaligned, which can cause serious performance
issues on "advanced format" drives.  I recommend fixing this as well.

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


More information about the freebsd-bugs mailing list