I’m in fast writing mode as this is probably won’t intended to be understood by most people. I’m writing in this blog as I moving forward installing. To keep writing  and translating from my tacit into Bahasa Indonesia is kind of laboring. Perhaps, if you want, I would reiterate what I do here with better Bahasa Indonesia. But, now, let’s live speed writing.


I’ve got Ubuntu 14.04 Live USB on my arsenal. Boot it up and setup some trivial like IP, DNS and stuff. I modify APT sources.list to match my nearest server.

deb http://kambing.ui.ac.id/ubuntu/ trusty main restricted
deb http://kambing.ui.ac.id/ubuntu/ trusty-security main restricted
deb http://kambing.ui.ac.id/ubuntu/ trusty-updates main restricted

Do the update and install SSH and VIM.

sudo -i
apt-get update
apt-get install ssh vim
passwd ubuntu

I need SSH because I can’t stand on server room too long. I’m not going to go on religious war on ViM vs Emacs. Last, change ubuntu user password.

And now the show live from my comfy SSH terminal laptop.

Install Ubuntu ZFS for Ubuntu Live Session

Straight from the doc.

sudo -i
apt-add-repository --yes ppa:zfs-native/stable
apt-get update
apt-get install debootstrap spl-dkms zfs-dkms ubuntu-zfs
modprobe zfs

You may wondering why I’m not upgrading first. Upgrading a temporary system is wasting time, especially one with GUI installed. Okay, now we get to the formatting.

Create A ZFS Pool

I have 2 SATA and 1 SSD. The best for server should be two SSDs. But, hey, beggar can’t choose.

ZFS config: 2 Disks + 1 SSD.

ZFS config: 2 Disks + 1 SSD.

Using GParted, I turned SSD into GPT with 3 partitions:

  • The first 200MB for /boot partition. Some twisted soul refused to use separated partition for /boot, well, good for you! I go with the conservative.
  • 8GB used for ZIL (ZFS Intent Log) drive. ZFS usually use 8GB max for journaling.
  • The rest used for ZFS Cache (ZARC).

But, hey, where is the EFI partition?

I’ve just recently found out that when you give your whole disk to ZFS, it would format the disk into two partitions. One big partition (sX1) for the use of ZFS and one 8MB partition (sdX9) for EFI partition (FAT). Yeah, ZFS automatically turn the disk into GPT partitioning scheme. After adding the two disks into a ZFS pool, the partitions will be like this:

sda: sda1 sda9, sdb: sdb1 sdb9

I’m doing mirroring for sda and sdb. I wish I have one more SSD. I would mirror two partitions on separated SSDs for ZIL. If you are luckier than me, do it! It is for safety measure. But, don’t mirror the cache because it’s wasting space.

Here’s the reality:

zpool  create -f -o ashift=12 -o altroot=/mnt -m none rpool mirror sda sdb log sdc2 cache sdc3

If I may have a dream with two SSDs:

zpool create -f -o ashift=12 -o altroot=/mnt -m none rpool mirror sda sdb log mirror sdc2 sdd2 cache sdc3 sdd3

Disable access time, enable relative time and enable LZ4 compression on tanks.

zfs set atime=off rpool
zfs set relatime=on rpool
zfs set compression=lz4 rpool

If nothing is wrong, we would got:

# zpool status rpool
  pool: rpool
 state: ONLINE
  scan: none requested

    rpool       ONLINE       0     0     0
      mirror-0  ONLINE       0     0     0
        sda     ONLINE       0     0     0
        sdb     ONLINE       0     0     0
      sdc2      ONLINE       0     0     0
      sdc3      ONLINE       0     0     0

errors: No known data errors

Next, the partitioning. After this, I’m doing things from Crossroad’s tutorial with some tweaks.

Create Partition

As Debian configuration:

zfs create -o mountpoint=none rpool/ROOT
zfs create -o mountpoint=/ rpool/ROOT/debian-1
zpool set bootfs=rpool/ROOT/debian-1 rpool

What? Yes, I’m installing Debian not Ubuntu.

Last, export the pool we’ve created for later import. We do this so that the ZFS config would read from disk by ID instead of common UDEV naming. Believe me, you don’t want to use UDEV naming (sda, sdb, etc.) on ZFS.

zpool export rpool

Now, we can start installing Debian system.

Install Debian

Reimport ZFS pool and create a ZFS configuration cache file.

zpool import -d /dev/disk/by-id -R /mnt rpool
mkdir -p /mnt/etc/zfs
zpool set cachefile=/mnt/etc/zfs/zpool.cache rpool

REMEMBER: (Straight from the ZFS FAQ)

Run update-initramfs -c -k all after any /sbin/zpool command changes the /etc/zfs/zpool.cache file.

This is the reason of random failures from mounting ZFS root partition.

Install the system and mount all the basic system partitions.

debootstrap --arch=amd64 jessie /mnt http://kambing.ui.ac.id/debian/

And now, configure.

Configure Debian


echo gantenghost > /mnt/etc/hostname
sed -i -Ee "s#(127.+)#\1 gantenghost#" /mnt/etc/hosts

Create configuration for network interfaces. In the spirit of new configuration scheme, I put two files in /etc/network/interfaces.d/

# cat > /mnt/etc/network/interfaces.d/eth0 << .
auto eth0
iface eth0 inet dhcp


# cat > /mnt/etc/network/interfaces.d/lo << .
auto lo
iface lo inet loopback

Mount all the system filesystems.

for f in dev dev/pts proc sys; do mount -v --bind {,/mnt}/$f; done

Chroot there

chroot /mnt /bin/bash

In Debian Configuration


apt-get install locales
sed -i -Ee 's/# (en_US.UTF+)/\1/' /etc/locale.gen


dpkg-reconfigure tzdata
apt-get install ntp
/etc/init.d/ntp stop

Remember when I said I’m going to put /boot on different partition? Now is the time.

echo "/dev/sdc1 /boot ext4 rw,relatime,stripe=4,data=ordered 0 0" >> /etc/fstab
mount /boot

Remember also what I said about using the ninth partition of the first disk? Now is the time.

apt-get install dosfstools
mkdir /boot/efi
mkfs.vfat /dev/sda9
echo "/dev/sda9 /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0" >> /etc/fstab

Install ZFS packages with Debian style. ZFS needs lsb-release package.

cd /tmp
wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_6_all.deb
apt-get install lsb-release
dpkg -i zfsonlinux_6_all.deb
apt-get update && apt-get install linux-image-amd64 debian-zfs
apt-get install grub2-common grub-efi zfs-initramfs

Last, add a login.

apt-get install sudo vim ssh
adduser user
adduser user sudo

Setup GRUB For ZFS Boot

There is a bug in Debian’s GRUB that makes the system unbootable. First, let’s reconfigure GRUB Default command line:

sudo dpkg-reconfigure grub-efi-amd64

Change Linux default command line (second screen after Linux command line) from



root=ZFS=rpool/ROOT/debian-1 rpool=rpool bootfs=rpool/ROOT/debian-1 quiet

After this, update grub and we are done.

sudo update-grub

Booting to New System

After all preparations, unmount all the filesystems

umount /boot/efi/ /boot
for f in dev/pts dev proc sys; do umount /mnt/$f; done
zfs umount -a
zfs export rpool


Final Thought

Well, you might find some faults here and there. If not, everything after this is straightforward.

Bacaan Lebih Lanjut