Difference between revisions of "Installing Arch Linux on ZFS"

From ArchWiki
Jump to: navigation, search
m (Installing Arch Linux on a regular filesystem)
(Add category. See Help:Style.)
Line 1: Line 1:
[[Category:Getting and installing Arch]]
{{Note|This is a work in progress. Some parts could have gaps, or require you to do things on your own.}}
{{Note|This is a work in progress. Some parts could have gaps, or require you to do things on your own.}}

Revision as of 11:01, 19 June 2012

Note: This is a work in progress. Some parts could have gaps, or require you to do things on your own.

This tutorial will show you how to install Arch Linux (Your / partition) on ZFS.

Installing Arch Linux on a regular filesystem

1. Install Arch Linux to wherever you want as normal
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
4. Install the spl/zfs packages
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

^^ # Follow the instructions and copy the ZFS file to your /boot afterwards

cp ZFS-kernel-version.img /boot/initramfs-zfs.img

Back up Arch Linux via stage5

cd /
tar --exclude proc --exclude tmp --exclude var/cache/pacman/pkg --exclude sys -cvvpf stage5-arch.tar .
  1. 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)
pbzip2 stage5-arch.tar
  1. Save this file somewhere because we will be moving it to our new installation afterwards (stage5-arch.tar.bz2)

(Note, you will need to remake the proc, tmp, and sys directories after you extract it onto the ZFS system)

  1. edit your fstab to remove old mountpoints
  2. add zfs to rc.d

vim /etc/rc.conf (and add zfs to your daemons)

New install with ZFS as the filesystem

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 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 to use the Gentoo Live DVD 2012. http://torrents.gentoo.org/ , download the `livedvd-amd64-multilib-2012.1`.

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


Our system will be using GPT as the base and extlinux as the bootloader.

The layout will look like this:

/dev/sda1 Linux FS 250M
/dev/sda2 bf01 Rest of Disk
  1. Create ZFS Pool and Mountpoints
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
  1. Mount /boot partition in the zfs /
mkdir /mnt/custom/boot
mount /dev/sda1 /mnt/custom/boot
  1. Extract Arch Stage5 (Preloaded with ZFS modules and your own kernel)
  1. Change into the directory
cd /mnt/custom

Install Extlinux bootloader

  1. Bind proc in the chroot env before chroot so that extlinux can find the correct device
mount --bind /proc ./proc
env HOME=/root TERM=$TERM chroot . /bin/bash --login
mkdir /boot/extlinux
extlinux --install /boot/extlinux
  1. Set correct boot flags in the GPT legacy bios and then flash mbrgpt
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
  1. Make an extlinux.conf
cd /boot/extlinux
vim extlinux.conf

Inside extlinux.conf put the following

UI menu.c32


    LINUX /kernel-thatyoucompiled
    INITRD /initramfs-zfs.img

and save it.

That's it, restart your computer and you should be inside Arch on ZFS :)!