Skip to content

PXE ZFS

Status: proposed design, not an execution receipt. This guide sketches a physically separated PXE capture/restore station using FreeBSD VNET jails, Clonezilla, iPXE and ZFS. Hardware boot, DHCP isolation, source-disk write protection, capture and restore have not been verified by the Agent Vault pilot.

The commands are incomplete examples. Before execution, supply and review jail creation, interface addresses, image repository mounts (including Clonezilla /home/partimag), matching image names, snapshot-menu generation and the policy for further captures after making a dataset read-only. Do not treat this page as a verified unattended imaging runbook.

Mesh Network Data Safety Architecture
Architectural Roles in the Laboratory:

Monica (Valhala / ZFS): Storage hygiene and filesystem immutability custodian (strict ZFS datasets, quotas, and read-only snapshots).


Joey (HP OmniBook): Single-cable field client (connects to capture or restore, separate capture and restore intentions).


Phoebe (Jev): Pre-flight semantic policy verification โ€ข Chandler (Debby): Systems operator console โ€ข Ross (Oxigraph): Data provenance archivist.


Two-Door Physical Architecture (or Three Doors with Host Management)

Section titled โ€œTwo-Door Physical Architecture (or Three Doors with Host Management)โ€

From the perspective of the field laptop, this is a two-door architecture (two dedicated physical NICs):

  • Capture Port (bge1): strictly saves fresh disk images (read-only NVMe source).
  • Restore Port (bge2): presents an interactive ZFS snapshot boot menu prior to touching the disk.

If we include the primary management port (bge0 at 192.168.1.x / monica.lan), which handles host administration with zero contact with PXE or DHCP broadcasts, the full topology represents a three-door architecture.

To limit the risk of disk overwrites and DHCP leakage, the proposed design physically separates Capture and Restore onto dedicated physical network interfaces:

MONICA / VALHALA (proposed topology; example pool: zroot)
[Management Port bge0: 192.168.1.x / monica.lan]
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Dataset: zroot/backups/omnibook-joey โ”‚
โ”‚ Quota: 350G | compression: zstd โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โ”‚
[bge1: CAPTURE PORT] [bge2: RESTORE PORT]
Jail: pxe-capture (192.168.101.0/24) Jail: pxe-restore (192.168.102.0/24)
โ€ข Dedicated physical pass-through โ€ข Dedicated physical pass-through
โ€ข Purpose: UNATTENDED IMAGE CAPTURE โ€ข Purpose: INTERACTIVE SNAPSHOT RESTORE
โ€ข Action: ocs-sr savedisk (source protection unverified) โ€ข Action: iPXE snapshot menu -> restoredisk
โ€ข Triggers auto-shutdown when complete โ€ข Requires explicit on-screen selection
โ–ฒ โ–ฒ
โ”‚ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Direct Cat6 Cable from Joey's Laptop (Auto-MDIX) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • bge0: The production host management network (Monica: 192.168.1.x / monica.lan). Never runs DHCP or PXE services.
  • bge1 (Port 1 - Capture): Intended for the savedisk workflow. Source-disk write protection must be independently verified; the selected port alone does not enforce it.
  • bge2 (Port 2 - Restore): Dedicated strictly to deploying selected ZFS restore points. It presents an on-screen menu of available snapshots before touching the disk.

Examples use zroot as the pool name, following the FreeBSD Handbook convention. Substitute your actual pool name and mountpoints when applying them.

On the FreeBSD host, create a dedicated backup dataset with safety quotas and streaming record sizes:

Terminal window
# Create dedicated backup dataset with 1MB recordsize and 350GB safety quota
doas zfs create -o mountpoint=/zroot/backups/omnibook-joey \
-o compression=zstd \
-o recordsize=1M \
-o atime=off \
-o quota=350G \
zroot/backups/omnibook-joey

Pass bge1 directly into the VNET jail:

