ZVOL boot

From OpenZFS on OS X
Revision as of 12:51, 6 July 2016 by Evansus (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ZVOL boot

Using the same steps to create the boot helper partition as ZFS on Boot, you may install Mac OS X onto a ZVOL device and use it as your boot volume.

Create zvol

# zfs create -sV 80g rpool/ZVOL/MacOS

Get the diskN for that device

# zvol=`ioreg -trn "ZVOL rpool/ZVOL/MacOS Media" | grep "BSD Name" | awk -F'"' '{print $4}'`
  (it would be nice if we could just # zfs get zvol-disk rpool/ZVOL/MacOS)

Erase and create a volume

# diskutil eraseDisk JHFS+ MacOS ${zvol}

Clone root

Clone an existing Mac OS

# rsync -axH --exclude=".Spotlight-V100" --exclude=".fseventsd" \
 --exclude=".vol" "/Volumes/Macintosh HD/" "/Volumes/MacOS/"

Or use Apple System Restore

# asr --source "/Volumes/Macintosh HD" --target "/Volumes/MacOS" --erase

New install

It is possible, but requires a few steps, to install Mac OS onto a ZVOL with the standard Apple installer. Download the installer from the App Store, and create an installer flash drive. Boot into the Installer, with a standard Mac OS disk available Macintosh HD (that has ZFS installed).

From Utilities->Terminal you can:

# kextload "/Volumes/Macintosh HD/Library/Extensions/spl.kext"
# kextload "/Volumes/Macintosh HD/Library/Extensions/zfs.kext"

At that point you need access to the zpool and zfs commands, which require the libzfs and libzpool libraries. To work around the install environment, simply:

# chroot "/Volumes/Macintosh HD"
# zpool import

Or if necessary

# /usr/local/sbin/zpool import

This worked with El Capitan Install 10.11 and the signed O3x from Downloads. I don't remember which version of O3x, but I believe it was 1.4.5 or so.

Setup boot helper

See Boot.plist for sample plist files.