How to create a GRUB boot CD to boot Debian with root on ZFS?

2

1

I installed Debian on ZFS following the following guide: https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Root-on-ZFS

I would like to avoid partitioning my hard disk and give ZFS the whole disk. But I also cannot install a USB key or second drive. Is it possible to create an ISO-image just containing the bare minimum of GRUB files as bootloader?

It would be perfect if I don't have to update the ISO after each kernel update.

I read about GRUB boot CD here: https://www.gnu.org/software/grub/manual/grub/html_node/Making-a-GRUB-bootable-CD_002dROM.html

But here my grub.cfg would point to a specific kernel which I would like to avoid.

It would be awesome if someone could come up with a solution for this.

TylerDurden

Posted 2017-12-10T19:08:03.620

Reputation: 185

Answers

0

To answer my own question:

# create a folder
mkdir -p ~/iso/boot/grub

# lookup the ID of the hard disk
# e. g. gnulinux-simple-b91b8ec8f2733827
vi /boot/grub/grub.cfg

# create a new grub.cfg
vi ~/iso/boot/grub/grub.cfg

with the following content (adapt to your config):

set timeout=0
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-b91b8ec8f2733827' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod zfs
        set root='hd0,gpt1'
        configfile /ROOT/debian@/boot/grub/grub.cfg
}

then:

# create ISO
grub-mkrescue -o grub.iso ~/iso

You can now use this ISO to boot.

TylerDurden

Posted 2017-12-10T19:08:03.620

Reputation: 185