4

I'm trying to write a grub.cfg completely from scratch that will boot one of several FreeBSD systems off of a single ZFS pool named tank with a set of root file systems named root1, root2, root3.

When I look at the official GRUB2 docs, there is one example in 5.3

menuentry "FreeBSD" {
          insmod zfs
          search --set=root --label freepool --hint hd0,msdos7
          kfreebsd /freebsd@/boot/kernel/kernel
          kfreebsd_module_elf /freebsd@/boot/kernel/opensolaris.ko
          kfreebsd_module_elf /freebsd@/boot/kernel/zfs.ko
          kfreebsd_module /freebsd@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
          set kFreeBSD.vfs.root.mountfrom=zfs:freepool/freebsd
          set kFreeBSD.hw.psm.synaptics_support=1
}

I figured that freepool is likely the ZFS pool name which I would replace with tank. I suspect that the x@y syntax is the way to refer to a file y on the file system x of the pool selected by the search. Then I would replace this with /root1@/boot/kernel/kernel. Sadly, the x@y syntax is undocumented and I don't want to just try with fingers crossed, but rather understand and know what I'm doing. Can anyone shed light on this?

  • Maybe for comparison the menu entry in these last forum posts... the "@" is "alone" there... – user44370 Feb 17 '14 at 19:54
1

You are right, anything before @ is the ZFS dataset name (aka filesystem name) with a / prefix. For example the file /boot/kernel/kernel in file system zroot/ROOT/freebsd-10 can be refered with /zroot/ROOT/freebsd-10@/boot/kernel/kernel in GRUB.

You can also learn this by using the GRUB command line (pressing c if you are in the GRUB menu). ZFS support in GRUB 2 supports directory listing, so you can use ls command or TAB to explore this internal structure of ZFS in GRUB 2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.