grub-mknetdir
Create network bootable GRUB directory
SYNOPSIS
grub-mknetdir [OPTION...] --net-directory=DIR
PARAMETERS
--net-directory=DIR
target directory to create netboot files (required)
--directory=DIR
source GRUB directory (default: /boot/grub)
--subdir=SUBDIR
subdir within source directory (default: .)
-?, --help
display help and exit
--version
print version information
DESCRIPTION
grub-mknetdir is a GRUB2 utility that generates a complete directory structure for network booting GRUB. It populates the specified output directory with essential files like core images (core.img), modules, fonts, themes, and configuration files needed for PXE, TFTP, HTTP, or iPXE booting.
This tool simplifies deploying GRUB in network environments, such as servers, clusters, or thin clients. It copies assets from the local GRUB installation (typically /boot/grub), resolves dependencies, and organizes them hierarchically (e.g., 1.5/x86_64-efi/ for EFI platforms). The result is a self-contained netboot root that can be served directly by a TFTP server.
Key use cases include automating diskless boot setups or centralizing bootloader distribution. It supports multiple architectures and ensures platform-specific modules (e.g., efi_gop.mod) are correctly placed. Run as root for proper access to source directories.
CAVEATS
Requires root privileges for source dirs; ensure TFTP/HTTP server exports the full directory tree. Not all modules included by default—add via grub-mkimage. Fails if source GRUB lacks netboot modules.
EXAMPLE
grub-mknetdir --net-directory=/var/lib/tftpboot
Generates netboot tree in TFTP root.
OUTPUT STRUCTURE
Typical layout: DIR/boot/grub/{core.img, fonts/, grub.cfg, i386-pc/, x86_64-efi/, ...}
HISTORY
Introduced in GRUB2 (circa 2009, v1.98+), enhanced in GRUB 2.02+ for better EFI/PXE support. Developed for scalable netboot deployments in Linux distributions like Ubuntu/Debian.
SEE ALSO
grub-mkimage(1), grub-mkconfig(8), grub-install(8), update-grub(8)


