ZFS

ZFS was developed by SUN Microsystems and is an advanced file system that includes many features like:
 * Manage storage hardware as vdev in zpools
 * Manage volumes in zpools (like LVM)
 * Redundancy with support for RAIDZ1(RAID5),RAIDZ2(RAID6) and MIRROR(RAID1)
 * Resilvering file system
 * Data Deduplication
 * Data Compression with zle (fast) or gzip (higher compression)
 * Snapshots (like differencial backups)
 * NFS export of volumes

Installation
The CDDL licence is incompatible with the GPL licence, therefore it is not allowed to build the modules into the Linux kernel. However, there is a package that allows us to load the modules in userspace. is available on Gentoo Linux and supports the following useflags You can install zfs-fuse using the following command:
 * bash-completion = Enable bash-completion support
 * debug = Enable extra debug codepaths

Start and add zfs-fuse to the boot runlevel:

The configuration files are located in Configuration Files

Usage
ZFS includes already all programs to manage the hardware and the file systems, there are no additional tools needed.

Preparation
To go through the different commands and scenarios we can create virtual hard drives using loopback devices. First we need to make sure the loopback module is loaded. If you want to play around with partitions, use the following option:

The following commands create 2GB image files in /var/lib/zfs_img/ that we use as our hard drives (uses ~8GB disk space):

Now we check which loopback devices are in use:

We assume that all loopback devices are available and create our hard drives:

We have now /dev/loop[0-3] as four hard drives available

Zpools
The program /usr/sbin/zpool is used with any operation regarding zpools.

import/export Zpool
To export (unmount) an existing zpool named zfs_test into the file system, you can use the following command:

To import (mount) the zpool named zfs_test use this command:

One Hard Drive
Create a new zpool named zfs_test with one hard drive:

The zpool will automatically be mounted, default is the root file system aka /zfs_test

To delete a zpool use this command:

MIRROR Two Hard Drives
In ZFS you can have several harddrives in a MIRROR, where equal copies exist on each storage. This increases the performance and redundancy. To create a new zpool named zfs_test with two hard drives as MIRROR:

To delete the zpool:

RAIDZ1 Three Hard Drives
RAIDZ1 is the equivalent to RAID5, where data is written to the first two drives and a parity onto the third. You need at least three hard drives, one can fail and the zpool is still ONLINE but the faulty drive should be replaced as soon as possible. To create a pool with RAIDZ1 and three hard drives:

To delete the zpool:

RAIDZ2 Four Hard Drives
RAIDZ2 is the equivalent to RAID6, where data is written to the first two drives and a parity onto the next two. You need at least four hard drives, two can fail and the zpool is still ONLINE but the faulty drives should be replaced as soon as possible. To create a pool with RAIDZ2 and four hard drives:

To delete the zpool:

Links

 * zfs-fuse.net