Tutorial: native ZFS on Ubuntu and Fedora Linux

ZFS is a great filesystem and making it available for Linux opens a bridge between Solaris, FreeBSD and Linux.

KQ Infotech has released the source of their ZFS port to the general public, using pool version 28.
You can get more information at their webpage: kqstor.com
Source code is available at github.com.

In this arcicle I am giving a tutorial how to build from source and install packages of native ZFS kernel modules for Ubuntu/Debian and Fedora Linux.

You need a x86_64 version (64-bit) of the Linux distributions.

NOTICE: tutorial is obsolete, please visit Native ZFS for Linux Homepage


Steps to build and install native ZFS on Debian/Ubuntu:

  1. Become root
    user@ubuntu:~/# sudo bash
  2. Install build-time dependencies
    root@ubuntu:~/# apt-get install autotools-dev debhelper devscripts gawk git uuid-dev zlib1g-dev
  3. Install runtime dependencies (needed also for build-time)
    root@ubuntu:~/# apt-get install python-dmidecode python-soappy python-libxml2
    These packages are required to install the lzfs package (on each system).
  4. Create a build directory and enter it:
    root@ubuntu:~/# mkdir zfs-build
    root@ubuntu:~/# cd zfs-build
  5. Download and unpack the source code: you have 2 options:
    1. The easy way: download and extract my source snapshot with disabled SPL and ZFS tests
      root@ubuntu:~/zfs-build# wget http://www.vx.sk/download/source/zfs-linux/zfs-linux-20110303.tar.bz2
      root@ubuntu:~/zfs-build# tar xfj zfs-linux-20110303.tar.bz2
    2. The more complicated way: checkout the latest version of the upstream misc-scripts and zfs directories
      root@ubuntu:~/zfs-build# git clone https://github.com/zfs-linux/misc-scripts.git
      root@ubuntu:~/zfs-build# git clone https://github.com/zfs-linux/zfs.git

      and disable at least the ZCONFIG and ZPIOS tests by editing zfs/scripts/Makefile.in (put a “#” at the front of the @$(ZCONFIG) and @$(ZPIOS_SANITY) lines in the “check:” section)
      “# @$(ZCONFIG)”
      “# @$(ZPIOS_SANITY)”
  6. Build the packages
    root@ubuntu:~/zfs-build# ./misc-scripts/create_debian.sh
    If you are using my source snapshot and do not want to checkout latest sources, put a “#” in front of the three “git clone” lines in misc-scripts/create_debian.sh
    When asked about “Configuration file /etc/init.d/zfsload”, answer “Y”.
  7. Your packages are ready (and installed, too):
    root@ubuntu:~/zfs-build# ls *.deb
    The packages are built against your kernel version, you can use them on any system with the same kernel.
    Install them in the following order: spl, zfs and finally lzfs
  8. Automatic startup
    The automatic startup script is called /etc/init.d/zfsload
    Now you can try out the main ZFS commands: zpool, zfs

Steps to build and install native ZFS on Fedora:

  1. Become root
    [user@fedora ~]$ su –
  2. Install build-time dependencies
    [root@fedora ~]$ yum install gcc git kernel kernel-devel rpm-build libuuid-devel wget zlib-devel
    After installing dependencies, reboot to the latest kernel.
  3. Install runtime dependencies:
    [root@fedora ~/zfs-build]$ yum install SOAPpy python-dmidecode
    These packages are required to install the lzfs package (on each system).
  4. Create a build directory and enter it:
    [root@fedora ~]$ mkdir zfs-build
    [root@fedora ~]$ cd zfs-build
  5. Download and unpack the source code: you have 2 options:
    1. The easy way: download and extract my source snapshot with disabled SPL and ZFS tests
      [root@fedora ~/zfs-build]$ wget http://www.vx.sk/download/source/zfs-linux/zfs-linux-20110303.tar.bz2
      [root@fedora ~/zfs-build]$ tar xfj zfs-linux-20110303.tar.bz2
    2. The more complicated way: checkout the latest version of the upstream misc-scripts and zfs directories
      [root@fedora ~/zfs-build]$ git clone https://github.com/zfs-linux/misc-scripts.git
      [root@fedora ~/zfs-build]$ git clone https://github.com/zfs-linux/zfs.git

      and disable at least the ZCONFIG and ZPIOS tests by editing zfs/scripts/Makefile.in (put a “#” at the front of the @$(ZCONFIG) and @$(ZPIOS_SANITY) line in the “check:” section)
      “# @$(ZCONFIG)”
      “# @$(ZPIOS_SANITY)”
  6. Build the packages
    [root@fedora ~/zfs-build]$ ./misc-scripts/create_rpm.sh
    If you are using my source snapshot and do not want to checkout latest sources, put a “#” in front of the three “git clone” lines in misc-scripts/create_rpm.sh
  7. Your packages are ready:
    [root@fedora ~/zfs-build]$ ls rpm*/*/*.rpm
    The packages are built against your kernel version, you can use them on any system with the same kernel.
  8. Install packages:
    [root@fedora ~/zfs-build]$ rpm -i rpm*/spl/spl-modules-0*.x86_64.rpm
    [root@fedora ~/zfs-build]$ rpm -i rpm*/spl/spl-0*.x86_64.rpm
    [root@fedora ~/zfs-build]$ rpm -i rpm*/zfs/zfs-modules-0*.x86_64.rpm
    [root@fedora ~/zfs-build]$ rpm -i rpm*/zfs/zfs-0*.x86_64.rpm
    [root@fedora ~/zfs-build]$ rpm -i rpm*/lzfs/lzfs-*.x86_64.rpm

    For lzfs you need the prerequisities SOAPpy and python-dmidecode.
    Install order: spl-modules, spl, zfs-modules, zfs, lzfs

  9. Automatic startup
    The automatic startup script is called /etc/init.d/zfsload and can be enabled/disabled e.g. with “ntsysv”.
    Now you can try out the main ZFS commands: zpool, zfs

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>