Install

From OpenZFS on OS X
Revision as of 19:21, 12 March 2014 by Ilovezfs (Talk | contribs)

Jump to: navigation, search

Adapted from an article by ZeroBSD.

If you have any other implementation of ZFS installed, you must uninstall it and reboot before proceeding further.

We'll need to fetch the latest source from the repository on GitHub and then compile it. For this, we'll need some prerequisites, like Xcode (from Mac App Store), Xcode Command Line Tools (use the Downloads pane of Xcode preferences) and Homebrew (you can use MacPorts, but I wanted to try something new this time). Oh, and you need to be an administrative user to follow the next steps successfully, but if you own the machine, you're probably already an administrative user.

To install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Paste that at a Terminal prompt.

Once Homebrew is installed, we need a couple of things first:

brew install automake
brew install libtool

Create two folders in your home directory.

mkdir ~/Developer
mkdir ~/bin

Add the ~/bin directory to your PATH.

echo 'export PATH=$HOME/bin:$PATH' >> ~/.bash_profile

and update your environment by sourcing your profile.

source ~/.bash_profile

To acquire the sources and build ZFS, we'll need the "zfsadm" script.

cd ~/Developer/
git clone https://gist.github.com/7713854.git zfsadm-repo
cp zfsadm-repo/zfsadm ~/bin/
chmod +x ~/bin/zfsadm

From now on, if you do this, you can simply run zfsadm from Terminal, without the need to be in your home folder.

All set. Let's go cloning and building ZFS:

zfsadm

It should take a couple of minutes, not more. Disregard the warnings you may notice on the screen during build, it should be fine.

then everything worked out well. But before using it, there's still some housekeeping to be done. Let's install the binaries:

cd ~/Developer/zfs
sudo make install
cd ~/Developer/spl
sudo make install

Now load the kernel extensions.

cd /System/Library/Extensions
sudo kextload spl.kext
sudo kextload -d spl.kext zfs.kext

You can always check if they are loaded with

sudo kextstat | grep lundman

If you get something similar to

0xffffff7f80b52000 0xc000 0xc000 net.lundman.spl (1.0.0) <7 5 4 3 1>
0xffffff800b070a00 0x180 0x180 net.lundman.kernel.dependencies (10.0.0)
0xffffff7f8129a000 0x1f3000 0x1f3000 net.lundman.zfs (1.0.0) <92 91 16 7 5 4 3 1>


Add /usr/local/sbin (where you should now find the commands zpool, zfs, zdb, etc.) to your PATH:

echo 'export PATH=$PATH:/usr/local/sbin' >> ~/.bash_profile

and update your environment by sourcing your profile again.

source ~/.bash_profile

Now you can try running

sudo zpool

to see if everything is installed and configured properly. You can go ahead and create your pools and play with them from now on.

When you want to get the latest commits from GitHub, here's a quick overview of things you need to run.

First make sure you have exported all of your pools, by running

zpool export $POOLNAME

for every pool you have. This is necessary to prevent a kernel panic when the kexts are unloaded.

cd ~/Developer
 
cd spl
make clean
cd ..
 
cd zfs
make clean
cd ..
 
zfsadm
 
cd spl
sudo make install
cd ..
 
cd zfs
sudo make install
 
cd /System/Library/Extensions
sudo kextload spl.kext
sudo kextload -d spl.kext zfs.kext

If net.lundman.kernel.dependencies has been updated (quite rare) a reboot would be necessary.