[Bug 264090] gpart bootcode safety checks

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 19 May 2022 23:44:34 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264090

            Bug ID: 264090
           Summary: gpart bootcode safety checks
           Product: Base System
           Version: Unspecified
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: piotr.florczyk@gemius.com

gpart bootcode should at least check partition code before writing anything to
disk and abort operation if it's not freebsd-boot.

This is unfortunately based on true story... I had to upgrade couple of servers
which belong to our client. Those servers were installed using dual partition
scheme which puts freebsd-boot as a second partition after efi.

gpart bootcode -p /boot/gptzfsboot -b /boot/pmbr -i1 da0 happily wiped efi
partition (which on FreeBSD < 13.0 is not mounted) making servers unbootable. I
don't have access to console, so admin on another side has to deal with effects
of my muscle memory/incompetence. Considering that zpool upgrade, all
blog/forum posts (related to bootcode) mention '-i1' overwriting wrong
partition by accident is more than possible.

This issue (to some extent) might be related to bug #211503

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