After using ZFS on FreeNAS and then using btrfs on Linux , I was curious to see how ZFS on Linux stacked up against btrfs. I attempted setting up Arch Linux on ZFS around a year ago and after running into multiple problems I abandoned the thought of getting it working. With all the talk recently in the Linux community, I was curious to see if the process had changed at all in the last year and if I could get it running successfully.
In this multi-part series I go through the process of getting Arch Linux running using ZFS as the root file system. In the first section I will explain how to get ZFS on the install media itself so that Arch can be easily installed from the ISO. If you plan to install Arch a different way you can skip to part two for an explanation of the install process.
Part One - Pre-Install Process
- Preparing the Archiso Image
- Customizing The Image
- Build The Image
- Using The Image
Since the default install image of Arch Linux does not support ZFS as a file system, the easiest way to install Arch using ZFS is to build a live install image with all the necessary packages installed. While this might sound complicated, the tool Archiso contains everything required to build a new image from scratch. In fact Archiso is what the Arch Linux project uses to build the official images you can download from the site. In order to use Archiso an Arch Linux system is required to build the image.
Preparing the Archiso Image
To use Archiso, the package archiso is needed. Archiso should only be used on an x86_64 system.
Install the package
Note: To avoid permissions problems with the image, it is recommended to use the root user for all the Archiso steps.
Archiso comes with a customizable profile
releng located in
/usr/share/archiso/configs/releng, copy the contents to a location for customizing.
The Archiso directory should contain four folders, airootfs, efiboot, isolinux and syslinux, and six files, build.sh, packages.both, packages.i686,packages.x86_64,pacman.conf, and mkinitcpio.conf.
The only files and folders to be concerned with are:
- Acts as
/of final image
- Any files and folders that are wanted should be copied here.
- Acts as
- Any packages that should be installed onto the final image should be listed in these files.
- If any of the packages are architecture dependent they should be put in either the
x86_64package file. Otherwise they should be listed in
- The package manager configuration file.
- List any additional repositories here.
Customizing The Image
Add The ZFS Repository
Using Archiso it is easy to specify which packages need to be installed onto the image and any commands that should be be run to set the image up. The easiest way to add ZFS to the image is to use the user repository archzfs.
In order to use the archzfs repository, it must be added to the list of repositories in the
Edit the pacman.conf file:
Above the other repositories
Add The ZFS Package
Next, add the
archzfs-linux group to the list of packages to be installed in
~/archlive/packages.x86_64, it might be the only package in the list.
If any administration is going to be done on the live image over SSH, make sure the openssh package is in
Running Administrative Commands
If any commands need to run such as starting SSH, adding users and the such, they should be listed in the
If SSH will be used, add a user, set their password and root’s password, and start sshd in the bottom of
If any scripts are needed, copy them to
~/archlive/airootfs. They will end up relative to
/ in the final image.
Build The Image
I like to copy the final archlive directory to /tmp and build my images there, this keeps the original directory I made the changes in clean. Run
build.sh to generate the image.
To build the image, make the directory
out in archlive, the final image will end up there.
Using The Image
The image can be burned to a usb drive.
Find the correct drive with
Once the correct drive
/dev/sdx is found, write to a usb drive with
dd. This will destroy anything on the drive. Make sure to select the entire drive
sdx, not a number
Once finished the drive should be bootable and ready for installation.
In the next section I will go over the installation process.