Difference between revisions of "Installing Arch Linux on ZFS"

From ArchWiki
Jump to: navigation, search
(Started the page on how to install Arch on ZFS (/ on ZFS). This is a work in progress and will take me a few days to get things polished up and checked carefully.)
 
(Boot from the installation media)
(44 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{Note|This is a work in progress. Some parts could have gaps, or require you to do things on your own.}}
+
[[Category:Getting and installing Arch]]
 +
{{Article summary start}}
 +
{{Article summary text|This article describes the necassary procedures for installing Arch Linux onto a ZFS root filesystem.}}
 +
{{Article summary heading|Related}}
 +
{{Article summary wiki|ZFS}}
 +
{{Article summary wiki|ZFS on FUSE}}
 +
{{Article summary end}}
  
This tutorial will show you how to install Arch Linux (Your / partition) on ZFS.
+
The [[Wikipedia:ZFS|Zettabyte File System (ZFS)]] is an advanced [[Wikipedia:Copy-on-write|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.
  
== Installing Arch Linux on a regular filesystem ==
+
ZFS was first developed and released by Sun (now owned by Oracle) as [[Wikipedia:Open source software|Open Source Software]] licensed under the [[Wikipedia:Common Development and Distribution License|Common Development and Distribution License]] (CDDL) which is famously [http://arstechnica.com/information-technology/2010/06/uptake-of-native-linux-zfs-port-hampered-by-license-conflict/ incompatible with the GNU Public License]. This incompatibility prevents ZFS from being merged into the mainline kernel, and generally presents some obstacles for users that want to use ZFS in Linux.
1. Install Arch Linux to wherever you want as normal<br/>
+
2. Compile a custom kernel (with everything needed to boot built into the kernel and with ZLIB_DEFLATE support)
+
{{Note|The reason for this is because Arch's kernel is very modular and I didn't write my initramfs creator to support autodetection of every single piece of hardware and modules}}
+
3. Compile the zfs/spl rc9 from the aur with kylef's PKGBUILD. https://aur.archlinux.org/packages.php?ID=41045 Modify the PKGBUILD so that the ./configure has --with-linux=/usr/src/linux --with-linux-obj=/usr/src/linux<br/>
+
4. Install the spl/zfs packages<br/>
+
5. Install git and cpio
+
pacman -S git cpio
+
6. Clone my zfs initramfs creator and make a new initramfs
+
git clone git://github.com/fearedbliss/Bliss-Initramfs-Creator.git
+
+
cd Bliss-Initramfs-Creator
+
+
git checkout next
+
  
./createInit
+
[http://zfsonlinux.org/ ZFSonLinux.org] is a project funded by the [https://www.llnl.gov/ Lawrence Livermore National Laboratory] to develop a native Linux kernel module for its massive storage requirements and super computers.
^^ # Follow the instructions and copy the ZFS file to your /boot afterwards
+
  
cp ZFS-kernel-version.img /boot/initramfs-zfs.img
+
==Notes before installation==
  
=== Back up Arch Linux via stage5 ===
+
* 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].
cd /
+
tar --exclude proc --exclude tmp --exclude var/cache/pacman/pkg --exclude sys -cvvpf stage5-arch.tar .
+
  
# Compress the stage5 if you want to with pbzip2 (dont use bzip2.. it will take a much longer time, use pbzip2 if you have a multicore system)
+
* 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.
pbzip2 stage5-arch.tar
+
  
# Save this file somewhere because we will be moving it to our new installation afterwards (stage5-arch.tar.bz2)
+
==Boot from the installation media==
  
(Note, you will need to remake the proc, tmp, and sys directories after you extract it onto the ZFS system)
+
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.
  
# edit your fstab to remove old mountpoints
+
To embed {{ic|zfs}} in the archiso, from an existing install, download the {{ic|archiso}} package.
# add zfs to rc.d
+
# pacman -S archiso
vim /etc/rc.conf (and add zfs to your daemons)
+
  
== New install with ZFS as the filesystem ==
+
Start the process:
 +
# cp -r /usr/share/archiso/configs/releng /root/media
  
In order to partition the system, I was using system rescue cd v2.5.1. The reason I'm using 2.5.1 is because it's the last version that had the
+
Edit the {{ic|packages.x86_64}} file adding those lines:
native ZFS on Linux modules. Any version before or later does not have them. Since the link for 2.5.1 was removed from the author's website, I recommend you
+
spl-utils
to use the Gentoo Live DVD 2012. http://torrents.gentoo.org/ , download the `livedvd-amd64-multilib-2012.1`.
+
spl
 +
zfs-utils
 +
zfs
  
{{Note|If anyone knows of another live cd that like sysresccd that has the ZFS on Linux modules, definitely feel free to add it here}}
+
Edit the {{ic|pacman.conf}} file adding those lines (TODO, correctly embed keys in the installation media?):
 +
[demz-repo-archiso]
 +
SigLevel = Never
 +
Server = <nowiki>http://demizerone.com/$repo/$arch</nowiki>
  
=== Partitioning ===
+
Add other packages in {{ic|packages.both}}, {{ic|packages.i686}}, or {{ic|packages.x86_64}} if needed and create the image.
Our system will be using GPT as the base and extlinux as the bootloader.
+
# ./build.sh -v
  
The layout will look like this:
+
The image will be in the {{ic|/root/media/out}} directory.
/dev/sda1 Linux FS 250M
+
/dev/sda2 bf01 Rest of Disk
+
  
# Create ZFS Pool and Mountpoints
+
More informations about the process can be read in [http://kroweer.wordpress.com/2011/09/07/creating-a-custom-arch-linux-live-usb/ this guide] or in the [[Archiso]] article.
zpool create -o ashift=12 -o cachefile= -O normalization=formD -R /mnt/custom rpool /dev/sda2
+
zfs create -o mountpoint=none rpool/ROOT
+
zfs create -o mountpoint=/ rpool/ROOT/arch
+
zfs create -o mountpoint=/home rpool/HOME
+
zfs create -o mountpoint=/root rpool/HOME/root
+
  
# Mount /boot partition in the zfs /
+
If you are installing onto a UEFI system, see [[Unified Extensible Firmware Interface#Create UEFI bootable USB from ISO]] for creating UEFI compatible installation media.
mkdir /mnt/custom/boot
+
mount /dev/sda1 /mnt/custom/boot
+
  
# Extract Arch Stage5 (Preloaded with ZFS modules and your own kernel)
+
==Setup pacman==
  
# Change into the directory
+
Activate the required network connection and then edit {{ic|/etc/pacman.d/mirrorlist}} and configure the mirrors for pacman to use. Once that is done, edit {{ic|/etc/pacman.conf}} and add the archzfs repository:
  cd /mnt/custom
+
  
=== Install Extlinux bootloader ===
+
{{hc|# nano /etc/pacman.conf|<nowiki>
# Bind proc in the chroot env before chroot so that extlinux can find the correct device
+
[demz-repo-core]
mount --bind /proc ./proc
+
Server = http://demizerone.com/$repo/$arch</nowiki>
env HOME=/root TERM=$TERM chroot . /bin/bash --login
+
}}
mkdir /boot/extlinux
+
extlinux --install /boot/extlinux
+
  
# Set correct boot flags in the GPT legacy bios and then flash mbrgpt
+
Next, add the archzfs maintainer's PGP key to the local trust:
sgdisk /dev/sda --attributes=1:set:2
+
sgdisk /dev/sda --atributes=1:show
+
dd count=1 bs=440 conv=notrunc if=/usr/lib/syslinux/gptmbr.bin of=/dev/sda
+
  
# Make an extlinux.conf
+
    # pacman-key -r 0EE7A126
cd /boot/extlinux
+
    # pacman-key --lsign-key 0EE7A126
vim extlinux.conf
+
  
Inside extlinux.conf put the following
+
Finally, update the pacman databases,
  
PROMPT 0
+
    # pacman -Syy
TIMEOUT 50
+
UI menu.c32
+
+
MENU TITLE Boot Menu
+
DEFAULT arch
+
+
LABLE Arch
+
    MENU LABEL Arch [ZFS]
+
    LINUX /kernel-thatyoucompiled
+
    INITRD /initramfs-zfs.img
+
  
and save it.
+
==Install needed packages==
  
That's it, restart your computer and you should be inside Arch on ZFS :)!
+
This is also the best time to install your favorite text editor, otherwise nano will have to be used.
 +
 
 +
    # pacman -S archzfs dosfstools gptfdisk vim
 +
 
 +
==Partition the destination drive==
 +
 
 +
===UEFI systems===
 +
 
 +
Use the cgdisk partition utility and create a GPT partition table:
 +
 
 +
  Part    Size  Type
 +
  ====    =====  =============
 +
      1    512M  EFI (ef00)
 +
      2    512M  Ext4 (8300)
 +
      2    XXXG  Solaris Root (bf00)
 +
 
 +
{{Note|The EFI partion will be formatted to FAT32 and contain the UEFI boot loader. The Ext4 partition will contain the boot partition and kernel images.}}
 +
 
 +
{{Note|The filesystem type codes for cgdisk are indicated in the parenthesis after the filesystem name.}}
 +
 
 +
{{Warning|The EFI partition must be at least 512MB specified by the UEFI standard.}}
 +
 
 +
===BIOS systems===
 +
 
 +
  Part    Size  Type
 +
  ====    =====  =============
 +
      2    1007K  BIOS Boot Partition (ef02)
 +
      1    512M  Ext4 (8300)
 +
      3    XXXG  Solaris Root (bf00)
 +
 
 +
{{Note|You will have to create the ext4 partition first due to cgdisk's disk alignment policies. Start it at sector 2048 to leave room for the BIOS parition.}}
 +
 
 +
==Format the destination disk==
 +
 
 +
===UEFI systems===
 +
 
 +
Format the EFI partition to FAT32
 +
 
 +
    mkfs.vfat -F 32 /dev/sda1 -n EFIBOOT
 +
 
 +
Format the Ext4 boot partition
 +
 
 +
    mkfs.ext4 /dev/sda2 -L BOOT
 +
 
 +
===BIOS systems===
 +
 
 +
Format the Ext4 boot partition
 +
   
 +
    mkfs.ext4 /dev/sda1 -L BOOT
 +
 
 +
{{Note|The boot filesystem is {{ic|sda1}} because of the order we created the partitions}}
 +
 
 +
The BIOS partition does not need a filesystem.
 +
 
 +
==Setup the ZFS filesystem==
 +
 
 +
First, make sure the ZFS modules are loaded,
 +
 
 +
    # modprobe zfs
 +
 
 +
===Create the root zpool===
 +
 
 +
    # zpool create zroot /dev/disk/by-id/<id-to-partition>
 +
 
 +
{{Warning|Always use id names when working with ZFS, otherwise import errors will occur.}}
 +
 
 +
===Create necessary filesystems===
 +
 
 +
If so desired, sub-filesystem mount points such as /home and /root can be created with the following commands:
 +
 
 +
    # zfs create zroot/home
 +
    # zfs create zroot/root
 +
 
 +
For safety, unmount all zfs filesystems if they are mounted:
 +
 
 +
    # zfs umount -a
 +
 
 +
===Configure the root filesystem===
 +
 
 +
Now it is time to set the mount point of the root filesystem:
 +
 
 +
    # zfs set mountpoint=/ zroot
 +
 
 +
and optionally, any sub-filesystems:
 +
 
 +
    # zfs set mountpoint=/home zroot/home
 +
    # 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.
 +
 
 +
    # zpool set bootfs=zroot zroot
 +
 
 +
Export the pool,
 +
 
 +
    # 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.}}
 +
 
 +
Finally, re-import the pool,
 +
 
 +
    # 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.}}
 +
 
 +
If there is an error in this step, you can export the pool to redo the command. The ZFS filesystem is now ready to use.
 +
 
 +
==Mount the boot partitions==
 +
 
 +
===UEFI systems===
 +
 
 +
    # mkdir /mnt/boot
 +
    # mount /dev/sda2 /mnt/boot
 +
    # mkdir /mnt/boot/efi
 +
    # mount /dev/sda1 /mnt/boot/efi
 +
 
 +
===BIOS systems===
 +
 
 +
    # mkdir /mnt/boot
 +
    # mount /dev/sda1 /mnt/boot
 +
 
 +
==Install and configure the Arch Linux installation==
 +
 
 +
Install the base packages,
 +
 
 +
    # pacstrap -i /mnt base base-devel archzfs sudo gnupg vim
 +
 
 +
Generate the fstab,
 +
 
 +
    # genfstab -U -p /mnt | grep boot >> /mnt/etc/fstab
 +
 
 +
{{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 {{ic|pacman.conf}}, add the archzfs repository, and update the pacman database,
 +
 
 +
    # pacman -Syy
 +
 
 +
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
 +
 
 +
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.
 +
 
 +
===BIOS systems===
 +
 
 +
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==
 +
 
 +
This is it, we are done!
 +
 
 +
    # exit
 +
    # umount /mnt/boot
 +
    # zfs umount -a
 +
    # zpool export zroot
 +
    # reboot
 +
 
 +
{{Warning|If you do not properly export the zpool, the pool will refuse to import in the ramdisk environment and you will be stuck at the busybox terminal.}}
 +
 
 +
==Troubleshooting==
 +
 
 +
If the new installation does not boot because the zpool cannot be imported, you will need to chroot into the installation and properly export the zpool. See [[ZFS#Emergency chroot repair with archzfs]].
 +
 
 +
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 [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==
 +
 
 +
* [https://github.com/dajhorn/pkg-zfs/wiki/HOWTO-install-Ubuntu-to-a-Native-ZFS-Root-Filesystem HOWTO install Ubuntu to a Native ZFS Root]
 +
* [http://lildude.co.uk/zfs-cheatsheet ZFS Cheatsheet]

Revision as of 20:33, 30 April 2013

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end

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.

ZFS was first developed and released by Sun (now owned by Oracle) as Open Source Software licensed under the Common Development and Distribution License (CDDL) which is famously incompatible with the GNU Public License. This incompatibility prevents ZFS from being merged into the mainline kernel, and generally presents some obstacles for users that want to use ZFS in Linux.

ZFSonLinux.org is a project funded by the Lawrence Livermore National Laboratory to develop a native Linux kernel module for its massive storage requirements and super computers.

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.

# pacman -S archiso

Start the process:

# cp -r /usr/share/archiso/configs/releng /root/media

Edit the packages.x86_64 file adding those lines:

spl-utils
spl
zfs-utils
zfs

Edit the pacman.conf file adding those lines (TODO, correctly embed keys in the installation media?):

[demz-repo-archiso]
SigLevel = Never
Server = http://demizerone.com/$repo/$arch

Add other packages in packages.both, packages.i686, or packages.x86_64 if needed and create the image.

# ./build.sh -v

The image will be in the /root/media/out directory.

More informations about the process can be read in this guide or in the Archiso article.

If you are installing onto a UEFI system, see Unified Extensible Firmware Interface#Create UEFI bootable USB from ISO for creating UEFI compatible installation media.

Setup pacman

Activate the required network connection and then edit /etc/pacman.d/mirrorlist and configure the mirrors for pacman to use. Once that is done, edit /etc/pacman.conf and add the archzfs repository:

# nano /etc/pacman.conf
[demz-repo-core]
Server = http://demizerone.com/$repo/$arch

Next, add the archzfs maintainer's PGP key to the local trust:

   # pacman-key -r 0EE7A126
   # pacman-key --lsign-key 0EE7A126

Finally, update the pacman databases,

   # pacman -Syy

Install needed packages

This is also the best time to install your favorite text editor, otherwise nano will have to be used.

   # pacman -S archzfs dosfstools gptfdisk vim

Partition the destination drive

UEFI systems

Use the cgdisk partition utility and create a GPT partition table:

  Part     Size   Type
  ====     =====  =============
     1     512M   EFI (ef00)
     2     512M   Ext4 (8300)
     2     XXXG   Solaris Root (bf00)
Note: The EFI partion will be formatted to FAT32 and contain the UEFI boot loader. The Ext4 partition will contain the boot partition and kernel images.
Note: The filesystem type codes for cgdisk are indicated in the parenthesis after the filesystem name.
Warning: The EFI partition must be at least 512MB specified by the UEFI standard.

BIOS systems

  Part     Size   Type
  ====     =====  =============
     2     1007K  BIOS Boot Partition (ef02)
     1     512M   Ext4 (8300)
     3     XXXG   Solaris Root (bf00)
Note: You will have to create the ext4 partition first due to cgdisk's disk alignment policies. Start it at sector 2048 to leave room for the BIOS parition.

Format the destination disk

UEFI systems

Format the EFI partition to FAT32

   mkfs.vfat -F 32 /dev/sda1 -n EFIBOOT

Format the Ext4 boot partition

   mkfs.ext4 /dev/sda2 -L BOOT

BIOS systems

Format the Ext4 boot partition

   mkfs.ext4 /dev/sda1 -L BOOT
Note: The boot filesystem is sda1 because of the order we created the partitions

The BIOS partition does not need a filesystem.

Setup the ZFS filesystem

First, make sure the ZFS modules are loaded,

   # modprobe zfs

Create the root zpool

   # zpool create zroot /dev/disk/by-id/<id-to-partition>
Warning: Always use id names when working with ZFS, otherwise import errors will occur.

Create necessary filesystems

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

   # zfs create zroot/home
   # zfs create zroot/root

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

   # zfs umount -a

Configure the root filesystem

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

   # zfs set mountpoint=/ zroot

and optionally, any sub-filesystems:

   # zfs set mountpoint=/home zroot/home
   # 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.

   # zpool set bootfs=zroot zroot

Export the pool,

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

Finally, re-import the pool,

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

If there is an error in this step, you can export the pool to redo the command. The ZFS filesystem is now ready to use.

Mount the boot partitions

UEFI systems

   # mkdir /mnt/boot
   # mount /dev/sda2 /mnt/boot
   # mkdir /mnt/boot/efi
   # mount /dev/sda1 /mnt/boot/efi

BIOS systems

   # mkdir /mnt/boot
   # mount /dev/sda1 /mnt/boot

Install and configure the Arch Linux installation

Install the base packages,

   # pacstrap -i /mnt base base-devel archzfs sudo gnupg vim

Generate the fstab,

   # genfstab -U -p /mnt | grep boot >> /mnt/etc/fstab
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.

BIOS systems

Follow the Grub2#BIOS_systems_2 wiki. grub-mkconfig fails for me, so I edited grub.cfg manually.

/boot/grub/grub.cfg
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
}

Unmount and restart

This is it, we are done!

   # exit
   # umount /mnt/boot
   # zfs umount -a
   # zpool export zroot
   # reboot
Warning: If you do not properly export the zpool, the pool will refuse to import in the ramdisk environment and you will be stuck at the busybox terminal.

Troubleshooting

If the new installation does not boot because the zpool cannot be imported, you will need to chroot into the installation and properly export the zpool. See ZFS#Emergency chroot repair with archzfs.

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:

   # mkinitcpio -p linux

See also