Page MenuHomeFreeBSD

Add support for 'BSD' partition layout to bsdinstall/zfsboot

Authored by allanjude on Jun 4 2014, 10:17 PM.



On some Lenovo machines, booting ZFS off MBR partitions does not work

On the Lenovo X61s that we were able to test on at the BSDCan Hackers
Lounge, we were able to get them to boot properly using a BSD
partitioning scheme instead.

  • Add support for BSD partition type
  • Moved the write of the MBR boot sector to the end of the process to

avoid it being nuked by the pedantic zpool labelclear commands

  • Change the MBR code to not always create 2 zpools when using MBR. The

user only wants 2 pools (1 unencrypted to boot, and one encrypted for
data) in the case where they enable encryption. Due to the simplicity of
the code in previous versions of bsdinstall, two pools were used to
avoid a problem with the order of the creation of the partitions to
ensure that there was a partition at the front of the drive for the boot
code, and that the swap partition was the 2nd partition (BSD partition 'b')

  • Some style cleanup to make the flow of the MBR section more clear
  • Write the 'zfsboot' code to the two different places require for MBR and

BSD. Write the larger section first because writing the first sector
first seems to make the BSD partition disappear and appear as an empty
MBR (No idea why this was happening, reproduced on two Lenovo laptops)

  • Resolve variable reuse by renaming 'disksize' in second case to

'usablesize' to avoid disksize being disksize less swap+boot size

Sponsored By: ScaleEngine Inc.

Test Plan

Build release ISO and test

Diff Detail

rS FreeBSD src repository
No Linters Available
No Unit Test Coverage

Event Timeline

allanjude updated this revision to Diff 294.Jun 4 2014, 10:17 PM
allanjude retitled this revision from to Add support for 'BSD' partition layout to bsdinstall/zfsboot.
allanjude updated this object.
allanjude edited the test plan for this revision. (Show Details)
allanjude added reviewers: roberto, eadler, wblock, bcr.
roberto accepted this revision.Jun 4 2014, 10:43 PM
roberto edited edge metadata.

Looks good to me.

This revision is now accepted and ready to land.Jun 4 2014, 10:43 PM
bcr edited edge metadata.Jun 5 2014, 1:53 PM

I can't say much about it other than it's good that you are doing it.
If Ollivier as a source committer is OK with it, then you have his approval to make changes in the src tree and add a "Reviewed by: roberto" in the commit message. You don't need to get the approval from your doc mentors for this kind of change. Only for man page changes in the src tree, that is special.

allanjude updated this revision to Diff 1605.Sep 13 2014, 1:09 AM
allanjude edited edge metadata.


allanjude abandoned this revision.Jul 12 2015, 7:27 PM

This patch is no longer necessary, as I have developed a workaround for the Lenovo machines that cannot boot standard GPT. Writing the fake partition to the 2nd slot in the pMBR solves the issue.