<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://openzfsonosx.org/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://openzfsonosx.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Evansus</id>
		<title>OpenZFS on OS X - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://openzfsonosx.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Evansus"/>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/Special:Contributions/Evansus"/>
		<updated>2026-04-19T14:37:19Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.22.3</generator>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-27T06:51:15Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* Install ZFS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
* '''s1''' is the system EFI partition, which is used for software updates. You can also add rEFInd boot loader here if desired (optional).&lt;br /&gt;
* '''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
* '''s3''' is the small HFS boot helper which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
* The EFI partition (type ef00) should always exist at the beginning of the disk. It is usually 200 MB.&lt;br /&gt;
* The Apple Boot (type ab00) partition should directly follow the ZFS partition. It should be at least 128 MB but may be as large as you want.&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
&lt;br /&gt;
With own source repository:&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
Or by getting sources:&lt;br /&gt;
 # git clone https://github.com/openzfsonosx/spl.git&lt;br /&gt;
 # git clone https://github.com/openzfsonosx/zfs.git&lt;br /&gt;
&lt;br /&gt;
Build and install both spl and zfs:&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
You should set Kernel Flags and Root UUID in the root volume (not the boot helper) as it will be copied to the boot helper automatically. It is located at /Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Copy prelinkedkernel to boot helper ====&lt;br /&gt;
&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device /dev/disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device /dev/disk1s3 --setBoot --verbose&lt;br /&gt;
&lt;br /&gt;
This will also work, as it will locate the boot helper following the ZFS partition:&lt;br /&gt;
 # sudo bless --device /dev/disk1s2 --setBoot --verbose&lt;br /&gt;
&lt;br /&gt;
Currently --folder and --mount options will work (partially) but may select the wrong boot helper if there are multiple bootable ZFS pools.&lt;br /&gt;
(For example, if you have ZFS boot setup on both the internal disk and an external disk.)&lt;br /&gt;
 # sudo bless --folder /Volumes/Capitan --setBoot --verbose&lt;br /&gt;
 # sudo bless --mount /Volumes/Capitan --setBoot --verbose&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-27T06:46:49Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* Root pool */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
* '''s1''' is the system EFI partition, which is used for software updates. You can also add rEFInd boot loader here if desired (optional).&lt;br /&gt;
* '''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
* '''s3''' is the small HFS boot helper which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
* The EFI partition (type ef00) should always exist at the beginning of the disk. It is usually 200 MB.&lt;br /&gt;
* The Apple Boot (type ab00) partition should directly follow the ZFS partition. It should be at least 128 MB but may be as large as you want.&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # git clone https://github.com/openzfsonosx/spl.git&lt;br /&gt;
 # git clone https://github.com/openzfsonosx/zfs.git&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
You should set Kernel Flags and Root UUID in the root volume (not the boot helper) as it will be copied to the boot helper automatically. It is located at /Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Copy prelinkedkernel to boot helper ====&lt;br /&gt;
&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device /dev/disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device /dev/disk1s3 --setBoot --verbose&lt;br /&gt;
&lt;br /&gt;
This will also work, as it will locate the boot helper following the ZFS partition:&lt;br /&gt;
 # sudo bless --device /dev/disk1s2 --setBoot --verbose&lt;br /&gt;
&lt;br /&gt;
Currently --folder and --mount options will work (partially) but may select the wrong boot helper if there are multiple bootable ZFS pools.&lt;br /&gt;
(For example, if you have ZFS boot setup on both the internal disk and an external disk.)&lt;br /&gt;
 # sudo bless --folder /Volumes/Capitan --setBoot --verbose&lt;br /&gt;
 # sudo bless --mount /Volumes/Capitan --setBoot --verbose&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-27T06:44:53Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Add missing /dev/ prefix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
