ZFS on Linux

Google Summer of Code on 2006 have sponsored the ZFS-FUSE project which aims to bring Sun’s ZFS on Linux. Because of the incompatibility between Sun’s CDDL license, which ZFS is distributed under, and Linux’s kernel GPL license, ZFS can’t be ported on Kernel level. The workaround to this is to run the filesystem on userspace level with FUSE. A month ago has been released the 0.5.0 version zfs-fuse.

So, how can you get zfs-fuse running on your Linux? In order to compile and use zfs-fuse, you need the following:

– Linux kernel 2.6.x
– FUSE 2.5.x or greater
– libaio and libaio-devel
– zlib and zlib-deve
– glibc version 2.3.3 or newer with NPTL enabled.
– SCons

For compiling the code:

cd zfs-fuse-0.5.0
cd src
scons

If all goes fine, then proceed with the installation:

scons install install_dir=/installation/target

If you don’t define a specific directory to be installed in, then the binaries will be placed in /usr/local/sbin. If you install the binaries in a different directory don’t forget to add the directory path into your $PATH:

export PATH=/installation/target:$PATH

Once the installation is finished you can start the zfs-fuse daemon. However, before starting the daemon you’ll need to create the /etc/zfs directory:

mkdir /etc/zfs

That directory used to be automatically created in previous releases but not on 0.5.0 (?). The directory is used to store the zpool.cache file which contains the information of your pools. Having created the directory, what is left is to start the zfs-fuse daemon by simply running the command ‘zfs-fuse’.
You can now create your first pool by issuing the command:

zpool create zfsRoot /dev/sdb

You can replace “zfsRoot” with the name you like for your pool. That will then be created under /. The device at the last part of the command is the disk you want to start using as your ZFS pool. If you want to add /dev/sdc as another one disk to the pool run:

zpool add zfsRoot /dev/sdc

Having the pool set, the new filesystems can start to be created. Creating a filesystem with ZFS is as easy as that:

zfs create zfsRoot/filesystem1

Data can now start being written to the new ZFS filesystem. You’ve probably have mentioned that there hasn’t been defined any capacity for the filesystem. Leaving the filesystem as it is, it will use as much space as it needs and as much as the pool offers. If you want to avoid that, you can set a quota:

zfs set quota=10G zfsRoot/filesystem1

This will set the maximum capacity of the filesystem to 10 GB.

So far so good. What happens if the machine will get rebooted? You’ll need to do some manual work. Having created the /etc/zfs directory everything should be alright. The process should be the following:
– Start zfs-fuse daemon
– import the existing pools:

zpool import

– Mount the existing filesystems

zfs mount zfsRoot/filesystem1

Then everything should be back in place. The problem is that doing this manually every time can cause problems and definitely doesn’t save any time.
I have written a script which starts and stops the zfs-fuse daemon and mounts any existing filesystems. In order to mount the filesystems, the scripts reads the filesystems from /etc/zfstab which specifies the filesystems in the normal ZFS format ‘zfsRoot/filesystem1’.
Depending on the host operating system, the script could be configured to be a startup script so you’ll not have to run the script manually at all.
The script is setZFS

links:
http://zfs-on-fuse.blogspot.com
http://groups.google.com/group/zfs-fuse

4 thoughts on “ZFS on Linux

  1. giat501

    NICE INFO

    I’D HEARED THAT PROJECT BUT I DIDN’T ABOUT IT,

    I THINK ZFS ONLY IN SOLARIS’S FILESYSTEM, BUT THAT’S GOOD INFORMATION FOR LINUX’S COMMUNITY CAUSE ZFS IS THE BEST FILESYSTEM I EVER KNOW AND MAKE IT IN LINUX NOW.

  2. panoskrt

    @giat501: ZFS is really ahead of other filesystems. Both in how easy is to administrate and how it operates. However, until recently there was a very serious bugs that could cause kernel panic in Solaris and shutdown/reboot the machine… But that should have been fixed with Solaris 10 update 5.

    @Joe: cheers🙂

  3. Pingback: Getting started with ZFS on Linux: starting the f’n thing « Paul Oppenheim

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s