How to pxe boot intoo a zfs shared folder (nfs) that is hosted via proxmox?

i want to boot intoo a zfs-pool via pxe.
So far i created a container that uses a zfs pool for the iso and one as diskstorage.
i installed rocky linux into the diskstorage-directory via vm.

  • i created a nfs that serves that folder.
    but in order to boot from the vm image i would need qemu right?
  • maybe its just easier to install the os directly intoo the zfs share without container, but its so cool that you can boot phsyical server while you working in the shared vm.

anyway, this is the provisioning template that phind came up with:

kind: PXELinux
name: Custom PXELinux for NFS-ZFSBoot
model: ProvisioningTemplate
oses:
- AlmaLinux
- CentOS
- CentOS_Stream
- Fedora
- RedHat
- Rocky
description: |
  Custom PXELinux configuration for booting from NFS over ZFS.
test_on:
- host4dhcp
- host6dhcp
- host4and6dhcp
- host4static
- host6static
- hostZFSBoot # Add hosts that should boot ZFS
-%>
# This file was deployed via '<%= template_name %>' template
<%
  rhel_compatible = @host.operatingsystem.family == 'Redhat' && @host.operatingsystem.name!= 'Fedora'
  os_major = @host.operatingsystem.major.to_i
  os_minor = @host.operatingsystem.minor.to_i
  timeout = host_param('loader_timeout').to_i * 10
  timeout = 100 if timeout.nil? || timeout <= 0
-%>
DEFAULT menu
MENU TITLE Booting into OS installer (ESC to stop)
TIMEOUT <%= timeout %>
ONTIMEOUT installer

LABEL installer
MENU LABEL <%= template_name %>
KERNEL <%= @kernel %> zfs=force # Enable ZFS boot
APPEND initrd=<%= @initrd %> root=nfs:<%= @nfs_server %>:<%= @nfs_path %>:/mnt/zfsroot rw # Set NFS mount path as ZFS root
IPAPPEND 2

<%= snippet_if_exists(template_name + " custom menu") %>

using zfs without qemu

so in theory i just need the default pxe template, add the nfs and zfs stuff in there, use the os that i choose in foreman and install directly to the zfs pool?
im still a little bit worried about the nfs, but the underlying fs is a block-fs, so with the right setting it should work.

but why no just provision a vm using foreman and boot the server intoo the pool using qemu?

  • this way i could pass some parameters that define nfs mountpoint, so i just need one provisioning template, besides that i can debug, fix and test the vms in proxmox and then deploy them by using a simple snapshot…

idk …
will that work? is it even feasabile?

hmm i forgot that this would also require to overwrite the network settings every boot:

Just for the records: I do PXE boot qemu on my laptop to test FOG stuff all the time. No trouble!

$ sudo tunctl -t tap0 -u <username>
$ sudo ifconfig tap0 x.x.x.x netmask 255.255.255.0 up
$ qemu-img create -f qcow2 hdd.qcow2 10G
$ qemu -m 512 -boot n -net nic,vlan=1 -net tap,vlan=1,ifname=tap0,script=/bin/true -hda hdd.qcow2

This is not a briged setup but all running on a virtual LAN only on that computer. So you’d have to configure tftp and dhcpd to properly serve on NIC tap0 and IP x.x.x.x