* '''s1''' is the system EFI partition, which is used for software updates. You can also add rEFInd boot loader here if desired (optional).&lt;br /&gt;
* '''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
* '''s3''' is the small HFS boot helper which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
* The EFI partition (type ef00) should always exist at the beginning of the disk. It is usually 200 MB.&lt;br /&gt;
* The Apple Boot (type ab00) partition should directly follow the ZFS partition. It should be at least 128 MB but may be as large as you want.&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step (optional) will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
If /dev/disk paths are used create the pool, it will import at boot time using /var/run/disk/by-id/media-UUID InvariantDisk paths.&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # git clone https://github.com/openzfsonosx/spl.git&lt;br /&gt;
 # git clone https://github.com/openzfsonosx/zfs.git&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
You should set Kernel Flags and Root UUID in the root volume (not the boot helper) as it will be copied to the boot helper automatically. It is located at /Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Copy prelinkedkernel to boot helper ====&lt;br /&gt;
&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device /dev/disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device /dev/disk1s3 --setBoot --verbose&lt;br /&gt;
&lt;br /&gt;
This will also work, as it will locate the boot helper following the ZFS partition:&lt;br /&gt;
 # sudo bless --device /dev/disk1s2 --setBoot --verbose&lt;br /&gt;
&lt;br /&gt;
Currently --folder and --mount options will work (partially) but may select the wrong boot helper if there are multiple bootable ZFS pools.&lt;br /&gt;
(For example, if you have ZFS boot setup on both the internal disk and an external disk.)&lt;br /&gt;
 # sudo bless --folder /Volumes/Capitan --setBoot --verbose&lt;br /&gt;
 # sudo bless --mount /Volumes/Capitan --setBoot --verbose&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/Bless</id>
		<title>Bless</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/Bless"/>
				<updated>2016-07-27T06:43:54Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Created page with &amp;quot;Using a layout as specified in ZFS on Boot, using disk1:  The simplest version of this command will locate the boot helper following the ZFS partition:  # sudo bless --dev...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using a layout as specified in [[ZFS on Boot]], using disk1:&lt;br /&gt;
&lt;br /&gt;
The simplest version of this command will locate the boot helper following the ZFS partition:&lt;br /&gt;
 # sudo bless --device /dev/disk1s2 --setBoot --verbose&lt;br /&gt;
&lt;br /&gt;
Currently --folder and --mount options will work (partially) but may select the wrong boot helper if there are multiple bootable ZFS pools.&lt;br /&gt;
(For example, if you have ZFS boot setup on both the internal disk and an external disk.)&lt;br /&gt;
 # sudo bless --folder /Volumes/Capitan --setBoot --verbose&lt;br /&gt;
 # sudo bless --mount /Volumes/Capitan --setBoot --verbose&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is an undocumented environment variable that can resolve the conflict. For example, if the ZFS pool is located on disk3s2, and the boot helper is disk3s3:&lt;br /&gt;
 # sudo bless --mount /Volumes/Capitan --setBoot --verbose&lt;br /&gt;
 { ... Truncated output ... }&lt;br /&gt;
 Returning booter information dictionary:&lt;br /&gt;
 &amp;lt;CFBasicHash 0x7fd7c2400a30 [0x7fff75c10440]&amp;gt;{type = mutable dict, count = 3, entries =&amp;gt;&lt;br /&gt;
        0 : &amp;lt;CFString 0x10bd97990 [0x7fff75c10440]&amp;gt;{contents = &amp;quot;System Partitions&amp;quot;} = (&lt;br /&gt;
    disk1s1,&lt;br /&gt;
    disk0s1,&lt;br /&gt;
    disk2s1,&lt;br /&gt;
    disk3s1&lt;br /&gt;
 )&lt;br /&gt;
        1 : &amp;lt;CFString 0x10bd98170 [0x7fff75c10440]&amp;gt;{contents = &amp;quot;Data Partitions&amp;quot;} = (&lt;br /&gt;
    disk1s2,&lt;br /&gt;
    disk2s2,&lt;br /&gt;
    disk3s2&lt;br /&gt;
 )&lt;br /&gt;
        2 : &amp;lt;CFString 0x10bd98190 [0x7fff75c10440]&amp;gt;{contents = &amp;quot;Auxiliary Partitions&amp;quot;} = (&lt;br /&gt;
    '''disk1s3,'''&lt;br /&gt;
    disk2s3,&lt;br /&gt;
    '''disk3s3'''&lt;br /&gt;
 )&lt;br /&gt;
 }&lt;br /&gt;
 Substituting booter '''disk1s3'''&lt;br /&gt;
 { ... Truncated output ... }&lt;br /&gt;
&lt;br /&gt;
Adding an environment variable 'BL_PRIMARY_BOOTER_INDEX' can instruct bless to use the correct partition. The index will start from 0 and count upwards in the list of &amp;quot;Auxiliary Partitions&amp;quot;&lt;br /&gt;
&lt;br /&gt;
In this case, the pool is located on disk3s2 and the boot helper is disk3s3, so adding an index of '''2''' will select the third boot device:&lt;br /&gt;
 # sudo env BL_PRIMARY_BOOTER_INDEX=2 bless --mount /Volumes/Capitan --setBoot --verbose&lt;br /&gt;
 { ... Truncated output ... }&lt;br /&gt;
 Returning booter information dictionary:&lt;br /&gt;
 &amp;lt;CFBasicHash 0x7fd7c2400a30 [0x7fff75c10440]&amp;gt;{type = mutable dict, count = 3, entries =&amp;gt;&lt;br /&gt;
        0 : &amp;lt;CFString 0x10bd97990 [0x7fff75c10440]&amp;gt;{contents = &amp;quot;System Partitions&amp;quot;} = (&lt;br /&gt;
    disk3s1,&lt;br /&gt;
    disk1s1,&lt;br /&gt;
    disk0s1,&lt;br /&gt;
    disk2s1&lt;br /&gt;
 )&lt;br /&gt;
        1 : &amp;lt;CFString 0x10bd98170 [0x7fff75c10440]&amp;gt;{contents = &amp;quot;Data Partitions&amp;quot;} = (&lt;br /&gt;
    disk3s2,&lt;br /&gt;
    disk1s2,&lt;br /&gt;
    disk2s2&lt;br /&gt;
 )&lt;br /&gt;
        2 : &amp;lt;CFString 0x10bd98190 [0x7fff75c10440]&amp;gt;{contents = &amp;quot;Auxiliary Partitions&amp;quot;} = (&lt;br /&gt;
    '''disk3s3,'''&lt;br /&gt;
    disk1s3,&lt;br /&gt;
    disk2s3&lt;br /&gt;
 )&lt;br /&gt;
 }&lt;br /&gt;
 { ... Truncated output ... }&lt;br /&gt;
 Substituting booter '''disk3s3'''&lt;br /&gt;
 IOMedia '''disk3s3''' has UUID 4C5E73A9-05D0-4B7F-A6A8-050715D620A0&lt;br /&gt;
 Setting EFI NVRAM:&lt;br /&gt;
        efi-boot-device='&amp;lt;array&amp;gt;&amp;lt;dict&amp;gt;&amp;lt;key&amp;gt;IOMatch&amp;lt;/key&amp;gt;&amp;lt;dict&amp;gt;&amp;lt;key&amp;gt;IOProviderClass&amp;lt;/key&amp;gt;&lt;br /&gt;
 &amp;lt;string&amp;gt;IOMedia&amp;lt;/string&amp;gt;&amp;lt;key&amp;gt;IOPropertyMatch&amp;lt;/key&amp;gt;&lt;br /&gt;
 &amp;lt;dict&amp;gt;&amp;lt;key&amp;gt;UUID&amp;lt;/key&amp;gt;&amp;lt;string&amp;gt;4C5E73A9-05D0-4B7F-A6A8-050715D620A0&amp;lt;/string&amp;gt;&amp;lt;/dict&amp;gt;&amp;lt;/dict&amp;gt;&lt;br /&gt;
 &amp;lt;key&amp;gt;BLLastBSDName&amp;lt;/key&amp;gt;&amp;lt;string&amp;gt;'''disk3s3'''&amp;lt;/string&amp;gt;&amp;lt;/dict&amp;gt;&amp;lt;/array&amp;gt;'&lt;br /&gt;
 { ... Truncated output ... }&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZVOL_boot</id>
		<title>ZVOL boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZVOL_boot"/>
				<updated>2016-07-11T07:40:02Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* Create zvol */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== ZVOL Boot ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==== Disable bootfs ====&lt;br /&gt;
&lt;br /&gt;
zvol boot does not currently co-exist with zfs boot (planned to be fixed). The presence of the '''bootfs''' property will take precedence at boot time.&lt;br /&gt;
&lt;br /&gt;
You will need to clear bootfs when using zvol boot:&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;nowiki&amp;gt;sudo zpool set bootfs='' poolname&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using two single quotes will remove the previous bootfs.&lt;br /&gt;
&lt;br /&gt;
==== Create zvol ====&lt;br /&gt;
 # zfs create -sV 80g rpool/ZVOL/MacOS&lt;br /&gt;
&lt;br /&gt;
Get the diskN for that device&lt;br /&gt;
 # zvol=`ioreg -trn &amp;quot;ZVOL rpool/ZVOL/MacOS Media&amp;quot; | grep &amp;quot;BSD Name&amp;quot; | awk -F'&amp;quot;' '{print $4}'`&lt;br /&gt;
   (it would be nice if we could just # zfs get zvol-disk rpool/ZVOL/MacOS)&lt;br /&gt;
&lt;br /&gt;
Erase and create a volume&lt;br /&gt;
&lt;br /&gt;
With partition map:&lt;br /&gt;
 # diskutil eraseDisk JHFS+ MacOS ${zvol}&lt;br /&gt;
   Note: direct OS install may only be allowed with a partition map, testing needed&lt;br /&gt;
&lt;br /&gt;
Without partitions:&lt;br /&gt;
 # diskutil eraseVolume JHFS+ MacOS ${zvol}&lt;br /&gt;
&lt;br /&gt;
Alternate method, also without partitions and using zvol symlink:&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;MacOS&amp;quot; /var/run/zfs/zvol/rpool/ZVOL/MacOS&lt;br /&gt;
&lt;br /&gt;
==== Clone root ====&lt;br /&gt;
Clone an existing Mac OS&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; &amp;quot;/Volumes/Macintosh HD/&amp;quot; &amp;quot;/Volumes/MacOS/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Or use Apple System Restore&lt;br /&gt;
 # asr --source &amp;quot;/Volumes/Macintosh HD&amp;quot; --target &amp;quot;/Volumes/MacOS&amp;quot; --erase&lt;br /&gt;
&lt;br /&gt;
==== New install ====&lt;br /&gt;
It is possible, but requires a few steps, to install Mac OS onto a ZVOL with the standard Apple installer.&lt;br /&gt;
Download the installer from the App Store, and create an installer flash drive.&lt;br /&gt;
Boot into the Installer, with a standard Mac OS disk available '''Macintosh HD''' (that has ZFS installed).&lt;br /&gt;
&lt;br /&gt;
From '''Utilities-&amp;gt;Terminal''' you can:&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/spl.kext&amp;quot;&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/zfs.kext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 # chroot &amp;quot;/Volumes/Macintosh HD&amp;quot;&lt;br /&gt;
 # zpool import&lt;br /&gt;
Or if necessary&lt;br /&gt;
 # /usr/local/sbin/zpool import&lt;br /&gt;
&lt;br /&gt;
This worked with El Capitan Install 10.11 and the signed O3x from [[Downloads]].&lt;br /&gt;
I don't remember which version of O3x, but I believe it was 1.4.5 or so.&lt;br /&gt;
&lt;br /&gt;
==== Setup boot helper ====&lt;br /&gt;
&lt;br /&gt;
Boot helper can be setup similar to the boot helper for [[ZFS on Boot]] with some differences.&lt;br /&gt;
&lt;br /&gt;
Root UUID must be set to the Volume UUID of the zvol. You can retrieve this by:&lt;br /&gt;
&lt;br /&gt;
 # diskutil info diskN | grep &amp;quot;Volume UUID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For a volume directly within a zvol, or&lt;br /&gt;
&lt;br /&gt;
 # diskutil info diskNsN | grep &amp;quot;Volume UUID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For a zvol with a partition map.&lt;br /&gt;
&lt;br /&gt;
Kernel Flags should contain &amp;quot;zfs_boot=poolname&amp;quot;&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for sample plist files.&lt;br /&gt;
&lt;br /&gt;
At this time zfs_boot=poolname/zvol or poolname/dataset/zvol will only import the zpool &amp;quot;poolname&amp;quot; and does not check or mount the zvol specified. Correctly setting Root UUID to match will inform the OS to locate the root volume.&lt;br /&gt;
&lt;br /&gt;
In the future, it will be possible to specify a zvol by name, which will then be inspected for matching volume UUID and presented for mount. This would prevent any duplicate UUID clashes due to `zfs clone` copies. To do so will require an additional property zfs_root_uuid=&amp;lt;uuid&amp;gt;, or perhaps zfs_root_partition=N, so that the OS does not try to automatically load the first matching volume.&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-11T05:50:45Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Add git clone commands&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
* '''s1''' is the system EFI partition, which is used for software updates. You can also add rEFInd boot loader here if desired (optional).&lt;br /&gt;
* '''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
* '''s3''' is the small HFS boot helper which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
* The EFI partition (type ef00) should always exist at the beginning of the disk. It is usually 200 MB.&lt;br /&gt;
* The Apple Boot (type ab00) partition should directly follow the ZFS partition. It should be at least 128 MB but may be as large as you want.&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step (optional) will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
If /dev/disk paths are used create the pool, it will import at boot time using /var/run/disk/by-id/media-UUID InvariantDisk paths.&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # git clone https://github.com/openzfsonosx/spl.git&lt;br /&gt;
 # git clone https://github.com/openzfsonosx/zfs.git&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
