Skip to content
jgoldschrafe edited this page Aug 26, 2010 · 9 revisions

The Linux zfs kernel port is built on the Solaris Porting Layer which provides a Solaris style API in the Linux kernel. This allows for minimal changes to the core zfs code base and simplifies tracking upstream development. Before building zfs you will need build and install the spl on your system. Be careful to download the matching spl version. For example, if your using the zfs-0.5.0.tar.gz release use the matching spl-0.5.0.tar.gz release.

Once the spl is installed you can build zfs against it using the standard autoconf style build system. The zfs build system is designed to detect and build against your kernel and the spl module. Simply build it as you would any other autoconf style project. The build system will make an educated guess as to which kernel and version of the spl you wish to build against. If it guesses wrong simply specify your kernel devel headers using the —with-linux configure option. You may also need the —with-linux-obj configure option if the kernel build objects are installed in a different directory. You can also specify an alternate version of the spl using the —with-spl configure option. After the configure step simply run make pkg to create the correct type package for your distribution. You may also explicitly request rpm or deb packages with make rpm or make deb.

./configure
make pkg

The result of this will be two source rpm packages.

  • zfs-w.×.y-z.src.rpm: Source for the zfs utilities, libraries, and test infrastructure.
  • zfs-modules-w.×.y-z.src.rpm: Source for the zfs kernel module stack.

And five binary rpm or deb packages for your platform. If you have created deb packages the names may differ slightly from those shown here.

  • zfs-w.×.y-z.arch.<rpm | deb>: The zfs utilities and libraries.
  • zfs-devel-w.×.y-z.arch.<rpm | deb>: The zfs development headers.
  • zfs-test-w.×.y-z.arch.<rpm | deb>: The zfs regression test scripts and infrastructure.
  • zfs-modules-w.×.y-z_kernel.arch.<rpm | deb>: The zfs kernel module stack for your kernel version.
  • zfs-modules-devel-w.×.y-z_kernel.arch.<rpm | deb>: The zfs development headers and symbols for building dependent kernel modules.

Next go ahead and install the packages, for rpm packages install them like this.

rpm -Uvh *.x86_64.rpm
Preparing...                ########################################### [100%]
   1:zfs                    ########################################### [ 20%]
   2:zfs-test               ########################################### [ 40%]
   3:zfs-modules-devel      ########################################### [ 60%]
   4:zfs-modules            ########################################### [ 80%]
   5:zfs-devel              ########################################### [100%]

For deb packages install them like this.

dpkg -i *_amd64.deb
Selecting previously deselected package zfs.
(Reading database ... 225344 files and directories currently installed.)
Unpacking zfs (from zfs_0.5.0-2_amd64.deb) ...
Selecting previously deselected package zfs-devel.
Unpacking zfs-devel (from zfs-devel_0.5.0-2_amd64.deb) ...
Selecting previously deselected package zfs-modules.
Unpacking zfs-modules (from zfs-modules_0.5.0-2_amd64.deb) ...
Selecting previously deselected package zfs-modules-devel.
Unpacking zfs-modules-devel (from zfs-modules-devel_0.5.0-2_amd64.deb) ...
Selecting previously deselected package zfs-test.
Unpacking zfs-test (from zfs-test_0.5.0-2_amd64.deb) ...
Setting up zfs (0.5.0-2) ...
Setting up zfs-devel (0.5.0-2) ...
Setting up zfs-modules (0.5.0-2) ...
Setting up zfs-modules-devel (0.5.0-2) ...
Setting up zfs-test (0.5.0-2) ...
Processing triggers for man-db ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

At this point you’re all set! You should be able to use the zfs tools just like you would under Solaris. However, I’d advise you first take a few minutes to run a couple sanity regression tests to make sure everything is working properly. These tests will require at least 1GiB of space in /tmp/ for loopback devices and files.

The first test you’ll want to run is called zconfig.sh which validates that the zfs utilities are working properly. Once that passes you will want to run zpios-sanity.sh which will create several zpool configurations and verify IO is working properly. Both of these tests will configure zfs to use files and loopback devices so none of your real system data is at risk. These tests will need to be run as root since you are loading several kernel modules. If you do observe a failure please record as much debug information as possible and open an issue so I can fix it. The test suite passes for me on these tested platforms.

/usr/libexec/zfs/zconfig.sh
test 1 - persistent zpool.cache: PASS
test 2 - scan disks for pools to import: PASS
test 3 - zpool import/export device: PASS
test 4 - zpool insmod/rmmod device: PASS
test 5 - zvol+ext3 volume: PASS
test 6 - zvol+ext2 snapshot: PASS
test 7 - zvol+ext2 clone: PASS
/usr/libexec/zfs/zpios-sanity.sh
status    name        id        wr-data wr-ch   wr-bw   rd-data rd-ch   rd-bw
-------------------------------------------------------------------------------
PASS:     file-raid0   0        64m     64      407.64m 64m     64      1.11g
PASS:     file-raid10  0        64m     64      187.13m 64m     64      1.25g
PASS:     file-raidz   0        64m     64      901.40m 64m     64      1.25g
PASS:     file-raidz2  0        64m     64      821.82m 64m     64      1.22g
PASS:     lo-raid0     0        64m     64      916.17m 64m     64      984.17m
PASS:     lo-raid10    0        64m     64      850.47m 64m     64      1.01g
PASS:     lo-raidz     0        64m     64      916.01m 64m     64      1.25g
PASS:     lo-raidz2    0        64m     64      14.63m  64m     64      1.02g
Clone this wiki locally