* This guide uses the unofficial archzfs repository hosted at http://demizerone.com/archzfs. This repository is maintained by Jesus Alvarez and is signed with his PGP key: [http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x5E1ABF240EE7A126 0EE7A126].

+

* This guide uses the unofficial archzfs repository hosted at http://demizerone.com/demz-repo-core. This repository is maintained by Jesus Alvarez and is signed with his PGP key: [http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x5E1ABF240EE7A126 0EE7A126].

* 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.

* 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==

==Boot from the installation media==

Line 25:

Line 23:

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.

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.

−

To embed {{ic|zfs}} in the archiso, download the {{ic|archiso}} package.

+

To embed {{ic|zfs}} in the archiso, from an existing install, download the {{ic|archiso}} package.

{{Warning|Always use id names when working with ZFS, otherwise import errors will occur.}}

{{Warning|Always use id names when working with ZFS, otherwise import errors will occur.}}

−

===Create the root filesystem===

+

===Create necessary filesystems===

−

−

# zfs create rpool/ROOT

−

−

create the descendant file system that will hold the installation:

−

−

# zfs create rpool/ROOT/arch

−

−

We will set the mount points after we have created the filesystems so that they are not mounted automatically by ZFS.

If so desired, sub-filesystem mount points such as /home and /root can be created with the following commands:

If so desired, sub-filesystem mount points such as /home and /root can be created with the following commands:

−

# zfs create rpool/HOME

+

# zfs create zroot/home

−

# zfs create rpool/HOME/root

+

# zfs create zroot/root

For safety, unmount all zfs filesystems if they are mounted:

For safety, unmount all zfs filesystems if they are mounted:

Line 159:

Line 150:

Now it is time to set the mount point of the root filesystem:

Now it is time to set the mount point of the root filesystem:

−

# zfs set mountpoint=/ rpool/ROOT/arch

+

# zfs set mountpoint=/ zroot

and optionally, any sub-filesystems:

and optionally, any sub-filesystems:

−

# zfs set mountpoint=/home rpool/HOME

+

# zfs set mountpoint=/home zroot/home

−

# zfs set mountpoint=/root rpool/HOME/root

+

# zfs set mountpoint=/root zroot/root

Set the bootfs property on the descendant root filesystem so the boot loader knows where to find the operating system.

Set the bootfs property on the descendant root filesystem so the boot loader knows where to find the operating system.

−

# zpool set bootfs=rpool/ROOT/arch rpool

+

# zpool set bootfs=zroot zroot

Export the pool,

Export the pool,

−

# zpool export rpool

+

# zpool export zroot

{{Warning|Don't skip this, otherwise you will be required to use -f when importing your pools. This unloads the imported pool.}}

{{Warning|Don't skip this, otherwise you will be required to use -f when importing your pools. This unloads the imported pool.}}

Line 178:

Line 169:

Finally, re-import the pool,

Finally, re-import the pool,

−

# zpool import -d /dev/disk/by-id -R /mnt rpool

+

# zpool import -d /dev/disk/by-id -R /mnt zroot

{{Note|"-d" is not the actual device id, but the /dev/by-id directory containing the symlinks.}}

{{Note|"-d" is not the actual device id, but the /dev/by-id directory containing the symlinks.}}

Line 195:

Line 186:

===BIOS systems===

===BIOS systems===

−

This section has not been written yet.

+

# mkdir /mnt/boot

+

# mount /dev/sda1 /mnt/boot

==Install and configure the Arch Linux installation==

==Install and configure the Arch Linux installation==

Line 205:

Line 197:

Generate the fstab,

Generate the fstab,

−

# genfstab -U -p /mnt >> /mnt/etc/fstab

+

# genfstab -U -p /mnt | grep boot >> /mnt/etc/fstab

−

−

Open fstab to edit contents,

−

−

# nano /mnt/etc/fstab

−

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

+

{{Note|ZFS auto mounts its own partitions, so we do not need ZFS partitions in fstab file.}}

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

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

Line 225:

Line 213:

# pacman -Syy

# pacman -Syy

−

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

+

Re-create the initramfs, edit {{ic|/etc/mkinitcpio.conf}} and add {{ic|zfs}} before filesystems. Also, move {{ic|keyboard}} hook before {{ic|zfs}} so you can type in console if something goes wrong. Remove fsck and then regenerate the initramfs:

# mkinitcpio -p linux

# mkinitcpio -p linux

Line 235:

Line 223:

===UEFI systems===

===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.

+

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=zroot", so the system can boot from ZFS. The 'root' and 'rootfstype' parameters aren't needed.

===BIOS systems===

===BIOS systems===

−

This section has not been written yet.

+

Follow the [[Grub2#BIOS_systems_2]] wiki. {{ic|grub-mkconfig}} fails for me, so I edited {{ic|grub.cfg}} manually.

+

+

{{hc|/boot/grub/grub.cfg|<nowiki>

+

set timeout=2

+

set default=0

+

+

# (0) Arch Linux

+

menuentry "Arch Linux" {

+

set root=(hd0,1)

+

linux /vmlinuz-linux zfs=zroot

+

initrd /initramfs-linux.img

+

}

+

</nowiki>

+

}}

==Unmount and restart==

==Unmount and restart==

Line 248:

Line 249:

# umount /mnt/boot

# umount /mnt/boot

# zfs umount -a

# zfs umount -a

−

# zpool export rpool

+

# zpool export zroot

# reboot

# reboot

Line 270:

Line 271:

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 [http://osdir.com/ml/zfs-discuss/2011-06/msg00227.html Re: Howto zpool import/export automatically? - msg#00227].

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 [http://osdir.com/ml/zfs-discuss/2011-06/msg00227.html Re: Howto zpool import/export automatically? - msg#00227].

+

+

If ZFS complains about "pool may be in use" after every reboot, you should properly export pool as described above, and then rebuild ramdisk in normally booted system:

+

+

# mkinitcpio -p linux

==See also==

==See also==

Revision as of 20:33, 30 April 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.

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.

To embed zfs in the archiso, from an existing install, download the archiso package.

Install and configure the Arch Linux installation

Note: ZFS auto mounts its own partitions, so we do not need ZFS partitions in fstab file.

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. Also, move keyboard hook before zfs so you can type in console if something goes wrong. 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=zroot", 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.

If ZFS complains about "pool may be in use" after every reboot, you should properly export pool as described above, and then rebuild ramdisk in normally booted system: