Ubuntu – ZFS root filesystem

bootgrub2zfs

I've been trying to install ubuntu with a zfs as root filesystem. But it seems that GRUB 2.xx which has ZFS support doesen't support compression, so i disabled it. However i keep running in to the same problem.

Installing ubuntu is pretty easy, but booting it seems to be a pain in the neck.

After booting the 15.04 live CD i issued the following in the terminal:

Get the zfs support packages installed

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

Create the zfs pools/datasets

# zpool create -o ashift=12 -m none -R /mnt ospool mirror sdb sdc
# zpool create -o ashift=12 -m none -R /mnt storage raidz1 sdd sde sdf sdg sdh

# zfs create -o mountpoint=/ ospool/root
# zfs create -o mountpoint=/boot ospool/boot
# zfs create -V 8G -b 4k ospool/swap
# zfs create -o mountpoint=/var storage/var
# zfs create -o mountpoint=/home storage/home

Bootstrap the base system, and chrooting in

# debootstrap vivid /mnt
# chroot /mnt /bin/bash --login

I have a boot device (SDA) which has an ext2 and a bios boot partition on Mounted on /mnt/boot/grub

At this point i installed the same zfs packages which works just fine.
But GRUB fails to install complaining about not being able to find the device og canonical path, so grub2-common and grup-pc never finishes.

So my question is how, do i get grub installed with zfs support?

if i manually install grub with grub-install and reboot into the grub shell, i can see that zfs is supported. But can't reference the kernel with the linux path/to/kernel command.

Best Answer

I suggest you try with Ubuntu 16.04. I followed this tutorial and it worked:

https://github.com/zfsonlinux/zfs/wiki/Ubuntu-16.04-Root-on-ZFS

Didn't have to disable any ZFS feature, like compression. In fact, it was enabled (lz4), and I even used raidz1 with 3 disks as /.

One caveat is that I had to export this shell var for grub to recognize the disk/by-id devices:

export ZPOOL_VDEV_NAME_PATH=YES

This is because of bug #11527727, which is about to be fixed, so you may not need that anymore in the near future.

Related Question