Revision as of 01:45, 27 January 2013

The Zettabyte File System (ZFS) is an advanced copy-on-write filesystem designed to preserve data integrity from a multitude of possible corruption scenarios as well as provide simple administration features. ZFS makes disk administration effortless with support ZFS storage pools (zpools) and automatic mount handling. First released in 2005 for Solaris OS, ZFS has since become the flag bearer for next generation filesystems.

Notes before installation

The ZFS packages are tied to the kernel version they were built against. This means it will not be possible to perform kernel updates until new packages (or package sources) are released by the ZFS package maintainer.

This guide currently targets UEFI compatible systems. It should be relatively easy to install ZFS on bios compatible systems using this guide. The sections for BIOS installations exist in this article as stubs to allow easy contributions of content.

Boot from the installation media

It is a good idea make an installation media with the needed software included. Otherwise, you will need the latest archiso installation media burned to a CD or a USB key.

Install and configure the Arch Linux installation

Note: Delete all the lines except for the boot partion. ZFS auto mounts its own partitions.

If installing on a UEFI system, you will need to load the efivars kernel module before chrooting into the installation:

# modprobe efivars

Chroot into the installation

# arch-chroot /mnt /bin/bash

Next, follow the Beginners' Guide from the "Locale" section to the "Configure Pacman Section". Once done, edit pacman.conf, add the archzfs repository, and update the pacman database,

# pacman -Syy

Re-create the initramfs, edit /etc/mkinitcpio.conf and add zfs before filesystems. Remove fsck and then regenerate the initramfs:

# mkinitcpio -p linux

Finally, set root password and add a regular user.

Setup the bootloader

UEFI systems

Use EFISTUB and rEFInd for the UEFI boot loader. See Beginners' Guide#For UEFI motherboards. The kernel parameters in refind_linux.conf for zfs should include "zfs=bootfs", or "zfs=rpool/ROOT/arch", so the system can boot from ZFS. The 'root' and 'rootfstype' parameters aren't needed.

Troubleshooting

Once inside the chroot environment, load the ZFS module and force import the zpool,

# zpool import -a -f

now export the pool:

# zpool export <pool>

To see your available pools, use,

# zpool status

It is necessary to export a pool because of the way ZFS uses the hostid to track the system the zpool was created on. The hostid is generated partly based on your network setup. During the installation in the archiso your network configuration could be different generating a different hostid than the one contained in your new installation. Once the zfs filesystem is exported and then re-imported in the new installation, the hostid is reset. See Re: Howto zpool import/export automatically? - msg#00227.