Know How -- ZFS -- Really don't panic

ZFS on Linux via FUSE.

Links:

An ultra-short HowTo

Here is my way how I got running ZFS on Debian 4.0r1.

Prerequisites

This is for a build on Debian Etch. Perhaps you even need some more, but this worked after a nearly fresh Debian install:

apt-get install scons
apt-get install fuse-utils libfuse-dev libfuse2
apt-get install build-essential zlib1g-dev
apt-get install libaio-dev

Do not miss the new prerequisite
apt-get install libaio-dev

Get newest Mercurial

ZFS-FUSE uses recent features of Mercurial. So if you do not have the very latest mercurial-version, you no more are able to compile use ZFS-FUSE. Note that the stable Debian version is not enough anymore as it is based on Mercurial 0.9.1. You have to uninstall the debian version and build Mercurial first yourself.

This is a 9/11 (man made really useless catastrophe). It shows that chosing Mercurial as SCM is bad. Period.

Even worse is that mercurial takes nearly 10 minutes to download (data rate below 2 KB/s).

You can build Mercurial as follows:

dpkg -P mercurial
apt-get install python-all-dev
wget http://www.selenic.com/mercurial/release/mercurial-1.0.1.tar.gz
tar xfz mercurial-1.0.1.tar.gz
cd mercurial-1.0.1
make all
sudo make install

But this still does not work at my side, as HG apparently is unable to tell the difference between a file and a softlink! hg update does not fix anything, hg diff does not show anything.

The only way to fix this efficiently is to remove all the old ZFS stuff you have checked out and start from scratch. This seems to fix it.

If you see following problem
*** failed to import extension hgext/hbisect: No module named hgext/hbisect
then you did not use
dpkg -P mercurial
to remove mercurial. Do it this way, as "apt-get remove" does not help.

First Download

cd into some directory of your choice where you want to build zfs. Each step is based on the one before (so if you restart be sure to be in the right directory!):

Get the source:
hg clone http://www.wizy.org/mercurial/zfs-fuse/trunk
cd trunk
less INSTALL

Later you can update the source

cd trunk
hg pull
hg update

Build

Always do the complete build after update!

Build and install the tools (without debugging!):
cd src
scons -c
scons
sudo scons install

Build the ZFS userland kernel (with debugging!):
scons -c
scons debug=2

Run

Run the ZFS userland kernel (do not miss the modprobe!):
su -
cd zfs-fuse
modprobe fuse
./run.sh

First steps for creating a pool

Now you can create your pool:
zpool create POOLNAME raidz2 /dev/DRIVE1 /dev/DRIVE2 /dev/DRIVE3 /dev/DRIVE4
You will find it at /POOLNAME

Notes

  • Without the modprobe I was missing /dev/fuse
  • Without the "debug=2" the kernel is so quiet that you cannot trace any problems.
  • Manuals are missing completely. Manuals are not important, as all zfs commands tell some help if called without arguments. Also ZFS is easy, as soon as you started with it you know everything. See First Steps.
-Tino, 2007-12-12, updated 2008-10-04