ZFS On Linux: Setting up ZFS on Linux
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:
|
|
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:
|
|
If it doesn’t work, you might be missing this package:
|
|
Debian
For Debian, you’ll need to add the following sources to your sources.list file (/etc/apt/sources.list
):
|
|
ZFS
To install ZFS, all you need to do is:
|
|
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
):
|
|
References
Last updated 06 Dec 2011, 20:57 +0200.