As was reported earlier, GRUB2 doesn't support all recent feature flags in zpool. But there's no need to use earlier ZFS tools and create obsolete versions of zpools. We only need to create zpool with features disabled, as in
Alternatively, async_destroy, empty_bpobj and lz4_compress feature flags are recognized by recent git GRUB2 versions and can be enabled at the time of the creation as in
Once the pool created and filesystems imported/created/populated/mounted, GRUB2 can be installed. For example, suppose rpool/ROOT/freebsd is mounted at /rpool/ROOT/freebsd -- as it will be at the time of the creation of the datasets, unless other mountpoints are set. Then grub installation will be as follows:
At this stage it must return "no errors reported" message.
The advantage of this approach is, that if one wants to have Linux installed, it can be installed in a separate dataset, say rpool/ROOT/linux. But if zpool was created on a GPT freebsd-zfs partition, it will be linked to /dev/gptid/XXXX and linux boot scripts will have problems importing such pool.
With whole disk root pool this problem doesn't exist and everything works smooth. Only I cannot say how it works with EFI.
zpool create -d $poolname $device. Where $device is raw unpartitioned device, as in /dev/ada0 or whatever. No boot partitions, no MBR, no GPT labels -- nothing at all.Alternatively, async_destroy, empty_bpobj and lz4_compress feature flags are recognized by recent git GRUB2 versions and can be enabled at the time of the creation as in
zpool create -d -o feature@myfeature ... $poolname $device . LZ4 compression is particularly useful...Once the pool created and filesystems imported/created/populated/mounted, GRUB2 can be installed. For example, suppose rpool/ROOT/freebsd is mounted at /rpool/ROOT/freebsd -- as it will be at the time of the creation of the datasets, unless other mountpoints are set. Then grub installation will be as follows:
Code:
grub-install --modules=zfs --boot-directory=/rpool/ROOT/freebsd/boot /dev/ada0
The advantage of this approach is, that if one wants to have Linux installed, it can be installed in a separate dataset, say rpool/ROOT/linux. But if zpool was created on a GPT freebsd-zfs partition, it will be linked to /dev/gptid/XXXX and linux boot scripts will have problems importing such pool.
zpool import -d /dev/by-partuuid will have to be added manually to initrd creating scripts, which is additional pain.With whole disk root pool this problem doesn't exist and everything works smooth. Only I cannot say how it works with EFI.