You should set Kernel Flags and Root UUID in the root volume (not the boot helper) as it will be copied to the boot helper automatically. It is located at /Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Copy prelinkedkernel to boot helper ====&lt;br /&gt;
&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-11T05:48:44Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* Install ZFS continued ... */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
* '''s1''' is the system EFI partition, which is used for software updates. You can also add rEFInd boot loader here if desired (optional).&lt;br /&gt;
* '''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
* '''s3''' is the small HFS boot helper which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
* The EFI partition (type ef00) should always exist at the beginning of the disk. It is usually 200 MB.&lt;br /&gt;
* The Apple Boot (type ab00) partition should directly follow the ZFS partition. It should be at least 128 MB but may be as large as you want.&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step (optional) will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
If /dev/disk paths are used create the pool, it will import at boot time using /var/run/disk/by-id/media-UUID InvariantDisk paths.&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # Insert lines here, git clone, etc&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
You should set Kernel Flags and Root UUID in the root volume (not the boot helper) as it will be copied to the boot helper automatically. It is located at /Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Copy prelinkedkernel to boot helper ====&lt;br /&gt;
&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-11T05:48:05Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* Generate prelinkedkernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
* '''s1''' is the system EFI partition, which is used for software updates. You can also add rEFInd boot loader here if desired (optional).&lt;br /&gt;
* '''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
* '''s3''' is the small HFS boot helper which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
* The EFI partition (type ef00) should always exist at the beginning of the disk. It is usually 200 MB.&lt;br /&gt;
* The Apple Boot (type ab00) partition should directly follow the ZFS partition. It should be at least 128 MB but may be as large as you want.&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step (optional) will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
If /dev/disk paths are used create the pool, it will import at boot time using /var/run/disk/by-id/media-UUID InvariantDisk paths.&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # Insert lines here, git clone, etc&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
You should set Kernel Flags and Root UUID in the root volume (not the boot helper) as it will be copied to the boot helper automatically. It is located at /Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Copy prelinkedkernel to boot helper ====&lt;br /&gt;
&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-11T05:45:46Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* Edit Boot.plist */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
* '''s1''' is the system EFI partition, which is used for software updates. You can also add rEFInd boot loader here if desired (optional).&lt;br /&gt;
* '''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
* '''s3''' is the small HFS boot helper which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
* The EFI partition (type ef00) should always exist at the beginning of the disk. It is usually 200 MB.&lt;br /&gt;
* The Apple Boot (type ab00) partition should directly follow the ZFS partition. It should be at least 128 MB but may be as large as you want.&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step (optional) will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
If /dev/disk paths are used create the pool, it will import at boot time using /var/run/disk/by-id/media-UUID InvariantDisk paths.&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # Insert lines here, git clone, etc&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
You should set Kernel Flags and Root UUID in the root volume (not the boot helper) as it will be copied to the boot helper automatically. It is located at /Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-11T05:44:38Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* Edit Boot.plist */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
* '''s1''' is the system EFI partition, which is used for software updates. You can also add rEFInd boot loader here if desired (optional).&lt;br /&gt;
* '''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
* '''s3''' is the small HFS boot helper which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
* The EFI partition (type ef00) should always exist at the beginning of the disk. It is usually 200 MB.&lt;br /&gt;
* The Apple Boot (type ab00) partition should directly follow the ZFS partition. It should be at least 128 MB but may be as large as you want.&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step (optional) will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
If /dev/disk paths are used create the pool, it will import at boot time using /var/run/disk/by-id/media-UUID InvariantDisk paths.&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # Insert lines here, git clone, etc&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
You should set Kernel Flags and Root UUID in the root volume (not the boot helper) as it will be copied to the boot helper automatically. It is located at /Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/MacOS/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-11T05:42:18Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* Disk Layout */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
* '''s1''' is the system EFI partition, which is used for software updates. You can also add rEFInd boot loader here if desired (optional).&lt;br /&gt;
* '''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
* '''s3''' is the small HFS boot helper which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
* The EFI partition (type ef00) should always exist at the beginning of the disk. It is usually 200 MB.&lt;br /&gt;
* The Apple Boot (type ab00) partition should directly follow the ZFS partition. It should be at least 128 MB but may be as large as you want.&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step (optional) will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
If /dev/disk paths are used create the pool, it will import at boot time using /var/run/disk/by-id/media-UUID InvariantDisk paths.&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # Insert lines here, git clone, etc&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-11T05:39:03Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Revise boot helper notes about kextd updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
'''s1''' is the system EFI partition, which is used for software updates. You can also add rEFInd boot loader here if desired (optional).&lt;br /&gt;
&lt;br /&gt;
'''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
&lt;br /&gt;
'''s3''' is the small HFS boot helper which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
The EFI partition should always exist at the beginning of the disk. It is usually 200 MB.&lt;br /&gt;
&lt;br /&gt;
The Apple Boot (ab00) partition should directly follow the ZFS partition. It should be at least 128 MB but may be as large as you want.&lt;br /&gt;
&lt;br /&gt;
The boot helper partition is updated automatically at boot time or when software is installed/updated. Development is ongoing to fully support this. A potential issue with atime=on has been identified where kextd may try to run multiple workers at one time.&lt;br /&gt;
&lt;br /&gt;
You should set Kernel Flags and Root UUID in the root volume (not the boot helper) as it will be copied to the boot helper automatically. It is located at /Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
   You cannot use '''Startup Disk''' to select the boot disk, see [[#Blessing the boot device|blessing the boot device]].&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step (optional) will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
If /dev/disk paths are used create the pool, it will import at boot time using /var/run/disk/by-id/media-UUID InvariantDisk paths.&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # Insert lines here, git clone, etc&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-11T05:27:21Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* Root dataset */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
'''s1''' is not really used, but added for EFI.&lt;br /&gt;
&lt;br /&gt;
'''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
&lt;br /&gt;
'''s3''' is the small HFS boot which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
The EFI partition should always exist at the beginning of the disk.&lt;br /&gt;
&lt;br /&gt;
The Apple Boot (ab00) partition should directly follow the ZFS partition, and while it can be as small as 50 MB, it is better to use 650MB or more (to imitate a Recovery HD).&lt;br /&gt;
&lt;br /&gt;
   Note: at this time, the boot helper partition is not updated by the OS&lt;br /&gt;
   and must be manually updated. It may be possible to script this in a&lt;br /&gt;
   launchd service, or even 'bless' the device so that macOS updates&lt;br /&gt;
   it automatically. Additional development is ongoing.&lt;br /&gt;
&lt;br /&gt;
   You cannot use '''Startup Disk''' to select the boot disk, see [[#Blessing the boot device|blessing the boot device]].&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step (optional) will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
If /dev/disk paths are used create the pool, it will import at boot time using /var/run/disk/by-id/media-UUID InvariantDisk paths.&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
Note: com.apple.mimic_hfs may be set on the root mountpoint. Testing is still underway for ZFS Root both with or without mimic set.&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # Insert lines here, git clone, etc&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-11T05:20:09Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Revise /dev/disk note, no longer an issue&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
'''s1''' is not really used, but added for EFI.&lt;br /&gt;
&lt;br /&gt;
'''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
&lt;br /&gt;
'''s3''' is the small HFS boot which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
The EFI partition should always exist at the beginning of the disk.&lt;br /&gt;
&lt;br /&gt;
The Apple Boot (ab00) partition should directly follow the ZFS partition, and while it can be as small as 50 MB, it is better to use 650MB or more (to imitate a Recovery HD).&lt;br /&gt;
&lt;br /&gt;
   Note: at this time, the boot helper partition is not updated by the OS&lt;br /&gt;
   and must be manually updated. It may be possible to script this in a&lt;br /&gt;
   launchd service, or even 'bless' the device so that macOS updates&lt;br /&gt;
   it automatically. Additional development is ongoing.&lt;br /&gt;
&lt;br /&gt;
   You cannot use '''Startup Disk''' to select the boot disk, see [[#Blessing the boot device|blessing the boot device]].&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step (optional) will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
If /dev/disk paths are used create the pool, it will import at boot time using /var/run/disk/by-id/media-UUID InvariantDisk paths.&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
   Note: com.apple.mimic_hfs is known to '''NOT''' be compatible at this time. (It will panic!)&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # Insert lines here, git clone, etc&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZVOL_boot</id>
		<title>ZVOL boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZVOL_boot"/>
				<updated>2016-07-11T05:13:50Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* Create zvol */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== ZVOL Boot ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==== Disable bootfs ====&lt;br /&gt;
&lt;br /&gt;
zvol boot does not currently co-exist with zfs boot (planned to be fixed). The presence of the '''bootfs''' property will take precedence at boot time.&lt;br /&gt;
&lt;br /&gt;
You will need to clear bootfs when using zvol boot:&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;nowiki&amp;gt;sudo zpool set bootfs='' poolname&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using two single quotes will remove the previous bootfs.&lt;br /&gt;
&lt;br /&gt;
==== Create zvol ====&lt;br /&gt;
 # zfs create -sV 80g rpool/ZVOL/MacOS&lt;br /&gt;
&lt;br /&gt;
Get the diskN for that device&lt;br /&gt;
 # zvol=`ioreg -trn &amp;quot;ZVOL rpool/ZVOL/MacOS Media&amp;quot; | grep &amp;quot;BSD Name&amp;quot; | awk -F'&amp;quot;' '{print $4}'`&lt;br /&gt;
   (it would be nice if we could just # zfs get zvol-disk rpool/ZVOL/MacOS)&lt;br /&gt;
&lt;br /&gt;
Erase and create a volume&lt;br /&gt;
&lt;br /&gt;
With partition map:&lt;br /&gt;
 # diskutil eraseDisk JHFS+ MacOS ${zvol}&lt;br /&gt;
&lt;br /&gt;
Without partitions:&lt;br /&gt;
 # diskutil eraseVolume JHFS+ MacOS ${zvol}&lt;br /&gt;
&lt;br /&gt;
Alternate method, also without partitions and using zvol symlink:&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;MacOS&amp;quot; /var/run/zfs/zvol/rpool/ZVOL/MacOS&lt;br /&gt;
&lt;br /&gt;
==== Clone root ====&lt;br /&gt;
Clone an existing Mac OS&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; &amp;quot;/Volumes/Macintosh HD/&amp;quot; &amp;quot;/Volumes/MacOS/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Or use Apple System Restore&lt;br /&gt;
 # asr --source &amp;quot;/Volumes/Macintosh HD&amp;quot; --target &amp;quot;/Volumes/MacOS&amp;quot; --erase&lt;br /&gt;
&lt;br /&gt;
==== New install ====&lt;br /&gt;
It is possible, but requires a few steps, to install Mac OS onto a ZVOL with the standard Apple installer.&lt;br /&gt;
Download the installer from the App Store, and create an installer flash drive.&lt;br /&gt;
Boot into the Installer, with a standard Mac OS disk available '''Macintosh HD''' (that has ZFS installed).&lt;br /&gt;
&lt;br /&gt;
From '''Utilities-&amp;gt;Terminal''' you can:&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/spl.kext&amp;quot;&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/zfs.kext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 # chroot &amp;quot;/Volumes/Macintosh HD&amp;quot;&lt;br /&gt;
 # zpool import&lt;br /&gt;
Or if necessary&lt;br /&gt;
 # /usr/local/sbin/zpool import&lt;br /&gt;
&lt;br /&gt;
This worked with El Capitan Install 10.11 and the signed O3x from [[Downloads]].&lt;br /&gt;
I don't remember which version of O3x, but I believe it was 1.4.5 or so.&lt;br /&gt;
&lt;br /&gt;
==== Setup boot helper ====&lt;br /&gt;
&lt;br /&gt;
Boot helper can be setup similar to the boot helper for [[ZFS on Boot]] with some differences.&lt;br /&gt;
&lt;br /&gt;
Root UUID must be set to the Volume UUID of the zvol. You can retrieve this by:&lt;br /&gt;
&lt;br /&gt;
 # diskutil info diskN | grep &amp;quot;Volume UUID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For a volume directly within a zvol, or&lt;br /&gt;
&lt;br /&gt;
 # diskutil info diskNsN | grep &amp;quot;Volume UUID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For a zvol with a partition map.&lt;br /&gt;
&lt;br /&gt;
Kernel Flags should contain &amp;quot;zfs_boot=poolname&amp;quot;&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for sample plist files.&lt;br /&gt;
&lt;br /&gt;
At this time zfs_boot=poolname/zvol or poolname/dataset/zvol will only import the zpool &amp;quot;poolname&amp;quot; and does not check or mount the zvol specified. Correctly setting Root UUID to match will inform the OS to locate the root volume.&lt;br /&gt;
&lt;br /&gt;
In the future, it will be possible to specify a zvol by name, which will then be inspected for matching volume UUID and presented for mount. This would prevent any duplicate UUID clashes due to `zfs clone` copies. To do so will require an additional property zfs_root_uuid=&amp;lt;uuid&amp;gt;, or perhaps zfs_root_partition=N, so that the OS does not try to automatically load the first matching volume.&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZVOL_boot</id>
		<title>ZVOL boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZVOL_boot"/>
				<updated>2016-07-11T05:10:54Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: /* ZVOL Boot */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== ZVOL Boot ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==== Disable bootfs ====&lt;br /&gt;
&lt;br /&gt;
zvol boot does not currently co-exist with zfs boot (planned to be fixed). The presence of the '''bootfs''' property will take precedence at boot time.&lt;br /&gt;
&lt;br /&gt;
You will need to clear bootfs when using zvol boot:&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;nowiki&amp;gt;sudo zpool set bootfs='' poolname&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using two single quotes will remove the previous bootfs.&lt;br /&gt;
&lt;br /&gt;
==== Create zvol ====&lt;br /&gt;
 # zfs create -sV 80g rpool/ZVOL/MacOS&lt;br /&gt;
&lt;br /&gt;
Get the diskN for that device&lt;br /&gt;
 # zvol=`ioreg -trn &amp;quot;ZVOL rpool/ZVOL/MacOS Media&amp;quot; | grep &amp;quot;BSD Name&amp;quot; | awk -F'&amp;quot;' '{print $4}'`&lt;br /&gt;
   (it would be nice if we could just # zfs get zvol-disk rpool/ZVOL/MacOS)&lt;br /&gt;
&lt;br /&gt;
Erase and create a volume&lt;br /&gt;
 # diskutil eraseDisk JHFS+ MacOS ${zvol}&lt;br /&gt;
&lt;br /&gt;
==== Clone root ====&lt;br /&gt;
Clone an existing Mac OS&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; &amp;quot;/Volumes/Macintosh HD/&amp;quot; &amp;quot;/Volumes/MacOS/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Or use Apple System Restore&lt;br /&gt;
 # asr --source &amp;quot;/Volumes/Macintosh HD&amp;quot; --target &amp;quot;/Volumes/MacOS&amp;quot; --erase&lt;br /&gt;
&lt;br /&gt;
==== New install ====&lt;br /&gt;
It is possible, but requires a few steps, to install Mac OS onto a ZVOL with the standard Apple installer.&lt;br /&gt;
Download the installer from the App Store, and create an installer flash drive.&lt;br /&gt;
Boot into the Installer, with a standard Mac OS disk available '''Macintosh HD''' (that has ZFS installed).&lt;br /&gt;
&lt;br /&gt;
From '''Utilities-&amp;gt;Terminal''' you can:&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/spl.kext&amp;quot;&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/zfs.kext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 # chroot &amp;quot;/Volumes/Macintosh HD&amp;quot;&lt;br /&gt;
 # zpool import&lt;br /&gt;
Or if necessary&lt;br /&gt;
 # /usr/local/sbin/zpool import&lt;br /&gt;
&lt;br /&gt;
This worked with El Capitan Install 10.11 and the signed O3x from [[Downloads]].&lt;br /&gt;
I don't remember which version of O3x, but I believe it was 1.4.5 or so.&lt;br /&gt;
&lt;br /&gt;
==== Setup boot helper ====&lt;br /&gt;
&lt;br /&gt;
Boot helper can be setup similar to the boot helper for [[ZFS on Boot]] with some differences.&lt;br /&gt;
&lt;br /&gt;
Root UUID must be set to the Volume UUID of the zvol. You can retrieve this by:&lt;br /&gt;
&lt;br /&gt;
 # diskutil info diskN | grep &amp;quot;Volume UUID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For a volume directly within a zvol, or&lt;br /&gt;
&lt;br /&gt;
 # diskutil info diskNsN | grep &amp;quot;Volume UUID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For a zvol with a partition map.&lt;br /&gt;
&lt;br /&gt;
Kernel Flags should contain &amp;quot;zfs_boot=poolname&amp;quot;&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for sample plist files.&lt;br /&gt;
&lt;br /&gt;
At this time zfs_boot=poolname/zvol or poolname/dataset/zvol will only import the zpool &amp;quot;poolname&amp;quot; and does not check or mount the zvol specified. Correctly setting Root UUID to match will inform the OS to locate the root volume.&lt;br /&gt;
&lt;br /&gt;
In the future, it will be possible to specify a zvol by name, which will then be inspected for matching volume UUID and presented for mount. This would prevent any duplicate UUID clashes due to `zfs clone` copies. To do so will require an additional property zfs_root_uuid=&amp;lt;uuid&amp;gt;, or perhaps zfs_root_partition=N, so that the OS does not try to automatically load the first matching volume.&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZVOL_boot</id>
		<title>ZVOL boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZVOL_boot"/>
				<updated>2016-07-11T05:02:17Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Add boot.plist UUID requirement&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== ZVOL Boot ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==== Create zvol ====&lt;br /&gt;
 # zfs create -sV 80g rpool/ZVOL/MacOS&lt;br /&gt;
&lt;br /&gt;
Get the diskN for that device&lt;br /&gt;
 # zvol=`ioreg -trn &amp;quot;ZVOL rpool/ZVOL/MacOS Media&amp;quot; | grep &amp;quot;BSD Name&amp;quot; | awk -F'&amp;quot;' '{print $4}'`&lt;br /&gt;
   (it would be nice if we could just # zfs get zvol-disk rpool/ZVOL/MacOS)&lt;br /&gt;
&lt;br /&gt;
Erase and create a volume&lt;br /&gt;
 # diskutil eraseDisk JHFS+ MacOS ${zvol}&lt;br /&gt;
&lt;br /&gt;
==== Clone root ====&lt;br /&gt;
Clone an existing Mac OS&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; &amp;quot;/Volumes/Macintosh HD/&amp;quot; &amp;quot;/Volumes/MacOS/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Or use Apple System Restore&lt;br /&gt;
 # asr --source &amp;quot;/Volumes/Macintosh HD&amp;quot; --target &amp;quot;/Volumes/MacOS&amp;quot; --erase&lt;br /&gt;
&lt;br /&gt;
==== New install ====&lt;br /&gt;
It is possible, but requires a few steps, to install Mac OS onto a ZVOL with the standard Apple installer.&lt;br /&gt;
Download the installer from the App Store, and create an installer flash drive.&lt;br /&gt;
Boot into the Installer, with a standard Mac OS disk available '''Macintosh HD''' (that has ZFS installed).&lt;br /&gt;
&lt;br /&gt;
From '''Utilities-&amp;gt;Terminal''' you can:&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/spl.kext&amp;quot;&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/zfs.kext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 # chroot &amp;quot;/Volumes/Macintosh HD&amp;quot;&lt;br /&gt;
 # zpool import&lt;br /&gt;
Or if necessary&lt;br /&gt;
 # /usr/local/sbin/zpool import&lt;br /&gt;
&lt;br /&gt;
This worked with El Capitan Install 10.11 and the signed O3x from [[Downloads]].&lt;br /&gt;
I don't remember which version of O3x, but I believe it was 1.4.5 or so.&lt;br /&gt;
&lt;br /&gt;
==== Setup boot helper ====&lt;br /&gt;
&lt;br /&gt;
Boot helper can be setup similar to the boot helper for [[ZFS on Boot]] with some differences.&lt;br /&gt;
&lt;br /&gt;
Root UUID must be set to the Volume UUID of the zvol. You can retrieve this by:&lt;br /&gt;
&lt;br /&gt;
 # diskutil info diskN | grep &amp;quot;Volume UUID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For a volume directly within a zvol, or&lt;br /&gt;
&lt;br /&gt;
 # diskutil info diskNsN | grep &amp;quot;Volume UUID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For a zvol with a partition map.&lt;br /&gt;
&lt;br /&gt;
Kernel Flags should contain &amp;quot;zfs_boot=poolname&amp;quot;&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for sample plist files.&lt;br /&gt;
&lt;br /&gt;
At this time zfs_boot=poolname/zvol or poolname/dataset/zvol will only import the zpool &amp;quot;poolname&amp;quot; and does not check or mount the zvol specified. Correctly setting Root UUID to match will inform the OS to locate the root volume.&lt;br /&gt;
&lt;br /&gt;
In the future, it will be possible to specify a zvol by name, which will then be inspected for matching volume UUID and presented for mount. This would prevent any duplicate UUID clashes due to `zfs clone` copies. To do so will require an additional property zfs_root_uuid=&amp;lt;uuid&amp;gt;, or perhaps zfs_root_partition=N, so that the OS does not try to automatically load the first matching volume.&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-11T03:40:56Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Move edit boot.plist above creating boot slice, so boot.plist is configured before rsync&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Beta&lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
Because you have to compile own kexts, they will not be signed. SIP needs to be disabled for Kext signing to work.&lt;br /&gt;
The next OpenZFSOnOSX will come with --enable-boot compiled KEXTs and be signed.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
'''s1''' is not really used, but added for EFI.&lt;br /&gt;
&lt;br /&gt;
'''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
&lt;br /&gt;
'''s3''' is the small HFS boot which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
The EFI partition should always exist at the beginning of the disk.&lt;br /&gt;
&lt;br /&gt;
The Apple Boot (ab00) partition should directly follow the ZFS partition, and while it can be as small as 50 MB, it is better to use 650MB or more (to imitate a Recovery HD).&lt;br /&gt;
&lt;br /&gt;
   Note: at this time, the boot helper partition is not updated by the OS&lt;br /&gt;
   and must be manually updated. It may be possible to script this in a&lt;br /&gt;
   launchd service, or even 'bless' the device so that macOS updates&lt;br /&gt;
   it automatically. Additional development is ongoing.&lt;br /&gt;
&lt;br /&gt;
   You cannot use '''Startup Disk''' to select the boot disk, see [[#Blessing the boot device|blessing the boot device]].&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
We strongly recommend '''NOT''' using /dev/disk paths due to disk renumbering issues!&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
   Note: com.apple.mimic_hfs is known to '''NOT''' be compatible at this time. (It will panic!)&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
===== Install ZFS with own source repository =====&lt;br /&gt;
&lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS by getting sources =====&lt;br /&gt;
&lt;br /&gt;
 # Insert lines here, git clone, etc&lt;br /&gt;
&lt;br /&gt;
===== Install ZFS continued ... =====&lt;br /&gt;
&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot &lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds, that can also be done.&lt;br /&gt;
&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
For developers who also have '''development''', or '''debug''' kernels, do the same for each one. For example, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly''' option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
This is only required if you prefer not to bless the device. If you bless it, it will boot automatically. However, if you skip the blessing part you can easily chose which HDD to boot&lt;br /&gt;
by using the EFI Boot Shell.&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
You can specify boot options here too:&lt;br /&gt;
&lt;br /&gt;
 fs4: boot.efi zfs_boot=rpool -s -v&lt;br /&gt;
&lt;br /&gt;
To ask it to boot from pool '''rpool''' (using bootfs= property) into single-user mode, with verbose output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH &amp;quot;/Volumes/OS X Base System/&amp;quot; &amp;quot;/Volumes/boot/&amp;quot;&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Base System 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with '''no com.apple.boot.R''':&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-06T13:19:03Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Reword plist comment&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Not Ready&lt;br /&gt;
   &lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
'''s1''' is not really used, but added for EFI.&lt;br /&gt;
&lt;br /&gt;
'''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
&lt;br /&gt;
'''s3''' is the small HFS boot which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
The EFI partition should always exist at the beginning of the disk.&lt;br /&gt;
&lt;br /&gt;
The Apple Boot (ab00) partition should directly follow the ZFS partition, and while it can be as small as 50 MB, it is better to use 650MB or more (to imitate a Recovery HD).&lt;br /&gt;
&lt;br /&gt;
   Note: at this time, the boot helper partition is not updated by the OS&lt;br /&gt;
   and must be manually updated. It may be possible to script this in a&lt;br /&gt;
   launchd service, or even 'bless' the device so that macOS updates&lt;br /&gt;
   it automatically. Additional development is ongoing.&lt;br /&gt;
&lt;br /&gt;
   You cannot use '''Startup Disk''' to select the boot disk, see [[#Blessing the boot device|blessing the boot device]].&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
   Using /dev/disk paths will most likely break!&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
   Note: com.apple.mimic_hfs is known to '''NOT''' be compatible at this time. (It will panic!)&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
   = Note: Missing branches =&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot --with-spl=../spl&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two keys must be set: '''Kernel Flags''' and '''Root UUID''':&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
And if needed, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly’’’ option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, I hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH /Volumes/OS\ X\ Recovery/ /Volumes/boot/&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Recovery 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with no com.apple.boot.R:&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZFS_on_Boot</id>
		<title>ZFS on Boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZFS_on_Boot"/>
				<updated>2016-07-06T13:18:03Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== ZFS as Boot ==&lt;br /&gt;
&lt;br /&gt;
   Status: Not Ready&lt;br /&gt;
   &lt;br /&gt;
   Most of the commands listed below must be run as root or with '''sudo'''.&lt;br /&gt;
&lt;br /&gt;
=== Disk Layout ===&lt;br /&gt;
&lt;br /&gt;
Play disk: '''disk1'''&lt;br /&gt;
&lt;br /&gt;
I used '''gptfdisk''', but '''gpt''' and '''diskutil''' can be used also.&lt;br /&gt;
Create the following partitions on the test boot disk:&lt;br /&gt;
&lt;br /&gt;
   Disk /dev/rdisk1: 83886080 sectors, 40.0 GiB&lt;br /&gt;
   Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          411647   200.0 MiB   EF00  EFI System&lt;br /&gt;
   2          411648        82200575   39.0 GiB    BF01  rpool&lt;br /&gt;
   3        82200576        83886046   823.0 MiB   AB00  Apple boot&lt;br /&gt;
&lt;br /&gt;
'''s1''' is not really used, but added for EFI.&lt;br /&gt;
&lt;br /&gt;
'''s2''' is the ZFS pool used for booting. Note: You are not limited to using the name '''rpool'''.&lt;br /&gt;
&lt;br /&gt;
'''s3''' is the small HFS boot which will carry the prelinkedkernel to load the kernel with ZFS.&lt;br /&gt;
&lt;br /&gt;
The layout need not be exactly this, but:&lt;br /&gt;
&lt;br /&gt;
The EFI partition should always exist at the beginning of the disk.&lt;br /&gt;
&lt;br /&gt;
The Apple Boot (ab00) partition should directly follow the ZFS partition, and while it can be as small as 50 MB, it is better to use 650MB or more (to imitate a Recovery HD).&lt;br /&gt;
&lt;br /&gt;
   Note: at this time, the boot helper partition is not updated by the OS&lt;br /&gt;
   and must be manually updated. It may be possible to script this in a&lt;br /&gt;
   launchd service, or even 'bless' the device so that macOS updates&lt;br /&gt;
   it automatically. Additional development is ongoing.&lt;br /&gt;
&lt;br /&gt;
   You cannot use '''Startup Disk''' to select the boot disk, see [[#Blessing the boot device|blessing the boot device]].&lt;br /&gt;
&lt;br /&gt;
=== Populating the ZFS Root '''s2''' ===&lt;br /&gt;
&lt;br /&gt;
==== Root pool ====&lt;br /&gt;
Any pool name may be used - '''rpool''' is used here for example.&lt;br /&gt;
Additional research is needed on atime, casesensitivity, and normalization (and probably more).&lt;br /&gt;
 # sudo zpool create -f -o ashift=12 -O casesensitivity=insensitive \&lt;br /&gt;
  -O normalization=formD -O atime=off -O compression=lz4 \&lt;br /&gt;
  -O mountpoint=none -O canmount=off rpool disk1s2&lt;br /&gt;
&lt;br /&gt;
This step will relabel the disks using InvariantDisks paths (by UUID), so they can be located at boot time.&lt;br /&gt;
 # sudo zpool export rpool&lt;br /&gt;
 # sudo zpool import -d /var/run/disk/by-id rpool&lt;br /&gt;
&lt;br /&gt;
   Using /dev/disk paths will most likely break!&lt;br /&gt;
&lt;br /&gt;
==== Root dataset ====&lt;br /&gt;
   Note: com.apple.mimic_hfs is known to '''NOT''' be compatible at this time. (It will panic!)&lt;br /&gt;
&lt;br /&gt;
Create '''ROOT''' and lower just like IllumOS so that you can easy swap OS snapshots and reboot into something else (for example to run softwareupdate).&lt;br /&gt;
 # sudo zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
 # sudo zfs create -o mountpoint=legacy rpool/ROOT/Capitan&lt;br /&gt;
 # sudo zpool set bootfs=rpool/ROOT/Capitan rpool&lt;br /&gt;
&lt;br /&gt;
You probably want to relocate your home folder outside of the root dataset, for example rpool/HOME/username, or on ZVOL for compatibility.&lt;br /&gt;
 # sudo zfs create -o mountpoint=/Users -o canmount=off rpool/HOME&lt;br /&gt;
 # sudo zfs create rpool/HOME/username&lt;br /&gt;
&lt;br /&gt;
Mount it:&lt;br /&gt;
 # sudo mkdir /Volumes/Capitan&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan /Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Install macOS ====&lt;br /&gt;
Copy over the OS as you see fit, rsync will generally do. (Remember that etc, tmp and var are symlinks into /private)&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; / /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
==== Install ZFS ====&lt;br /&gt;
&lt;br /&gt;
   = Note: Missing branches =&lt;br /&gt;
&lt;br /&gt;
 # sudo mkdir -p /Volumes/Capitan/usr/local&lt;br /&gt;
 # cd /Volumes/Capitan/usr/local&lt;br /&gt;
 # sudo ln -s ../../sbin sbin&lt;br /&gt;
 &lt;br /&gt;
 # cd $your-zfs-source-area&lt;br /&gt;
 # cd spl&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout spl-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
 # cd ../zfs&lt;br /&gt;
 # git fetch --all&lt;br /&gt;
 # git checkout ldi-boot&lt;br /&gt;
 # ./autogen&lt;br /&gt;
 # ./configure --enable-boot --with-spl=../spl&lt;br /&gt;
 # make&lt;br /&gt;
 # sudo make install DESTDIR=/Volumes/Capitan&lt;br /&gt;
&lt;br /&gt;
Or use a stage directory for zfs builds&lt;br /&gt;
 # make install DESTDIR=/stage_dir&lt;br /&gt;
 # rsync -acH /stage_dir/ /Volumes/Capitan/&lt;br /&gt;
&lt;br /&gt;
=== Setting up boot slice '''s3''' ===&lt;br /&gt;
&lt;br /&gt;
==== Format ====&lt;br /&gt;
Journaled HFS+ filesystem, and populated thusly; (Volume named '''boot''' here)&lt;br /&gt;
These can be rsynced from the (normal) booted OS, or from the '''Capitan''' mount.&lt;br /&gt;
&lt;br /&gt;
 # newfs_hfs -J -v &amp;quot;boot&amp;quot; /dev/disk1s3&lt;br /&gt;
 # diskutil mount disk1s3&lt;br /&gt;
 # sudo mdutil -i off /Volumes/boot&lt;br /&gt;
&lt;br /&gt;
==== Directories ====&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/System/Library/CoreServices&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration&lt;br /&gt;
 # sudo mkdir -p /Volumes/boot/com.apple.boot.R/usr/standalone/i386&lt;br /&gt;
&lt;br /&gt;
==== Required Files ====&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/PlatformSupport.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/PlatformSupport.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/CoreServices/SystemVersion.plist \&lt;br /&gt;
  /Volumes/boot/System/Library/CoreServices/SystemVersion.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/Library/Preferences/SystemConfiguration/com.apple.Boot.plist \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/Library/Preferences/com.apple.Boot.plist&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/usr/standalone/i386/ \&lt;br /&gt;
  /Volumes/boot/com.apple.boot.R/usr/standalone/i386/&lt;br /&gt;
&lt;br /&gt;
==== Bless the volume ====&lt;br /&gt;
The boot helper needs to know where to load boot.efi from.&lt;br /&gt;
&lt;br /&gt;
You may use any label in place of '''ZFS Boot''' here, it will appear at the option-boot screen.&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --label &amp;quot;ZFS Boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This step does not change the current boot device, unless you add --setBoot. See [[#Blessing the boot device|blessing the boot device]] to change the startup device.&lt;br /&gt;
&lt;br /&gt;
==== Edit Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
More examples of the Boot.plist can be found at [[Boot.plist|com.apple.Boot.plist]]&lt;br /&gt;
&lt;br /&gt;
 # sudo vim /Volumes/boot/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
&lt;br /&gt;
Two changes are needed:&lt;br /&gt;
&lt;br /&gt;
Look for&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace with:&lt;br /&gt;
   &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
   &amp;lt;string&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any UUID may be used here, I used 5A465320-626F-6F74-2064-657669636500, (which is literally the string &amp;quot;ZFS boot device\0&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
See [[Boot.plist]] for more examples.&lt;br /&gt;
&lt;br /&gt;
[[ZVOL boot]] from HFS+ can be accomplished by using the UUID of the partition containing a standard Mac OS install, for compatibility.&lt;br /&gt;
&lt;br /&gt;
==== Generate prelinkedkernel ====&lt;br /&gt;
Generate caches for '''kernel'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
And if needed, caches for '''kernel.development'''&lt;br /&gt;
&lt;br /&gt;
 # kextcache -arch x86_64 -local-root -volume-root /Volumes/rpool \&lt;br /&gt;
   -kernel /Volumes/rpool/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/rpool/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/rpool/System/Library/Extensions /Volumes/boot/Library/Extensions&lt;br /&gt;
&lt;br /&gt;
==== Set the boot device ====&lt;br /&gt;
Finally, tell your Mac to use the boot helper on boot. You may want to try the '''--nextonly’’’ option to avoid permanent changes.&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;br /&gt;
&lt;br /&gt;
=== Booting ===&lt;br /&gt;
==== Booting on ESX ====&lt;br /&gt;
&lt;br /&gt;
Booting on ESX, I hit F2 to get the EFI menu up. One of the options is the &amp;quot;EFI Shell (not supported)&amp;quot;. Once the EFI shell has been entered&lt;br /&gt;
&lt;br /&gt;
 # map&lt;br /&gt;
&lt;br /&gt;
will list all available maps. For me, &lt;br /&gt;
&lt;br /&gt;
 '''fs0''' disk0 EFI partition&lt;br /&gt;
 '''fs1''' disk0 OSX boot&lt;br /&gt;
 '''fs2''' disk0 OSX Recovery&lt;br /&gt;
 '''fs3''' disk1 EFI&lt;br /&gt;
 '''fs4''' disk1 '''boot HFS'''&lt;br /&gt;
 '''fs5''' disk1 recovery&lt;br /&gt;
 '''fs6''' disk1 ZFS&lt;br /&gt;
&lt;br /&gt;
So in my case&lt;br /&gt;
 EFI&amp;gt; '''fs4:'''&lt;br /&gt;
 fs4: ls&lt;br /&gt;
 usr System Library&lt;br /&gt;
 fs4: cd System &lt;br /&gt;
 fs4: cd Library&lt;br /&gt;
 fs4: cd CoreServices&lt;br /&gt;
 fs4: boot.efi&lt;br /&gt;
&lt;br /&gt;
Which runs (boots) boot.efi, which then locates and loads the prelinkedkernel.&lt;br /&gt;
&lt;br /&gt;
==== Booting on VirtualBox ====&lt;br /&gt;
&lt;br /&gt;
SIP can be disabled in VirtualBox, but must be disabled before every boot.&lt;br /&gt;
One way to do this is to install '''rEFInd''' into the EFI partition.&lt;br /&gt;
It is possible to write a startup.nsh script to do so.&lt;br /&gt;
&lt;br /&gt;
VirtualBox does not like the boot helper as created above. It used to function in a previous version (4.3.x?) but at this time, the easiest option I have found is to clone the contents of BaseSystem.dmg from any MacOS recovery partition.&lt;br /&gt;
 # diskutil mount disk0s3&lt;br /&gt;
 # hdiutil attach -readonly &amp;quot;/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
 # sudo rsync -axH /Volumes/OS\ X\ Recovery/ /Volumes/boot/&lt;br /&gt;
Or if you prefer '''asr''':&lt;br /&gt;
 # sudo asr restore -source &amp;quot;/Volumes/OS X Recovery&amp;quot; -target &amp;quot;/Volumes/boot&amp;quot; -erase&lt;br /&gt;
 # diskutil rename &amp;quot;/Volumes/OS X Recovery 1&amp;quot; &amp;quot;boot&amp;quot;&lt;br /&gt;
&lt;br /&gt;
And the paths used above will change, as we are using a “real” disk layout with no com.apple.boot.R:&lt;br /&gt;
 # sudo rsync -a /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
  /Volumes/boot/System/Library/PrelinkedKernels/prelinkedkernel&lt;br /&gt;
 # sudo vim /Volumes/boot/Library/Preferences/SystemConfiguration/com.apple.Boot.plist&lt;br /&gt;
(See [[#com.apple.Boot.plist|Boot.plist]])&lt;br /&gt;
&lt;br /&gt;
==== Booting on real Macs ====&lt;br /&gt;
&lt;br /&gt;
   Always make extra backups!&lt;br /&gt;
   Test this out using flash drives first!&lt;br /&gt;
&lt;br /&gt;
Create partitions as above. If you already created a boot helper on one disk, you can clone it with Disk Utility or '''asr''' and edit the [com.apple.Boot.plist] to put a different pool name in '''zfs_boot''' in the '''Kernel flags'''.&lt;br /&gt;
&lt;br /&gt;
Hold '''option''' while powering on or restarting your Mac.&lt;br /&gt;
&lt;br /&gt;
Look for '''ZFS Boot''' as set by bless --label above, and double click.&lt;br /&gt;
&lt;br /&gt;
ZFS will load and search available disks for the pool specified in '''zfs_boot''' above. If the pool is not found, or not enough disks are present, ZFS will wait and check additional disks as they appear.&lt;br /&gt;
&lt;br /&gt;
If all is well, the pool will import and MacOS will boot from the '''Capitan''' dataset.&lt;br /&gt;
&lt;br /&gt;
After a certain number of attempts, the MacOS loader will show a 'prohibitory symbol' (circle with a line through it). If you see this, hold the power button until your Mac powers off.&lt;br /&gt;
&lt;br /&gt;
If you are stuck in a boot loop, power the machine off, then power on while holding the '''option''' key. Select the partition with standard MacOS to reboot normally. Once booted, check and set '''System Preferences-&amp;gt;Startup Disk'''.&lt;br /&gt;
&lt;br /&gt;
=== Additional ===&lt;br /&gt;
&lt;br /&gt;
==== Mounting other boot environments ====&lt;br /&gt;
&lt;br /&gt;
 # sudo zfs snapshot rpool/ROOT/Capitan1@updating&lt;br /&gt;
 # sudo zfs clone rpool/ROOT/Capitan1@updating rpool/ROOT/Capitan2&lt;br /&gt;
 # mkdir /Volumes/Capitan2&lt;br /&gt;
 # sudo mount_zfs rpool/ROOT/Capitan2 /Volumes/Capitan2&lt;br /&gt;
&lt;br /&gt;
Later you can promote&lt;br /&gt;
 # sudo zfs promote rpool/ROOT/Capitan2&lt;br /&gt;
Then if you want&lt;br /&gt;
 # sudo zfs destroy -r rpool/ROOT/Capitan&lt;br /&gt;
&lt;br /&gt;
==== Blessing the boot device ====&lt;br /&gt;
&lt;br /&gt;
Need only be run once, to setup the '''boot''' volume:&lt;br /&gt;
 # sudo bless --folder /Volumes/boot/System/Library/CoreServices \&lt;br /&gt;
   --file /Volumes/boot/System/Library/CoreServices/boot.efi \&lt;br /&gt;
   --bootefi /Volumes/Capitan/System/Library/CoreServices/boot.efi&lt;br /&gt;
&lt;br /&gt;
This command actually sets the boot helper to be used on reboot:&lt;br /&gt;
 # sudo bless --device disk1s3 --setBoot&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/Boot.plist</id>
		<title>Boot.plist</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/Boot.plist"/>
				<updated>2016-07-06T13:01:16Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: hmm, meant to use capital B&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Boot.plist&lt;br /&gt;
&lt;br /&gt;
==== com.apple.Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
Use these sample Boot.plist files to enable [[ZFS on Boot]] or [[ZVOL boot]]&lt;br /&gt;
&lt;br /&gt;
===== Verbose boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Single-user boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;-v -s debug=0x144 zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Debug boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;-v io=0xffffffff debug=0x144 keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Standard boot with kext symbols =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Standard boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZVOL_boot</id>
		<title>ZVOL boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZVOL_boot"/>
				<updated>2016-07-06T12:57:55Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== ZVOL Boot ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==== Create zvol ====&lt;br /&gt;
 # zfs create -sV 80g rpool/ZVOL/MacOS&lt;br /&gt;
&lt;br /&gt;
Get the diskN for that device&lt;br /&gt;
 # zvol=`ioreg -trn &amp;quot;ZVOL rpool/ZVOL/MacOS Media&amp;quot; | grep &amp;quot;BSD Name&amp;quot; | awk -F'&amp;quot;' '{print $4}'`&lt;br /&gt;
   (it would be nice if we could just # zfs get zvol-disk rpool/ZVOL/MacOS)&lt;br /&gt;
&lt;br /&gt;
Erase and create a volume&lt;br /&gt;
 # diskutil eraseDisk JHFS+ MacOS ${zvol}&lt;br /&gt;
&lt;br /&gt;
==== Clone root ====&lt;br /&gt;
Clone an existing Mac OS&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; &amp;quot;/Volumes/Macintosh HD/&amp;quot; &amp;quot;/Volumes/MacOS/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Or use Apple System Restore&lt;br /&gt;
 # asr --source &amp;quot;/Volumes/Macintosh HD&amp;quot; --target &amp;quot;/Volumes/MacOS&amp;quot; --erase&lt;br /&gt;
&lt;br /&gt;
==== New install ====&lt;br /&gt;
It is possible, but requires a few steps, to install Mac OS onto a ZVOL with the standard Apple installer.&lt;br /&gt;
Download the installer from the App Store, and create an installer flash drive.&lt;br /&gt;
Boot into the Installer, with a standard Mac OS disk available '''Macintosh HD''' (that has ZFS installed).&lt;br /&gt;
&lt;br /&gt;
From '''Utilities-&amp;gt;Terminal''' you can:&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/spl.kext&amp;quot;&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/zfs.kext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 # chroot &amp;quot;/Volumes/Macintosh HD&amp;quot;&lt;br /&gt;
 # zpool import&lt;br /&gt;
Or if necessary&lt;br /&gt;
 # /usr/local/sbin/zpool import&lt;br /&gt;
&lt;br /&gt;
This worked with El Capitan Install 10.11 and the signed O3x from [[Downloads]].&lt;br /&gt;
I don't remember which version of O3x, but I believe it was 1.4.5 or so.&lt;br /&gt;
&lt;br /&gt;
==== Setup boot helper ====&lt;br /&gt;
See [[Boot.plist]] for sample plist files.&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/ZVOL_boot</id>
		<title>ZVOL boot</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/ZVOL_boot"/>
				<updated>2016-07-06T12:51:01Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Created page with &amp;quot;=== 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.  ==...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== ZVOL boot ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==== Create zvol ====&lt;br /&gt;
 # zfs create -sV 80g rpool/ZVOL/MacOS&lt;br /&gt;
&lt;br /&gt;
Get the diskN for that device&lt;br /&gt;
 # zvol=`ioreg -trn &amp;quot;ZVOL rpool/ZVOL/MacOS Media&amp;quot; | grep &amp;quot;BSD Name&amp;quot; | awk -F'&amp;quot;' '{print $4}'`&lt;br /&gt;
   (it would be nice if we could just # zfs get zvol-disk rpool/ZVOL/MacOS)&lt;br /&gt;
&lt;br /&gt;
Erase and create a volume&lt;br /&gt;
 # diskutil eraseDisk JHFS+ MacOS ${zvol}&lt;br /&gt;
&lt;br /&gt;
==== Clone root ====&lt;br /&gt;
Clone an existing Mac OS&lt;br /&gt;
 # rsync -axH --exclude=&amp;quot;.Spotlight-V100&amp;quot; --exclude=&amp;quot;.fseventsd&amp;quot; \&lt;br /&gt;
  --exclude=&amp;quot;.vol&amp;quot; &amp;quot;/Volumes/Macintosh HD/&amp;quot; &amp;quot;/Volumes/MacOS/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Or use Apple System Restore&lt;br /&gt;
 # asr --source &amp;quot;/Volumes/Macintosh HD&amp;quot; --target &amp;quot;/Volumes/MacOS&amp;quot; --erase&lt;br /&gt;
&lt;br /&gt;
==== New install ====&lt;br /&gt;
It is possible, but requires a few steps, to install Mac OS onto a ZVOL with the standard Apple installer.&lt;br /&gt;
Download the installer from the App Store, and create an installer flash drive.&lt;br /&gt;
Boot into the Installer, with a standard Mac OS disk available '''Macintosh HD''' (that has ZFS installed).&lt;br /&gt;
&lt;br /&gt;
From '''Utilities-&amp;gt;Terminal''' you can:&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/spl.kext&amp;quot;&lt;br /&gt;
 # kextload &amp;quot;/Volumes/Macintosh HD/Library/Extensions/zfs.kext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 # chroot &amp;quot;/Volumes/Macintosh HD&amp;quot;&lt;br /&gt;
 # zpool import&lt;br /&gt;
Or if necessary&lt;br /&gt;
 # /usr/local/sbin/zpool import&lt;br /&gt;
&lt;br /&gt;
This worked with El Capitan Install 10.11 and the signed O3x from [[Downloads]].&lt;br /&gt;
I don't remember which version of O3x, but I believe it was 1.4.5 or so.&lt;br /&gt;
&lt;br /&gt;
==== Setup boot helper ====&lt;br /&gt;
See [[Boot.plist]] for sample plist files.&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/Boot.plist</id>
		<title>Boot.plist</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/Boot.plist"/>
				<updated>2016-07-06T12:23:21Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Add links to ZFS on Boot and ZVOL Boot&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Boot.plist&lt;br /&gt;
&lt;br /&gt;
==== com.apple.Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
Use these sample Boot.plist files to enable [[ZFS on Boot]] or [[ZVOL Boot]]&lt;br /&gt;
&lt;br /&gt;
===== Verbose boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Single-user boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;-v -s debug=0x144 zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Debug boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;-v io=0xffffffff debug=0x144 keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Standard boot with kext symbols =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Standard boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	<entry>
		<id>https://openzfsonosx.org/wiki/Boot.plist</id>
		<title>Boot.plist</title>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/Boot.plist"/>
				<updated>2016-07-06T12:17:27Z</updated>
		
		<summary type="html">&lt;p&gt;Evansus: Provide several sample Boot.plist files&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Boot.plist&lt;br /&gt;
&lt;br /&gt;
==== com.apple.Boot.plist ====&lt;br /&gt;
&lt;br /&gt;
===== Verbose boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;-v keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Single-user boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;-v -s debug=0x144 zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Debug boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;-v io=0xffffffff debug=0x144 keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Standard boot with kext symbols =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;keepsyms=y zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Standard boot =====&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;dict&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Kernel Flags&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;zfs_boot=rpool&amp;lt;/string&amp;gt;&lt;br /&gt;
           &amp;lt;key&amp;gt;Root UUID&amp;lt;/key&amp;gt;&lt;br /&gt;
           &amp;lt;string&amp;gt;5A465320-626F-6F74-2064-657669636500&amp;lt;/string&amp;gt;&lt;br /&gt;
   &amp;lt;/dict&amp;gt;&lt;br /&gt;
   &amp;lt;/plist&amp;gt;&lt;/div&gt;</summary>
		<author><name>Evansus</name></author>	</entry>

	</feed>