# In jail configuration:
vnet;
vnet.interface = "bge1";

When the jail starts, bge1 completely leaves the host network stack and belongs exclusively to the jail.

In /usr/local/etc/dnsmasq.conf:

interface=bge1
bind-interfaces
except-interface=lo0
dhcp-range=192.168.101.50,192.168.101.100,255.255.255.0,1h
dhcp-option=3,192.168.101.1
enable-tftp
tftp-root=/tftpboot
# UEFI Client Architecture Detection
dhcp-match=set:efi-x86_64,option:client-arch,7
dhcp-match=set:efi-x86_64,option:client-arch,9
dhcp-userclass=set:ipxe,iPXE
dhcp-boot=tag:ipxe,http://192.168.101.1/boot.ipxe
dhcp-boot=tag:efi-x86_64,snponly.efi
#!ipxe
set server_ip 192.168.101.1
set base_url http://${server_ip}/clonezilla
echo ==========================================================
echo Starting Unattended Factory Image Capture to Valhala
echo ==========================================================
kernel ${base_url}/vmlinuz boot=live config noswap nomodeset noprompt nosplash \
ocs_live_run="ocs-sr -q2 -j2 -z9p -i 4096 -sfs -senc -batch -p poweroff savedisk 1-factory-unopened nvme0n1" \
fetch=${base_url}/filesystem.squashfs
initrd ${base_url}/initrd.img
boot

Phase 3: Interactive ZFS Restore Menu (pxe-restore on bge2)

Section titled โ€œPhase 3: Interactive ZFS Restore Menu (pxe-restore on bge2)โ€

The design calls for a restore jail on bge2 that enumerates approved ZFS snapshots. The example below is a static menu; the snapshot query, repository mount and menu generator are not implemented here:

#!ipxe
set server_ip 192.168.102.1
set base_url http://${server_ip}/clonezilla
menu Valhala ZFS Restore Points (Select Target Snapshot)
item 1-factory-unopened [1] Factory Clean (Out of the Box)
item 2-windows-activated [2] Windows 11 Activated + Drivers
item cancel [3] Cancel and Reboot
choose target && goto ${target}
:1-factory-unopened
echo Restoring Factory Clean Image...
kernel ${base_url}/vmlinuz boot=live config noswap nomodeset noprompt nosplash \
ocs_live_run="ocs-sr -g auto -e1 auto -e2 -r -j2 -k0 -batch -p poweroff restoredisk 1-factory-unopened nvme0n1" \
fetch=${base_url}/filesystem.squashfs
initrd ${base_url}/initrd.img
boot
:2-windows-activated
echo Restoring Windows 11 Activated Image...
kernel ${base_url}/vmlinuz boot=live config noswap nomodeset noprompt nosplash \
ocs_live_run="ocs-sr -g auto -e1 auto -e2 -r -j2 -k0 -batch -p poweroff restoredisk 2-windows-activated nvme0n1" \
fetch=${base_url}/filesystem.squashfs
initrd ${base_url}/initrd.img
boot
:cancel
reboot

When an image capture completes on bge1:

Terminal window
# 1. Take an instant ZFS snapshot
doas zfs snapshot zroot/backups/omnibook-joey@1-factory-unopened
# 2. Mark the dataset read-only to prevent tampering or accidental writes
doas zfs set readonly=on zroot/backups/omnibook-joey

With this example dataset mounted at the shown path, the snapshot can be accessed read-only via:

/zroot/backups/omnibook-joey/.zfs/snapshot/1-factory-unopened/

  1. Plug the Realtek RTL8153 USB-C Gigabit Ethernet adapter into the laptop.
  2. Connect a Cat6 patch cable from the adapter directly into:
    • bge1 for Saving an Image (unattended, shuts down when finished).
    • bge2 for Restoring an Image (displays the ZFS snapshot menu).
  3. Power on the laptop, press F9, and select UEFI Network Boot (IPv4).