<?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=Rejsmont</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=Rejsmont"/>
		<link rel="alternate" type="text/html" href="https://openzfsonosx.org/wiki/Special:Contributions/Rejsmont"/>
		<updated>2026-04-19T23:38:32Z</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-09-09T14:35:09Z</updated>
		
		<summary type="html">&lt;p&gt;Rejsmont: Fixed source volume name in asr command&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.sh&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.sh&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/boot.efi \&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/Capitan \&lt;br /&gt;
   -kernel /Volumes/Capitan/System/Library/Kernels/kernel \&lt;br /&gt;
   -prelinked-kernel /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel \&lt;br /&gt;
   -- /Volumes/Capitan/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/Capitan \&lt;br /&gt;
   -kernel /Volumes/Capitan/System/Library/Kernels/kernel.development \&lt;br /&gt;
   -prelinked-kernel /Volumes/Capitan/System/Library/PrelinkedKernels/prelinkedkernel.development \&lt;br /&gt;
   -- /Volumes/Capitan/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 Base System/&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>Rejsmont</name></author>	</entry>

	</feed>