Install ZFS on Debian Testing (Jessie)

ZFS on Linux

ZFS on Linux

I’ve been using ZFS on Linux  to provide ZFS functionality on Linux for sometime now.  I first became attached to the feature set of ZFS while maintaining Sun Solaris systems a few years ago.  I mostly manage a variety of Linux systems now and have found ZFS on Linux to be stable enough for my development work.  Though, many folks are using it in production very successfully!

As a matter of fact, Jim Salter wrote the following on Ars Technica recently referencing ZFS on Linux:

I’ve been using ZFS professionally and in production for over five years, and I can honestly say that it’s both changed the course of my career and my business. I wouldn’t dream of going back to the way I did things before ZFS.

That’s quite a ringing endorsement but Jim has many more things to say about ZFS and its strong and weak points.  I found myself nodding my head throughout most of it.  The article is well worth a read.

As an aside, you can watch the maintainer of ZFS on Linux, Brian Belendorf of LLNL, give a talk at Joyent’s ZFS Day on his motivations to write ZFS on Linux.  His talk begins at 31:40 here.

Since my Linux distro of choice for development boxes is Debian testing (Jessie), I hoped the installation for Debian stable (Wheezy) described on this page would work.  Unfortunately, there is an issue with ZFS on Linux version 0.6.2 running kernels greater than 3.12.  Basically, a new API was introduced to the Linux kernel that is incompatible with ZFS on Linux.  The incompatibility has been fixed, but the official ZFS on Linux release hasn’t been updated.

Unfortunately, this bug prevents ZFS on Linux from compiling and installing the kernel module on Debian testing.  I have tested the  instructions on Debian stable and found it works perfectly.  The following steps are only necessary for folks who want to run Debian testing (or above).

I decided to take the leap and run bleeding edge ZFS on Linux on my Debian testing systems.  Note that this is not for the feint of heart since this code has not be throughly tested and there are likely bugs.  I would not run it in production.  So, caveat emptor and all that.

First, there are several dependencies to get out of the way.  ZFS on Linux requires libz, uuid, and the Linux kernel headers.  These dependencies can be taken care of with a simple aptitude installation.  The following command will do the trick.

sudo aptitude install git autoconf libtool zlib1g-dev uuid-dev linux-headers-$(uname -r)

Now create a directory to download and compile ZFS on Linux.

mkdir ${HOME}/zfs
cd ${HOME}/zfs

Time to download the code!  You’ll need the Solaris Porting Layer (SPL) and ZFS git repositories.  You can use ‘git clone’ to download both repos.

git clone https://github.com/zfsonlinux/spl.git
git clone https://github.com/zfsonlinux/zfs.git

Downloading the two repositories should create two directories names ${HOME}/zfs/spl and ${HOME}/zfs/zfs.    First, you’ll need to compile and install the SPL module.

cd ${HOME}/spl
./autogen.sh
./configure --prefix=/usr
make
sudo make install

Now compile and install the ZFS module.

cd ${HOME}/zfs
./autogen.sh
./configure --with-spl=${HOME}/zfs/spl --prefix=/usr
make
sudo make install

Next you should be able to start your newly compiled ZFS kernel module.

sudo modprobe zfs

If the module has loaded properly, you should be able to run ZFS management utilities such as zfs and spool.  On Linux, you must run zfs and zpool as root.  You’ll get this error if you don’t.

jgrafton@debian-testing:~$ /usr/sbin/zfs list
Unable to open /dev/zfs: Permission denied.

Once zpool and zfs are working properly, you’ll be able to create ZFS datasets.

jgrafton@debian-testing:~$ sudo zpool create -f testing /dev/sdb
jgrafton@debian-testing:~$ sudo zpool status
  pool: testing
 state: ONLINE
  scan: none requested
config:

	NAME        STATE     READ WRITE CKSUM
	testing     ONLINE       0     0     0
	  sdb       ONLINE       0     0     0

errors: No known data errors

This procedure has worked for me for awhile now and I haven’t suffered any data loss events.  Again, it’s always a possibility due to the bleeding edge nature of this code.

 

This entry was posted in computers, zfs. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *