On this page

  1. Native ZFS On Ubuntu

Native ZFS On Ubuntu

This guide explains how to set up native ZFS on Ubuntu / Linux. It was tested with Linux 2.6.35-24-generic #42-Ubuntu SMP x86_64 GNU/Linux on Ubuntu 10.10 but should also work on Ubuntu 10.04.

Make sure the following packages are installed:

  • build-essential
  • gawk
  • zlib1g-dev
  • uuid-dev

or install them with:

sudo apt-get install build-essential gawk zlib1g-dev uuid-dev

Now you are prepared to install SPL and ZFS from http://zfsonlinux.org/.

sudo cd /usr/src

Download the latest release, e.g.:

sudo wget http://github.com/downloads/behlendorf/spl/spl-0.5.2.tar.gz

sudo wget http://github.com/downloads/behlendorf/zfs/zfs-0.5.2.tar.gz

Build SPL (you will need it later to compile the ZFS source):

sudo tar -xvzf spl-0.5.2.tar.gz

sudo cd spl-0.5.2/

sudo ./configure

sudo make

sudo make install

Build ZFS:

cd ..

sudo tar -xvzf zfs-0.5.2.tar.gz

sudo cd zfs-0.5.2/ sudo ./configure

sudo make

sudo make install

See if splat is working and the zfs modules are loaded:

sudo modprobe splat

sudo splat -a

sudo modprobe zfs

lsmod |grep zfs

Thats it - you might think that because of an missing path in the LD_LIBRARY_PATH all zfs commands will fail with an error like this:

zfs: error while loading shared libraries: libspl.so.0: cannot open shared object file: No such file or directory

To fix it add the following line to your environment:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

Ready - Enjoy!

Share this page:

8 Comment(s)

Add comment

Comments

From: sudoAnonymous at: 2011-01-26 05:51:07

sudo this was hilarious.

sudo i hope no one actually does what you suggest.

sudo end comment.

From: Martin Matuska at: 2011-01-21 23:32:56

Tutorial for native ZFS including the POSIX layer (mounting datasets and working with them) for Ubuntu and Fedora is available here.

From: Chris at: 2011-01-24 13:01:36

Hi brande,

 At the "Download the latsest release, e.g.;" step I get the following error:

 This information is just to let you know so you can finetune your tutorial.

 

 chris@SmackBook:~$ sudo wget http://github.com/downloads/behlendorf/spl/spl-0.5.2.tar.gz

--2011-01-24 13:56:19--  http://github.com/downloads/behlendorf/spl/spl-0.5.2.tar.gz

Resolving github.com... 207.97.227.239

Connecting to github.com|207.97.227.239|:80... connected.

HTTP request sent, awaiting response... 301 Moved Permanently

Location: https://github.com/downloads/behlendorf/spl/spl-0.5.2.tar.gz [following]

--2011-01-24 13:56:21--  https://github.com/downloads/behlendorf/spl/spl-0.5.2.tar.gz

Connecting to github.com|207.97.227.239|:443... connected.

ERROR: certificate common name `*.github.com' doesn't match requested host name `github.com'.

To connect to github.com insecurely, use `--no-check-certificate'.

 

From: Anonymous at: 2012-08-04 19:08:13

sudo wget http://github.com/zfsonlinux/spl/downloads/spl-0.6.0-rc9.tar.gz
sudo wget http://github.com/zfsonlinux/zfs/downloads/zfs-0.6.0-rc9.tar.gz

From: Anonymous at: 2011-01-24 15:39:54

Putting the libraries in the LD_LIBRARY_PATH, is fine for running commands once in a while, but you should probably just configure the loader to do the right thing.  Add the path to ld.so.conf and then run ldconfig.

From: Anders Jackson at: 2011-01-24 20:19:40

You really doesn't need to do "sudo cd".  Just plain "cd" is enough.

You should prob. not do "tar -zxf" or "make" as root either, as it is a possible security problem.

Just do:

"sudo mkdir -p /usr/src/zfs

sudo chown youruser:src /usr/src/zfs

cd /usr/src/zfs"

etc

untill it is time to install, then do 

"sudo make install"

 

From: steve at: 2011-01-29 20:45:17

Why even build in /usr/src?  Just build the modules locally somewhere in your own home directory without all the sudo prefixes, then do the final install with

 

sudo make install

 

this is the way that 99.9999% of all kernel drivers build and install  (except for some crazies at Realtek)

From: Anonymous at: 2011-04-27 13:59:38

If you want to do everything as root anyways... sudo -i is much easier :P