What kldload actually does, step by step.
No magic. No proprietary automation platform. Just a sequence of well-understood steps, executed in the right order. Here's the recipe for turning a blank disk into a running ZFS system. This is exactly what the kldload installer does. You could do it by hand. kldload just automated it.
Step 1: Partition the disk
Two partitions. First: a 512MB EFI System Partition (FAT32) for the bootloader. Second: everything else, formatted as a ZFS pool. That's it. No swap partition (ZFS can handle swap as a zvol if needed). No /boot partition (ZFSBootMenu reads kernels directly from ZFS).
resize2fs again.Step 2: Create the ZFS pool and datasets
Create rpool with LZ4 compression, 4K sector alignment, and POSIX ACLs.
Then create the dataset hierarchy: rpool/ROOT/default (your root filesystem),
rpool/home, rpool/var, rpool/var/log.
Each dataset can have independent snapshot and quota policies.
/var/log as a dataset means a runaway log can't fill your root filesystem. /home as a dataset means you can snapshot user data independently of the OS. /tmp as a dataset gets sync=disabled and exec=off — performance and security tuning that's impossible with a directory. Every dataset is a boundary: independent compression, independent snapshots, independent quotas, independent encryption. Directories can't do any of that.Step 3: Install the base OS
For Debian: debootstrap lays down a minimal root filesystem.
For CentOS: dnf --installroot does the same.
Then install the kernel, ZFS packages, and essential tools.
Build the ZFS kernel module via DKMS so it matches your exact kernel version.
apt install zfs-dkms, which downloads source, compiles against your kernel headers, and hopes nothing goes wrong. kldload does this at image build time — the module is compiled, signed with a MOK key, and embedded in the image before it touches a target machine. The kernel and the module are a matched pair. No compiler on the target. No DKMS in the boot path. No "it compiled fine on my machine but broke on yours." For FreeBSD, there's no DKMS at all — ZFS is in the kernel natively. kldload downloads base.txz and kernel.txz, extracts them onto the pool, and loader.efi handles the rest.Step 4: Build the initramfs
The initramfs needs the ZFS module baked in so the kernel can mount the ZFS root filesystem
at boot. On Debian, zfs-initramfs handles this. On CentOS/RHEL, zfs-dracut.
The initramfs also gets the machine's hostid so ZFS can identify its pools.
Step 5: Install the bootloader
Copy the ZFSBootMenu EFI binary to the EFI System Partition. Register it with the firmware
via efibootmgr. Install a backup copy at the UEFI fallback path so it boots
even if the firmware forgets the boot entry. Write /etc/fstab for just the EFI partition —
ZFS datasets are mounted by zfs-mount.service, not fstab.
Step 6: Export and reboot
Cleanly export the ZFS pool so it can be imported fresh on first boot.
Write the zpool.cache so the pool imports quickly.
Enable ZFS systemd services. Power off. Remove the USB. Boot from disk.
You now have a ZFS-on-root Linux system with boot environments, automatic snapshots, transparent compression, and a filesystem that will never silently corrupt your data.
What you actually have after Step 6:
It's not just "a Linux install with ZFS." It's a machine where:
- Every file is checksummed — silent corruption is detected and repaired automatically on mirrors
- Every write is compressed — you're using 30-50% less disk than the same data on ext4
- The entire OS is a dataset — snapshot it, clone it, roll it back, replicate it to another machine
- Boot environments let you undo a kernel upgrade by picking the old snapshot from a menu
zfs sendreplicates the whole system — OS, data, config — to a DR node in one command- WireGuard is ready — the module is loaded, create a tunnel whenever you need one
- The factory snapshot is your known-good baseline — you can always get back to this moment
A traditional installer gives you an OS. This gives you an OS with superpowers baked in from birth. The difference isn't what you install. It's what's available the moment you boot.
k_install_zfs_storage(), k_bootstrap_base(),
k_install_bootloader() — readable bash functions with comments.
Fork the repo. Read them. Modify them. That's the point.