The Arch Linux ZFS wiki page explains grub-compatible pool creation, as does this page about booting Fedora, but I have not been able to create a pool that is readable by Grub. The Arch Linux wiki page about Installing Arch Linux on ZFS highlights certain bugs but doesn't really explain how to overcome them.
The linked pages explain that Grub supports a subset of zpool features and cannot read a pool that uses features that it doesn't support. They go on to explain how to configure a suitable pool but I have been unable to make it work. The supported feature subset does not appear to be documented anywhere.
I am using a virtual machine to test with Grub 2.02 and Arch Linux kernel 4.16.13-1-ARCH which is the most recent and is compatible with the current zfs-linux package version (zfs-linux-0.7.9.4.16.13.1-1). I am not (yet) trying to make a bootable system, only to prove that Grub can read the zpool. Here is what I have tried:
First, like the arch wiki page suggests, by disabling unwanted features:
# zpool create \ -o feature@multi_vdev_crash_dump=disabled \ -o feature@large_dnode=disabled \ -o feature@sha512=disabled \ -o feature@skein=disabled \ -o feature@edonr=disabled \ testpool mirror \ /dev/disk/by-id/ata-VBOX_HARDDISK_VB{5f2d4170-647f16b7,f38966d8-57bff7df} which results in these features:
testpool feature@async_destroy enabled local testpool feature@empty_bpobj active local testpool feature@lz4_compress active local testpool feature@multi_vdev_crash_dump disabled local testpool feature@spacemap_histogram active local testpool feature@enabled_txg active local testpool feature@hole_birth active local testpool feature@extensible_dataset active local testpool feature@embedded_data active local testpool feature@bookmarks enabled local testpool feature@filesystem_limits enabled local testpool feature@large_blocks enabled local testpool feature@large_dnode disabled local testpool feature@sha512 disabled local testpool feature@skein disabled local testpool feature@edonr disabled local testpool feature@userobj_accounting active local Then, like the fedora example, by enabling wanted features:
zpool create -d \ -o feature@async_destroy=enabled \ -o feature@empty_bpobj=enabled \ -o feature@spacemap_histogram=enabled \ -o feature@enabled_txg=enabled \ -o feature@hole_birth=enabled \ -o feature@bookmarks=enabled \ -o feature@embedded_data=enabled \ -o feature@large_blocks=enabled \ testpool mirror \ /dev/disk/by-id/ata-VBOX_HARDDISK_VB{5f2d4170-647f16b7,f38966d8-57bff7df} which results in these features:
# zpool get all testpool | grep feature testpool feature@async_destroy enabled local testpool feature@empty_bpobj active local testpool feature@lz4_compress disabled local testpool feature@multi_vdev_crash_dump disabled local testpool feature@spacemap_histogram active local testpool feature@enabled_txg active local testpool feature@hole_birth active local testpool feature@extensible_dataset enabled local testpool feature@embedded_data active local testpool feature@bookmarks enabled local testpool feature@filesystem_limits disabled local testpool feature@large_blocks enabled local testpool feature@large_dnode disabled local testpool feature@sha512 disabled local testpool feature@skein disabled local testpool feature@edonr disabled local testpool feature@userobj_accounting disabled local In each case, I loaded some content:
# cp -a /boot /testpool And then, rebooted into Grub:
grub> search --set --label testpool grub> ls / @/ grub> ls /@ error: compression algorithm 80 not supported . grub> ls /@/ error: compression algorithm inherit not supported . I tried enabling/disabling some features, most notably lz4_compress. I also tried creating a dataset on the pool. Nothing I tried worked inside Grub.
I expected to be able to list /boot or /@/boot.
Errors encountered include
compression algorithm inherit not supportedcompression algorithm 66 not supportedcompression algorithm 80 not supportedincorrect dnode type
How should a ZFS zpool be created in order for it to be readable by Grub?