ZFS on Linux Logo

Introduction

If like me you’re a fan of this filesystem and find it a shame that it’s not natively available on Linux, there are currently several solutions to have this filesystem:

  • Solaris/OpenSolaris: This is where ZFS comes from, but it remains a proprietary OS
  • FreeBSD: The first port of ZFS appeared on FreeBSD, but we’re looking to use Linux here
  • Kfreebsd: not really Linux (although Debian), but a FreeBSD kernel that allows ZFS to run with a Debian-style layer on top
  • ZFS on Fuse: works on Linux, slow (because it runs on FUSE) but historically the first to be released for Linux (so supposedly the most mature)
  • ZFS on Linux: newer, but has the advantage of running as a Linux kernel module

I chose this last solution because I wanted to keep a Linux machine (Debian/Ubuntu) and have ZFS.

Installation

Prerequisites

To install ZFS on Linux, we’ll need some dependencies:

  aptitude install build-essential gawk alien fakeroot linux-headers-$(uname -r) install zlib1g-dev uuid-dev libblkid-dev libselinux1-dev
  

Once these dependencies are installed, you’ll need to either get the list of packages and install them one by one, or use the Ubuntu repository (which is what we’ll do here).

Ubuntu

If you’re on Ubuntu, run this command to add the repository:

  add-apt-repository ppa:zfs-native/stable
  

If it doesn’t work, you might be missing this package:

  apt-get install python-software-properties
  

Debian

For Debian, you’ll need to add the following sources to your sources.list file (/etc/apt/sources.list):

  deb http://ppa.launchpad.net/dajhorn/zfs/ubuntu natty main 
deb-src http://ppa.launchpad.net/dajhorn/zfs/ubuntu natty main 
  

ZFS

To install ZFS, all you need to do is:

  aptitude update
aptitude install ubuntu-zfs
  

And that’s it, it’s installed! I’ll let you check the references of this page for how to use ZFS.

FAQ

My server crashed because there was no more RAM available

I already talk about this here, it’s because of the ZFS cache that needs to be customized. Here we’ll set it to 512 MB (/etc/modprobe.d/zfs.conf):

  options zfs zfs_arc_max=536870912
  

References

http://www.deimos.fr/blocnotesinfo/index.php?title=ZFS_:_Le_FileSystem_par_excellence

Last updated 06 Dec 2011, 20:57 +0200. history