Native ZFS On Ubuntu

Want to support HowtoForge? Become a subscriber!
 
Submitted by brande (Contact Author) (Forums) on Fri, 2011-01-21 17:15. :: 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!


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Wed, 2011-04-27 14:59.
If you want to do everything as root anyways... sudo -i is much easier :P
Submitted by steve (not registered) on Sat, 2011-01-29 21:45.

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)

Submitted by sudoAnonymous (not registered) on Wed, 2011-01-26 06:51.

sudo this was hilarious.

sudo i hope no one actually does what you suggest.

sudo end comment.

Submitted by Anders Jackson (not registered) on Mon, 2011-01-24 21:19.

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"

 

Submitted by Anonymous (not registered) on Mon, 2011-01-24 16:39.
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.
Submitted by Martin Matuska (not registered) on Sat, 2011-01-22 00:32.

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

Submitted by Chris (not registered) on Mon, 2011-01-24 14:01.

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'.

 

Submitted by Anonymous (not registered) on Sat, 2012-08-04 20:08.
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