Skip to content

Instantly share code, notes, and snippets.

@voutilad
Last active May 29, 2019 16:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voutilad/bee46b0900ae39048ed987297b40fe6d to your computer and use it in GitHub Desktop.
Save voutilad/bee46b0900ae39048ed987297b40fe6d to your computer and use it in GitHub Desktop.
Manually Installing FreeBSD with ZFS root capable of Boot Environments

Use Case

I want to:

  1. dual boot macOS Sierra and FreeBSD 12-CURRENT (or HardenedBSD 12-CURRENT),
  2. use rEFInd to manage EFI boot selection,
  3. use ZFS for my root disk laid out to support boot environments (via beadm)

The current guided installer only does a full root ZFS install when using the whole disk, which defeats #1 above.

Let's do this

Less talkin' more walkin'...

Let's assume you have macOS installed. If not, just use the first step [Getting a macOS Installer] and do a fresh install. You can also partition the disk then (see [Resize and Partition your Disk]).

Getting a macOS Installer

Might be done already, but create a USB installer (because who boots from optical discs these days? coughubuntucough. Even if you already have macOS installed and running, I recommend having this around just in case. Plus it helps for installing rEFInd.

  1. Grab macOS Sierra from the App Store. It'll install an installer app in /Applications
  2. Insert a "large enough" (>2 GB?) USB stick. If it's not formatted already, use DiskUtility to just format the whole thing as FAT. It should auto-mount when done.
  3. Make sure the file system on the USB is mounted. It should show up in /Volumes/ if so and maybe the desktop. For this example, let's say your USB was named "UNNAMED"...which is pretty common.
  4. Fire up Terminal.app or iTerm.app and run:
$ /Applications/Install macOS Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/UNNAMED --applicationpath /Applications/Install macOS Sierra.app
  1. It'll prompt you to make sure you want to nuke the disk. Since you're doing this by Volume and not device name, it should be pretty easy to not choose your root disk...but you know.
  2. Grab a coffee; let it run.

Resize and Partition your Disk

Use DiskUtility to create a new disk partition. I recommend making it FAT just so it's easily detectable and name it something obvious like FORBSD. You can do this will running macOS.

Download rEFInd in macOS

While still in macOS, go grab rEFInd and unzip to a location you'll remember. We won't do anything now with it because with macOS Sierra System Integrity Protection is enabled.

Yes, the binary install (zip) downloads from SourceForge. Just don't click any ads. 😀

Reboot into the macOS Installer

Pop that UBS stick into your machine, reboot, and when you hear the Apple chime press and hold the left Option key. Let go once the chime is done. It should bring you to the built-in Apple EFI boot selector and you can choose to boot the macOS Sierra Installer image off the USB.

Once the installer starts up, it should auto-mount your disk. If not, use DiskUtility via the installer's tools to mount it.

Use the tools menu to open a Terminal. Now to install rEFInd!

Navigate to where you unzipped rEFInd and run refind-install. It might warn about SIP, but it's fine. Just let it do it's thing and it should report success.

Reboot and you should now get the rEFInd boot selection screen. Sweet.

Prepare a FreeBSD Installer

I'm going to assume you're using a USB memory stick to install FreeBSD as well. I recommend grabbing an additional one (~2GB or less) and use etcher in macOS to burn the .img or .img.xz to the USB drive.

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment