Provisioning disks
As a tech preview, Warewulf provides structures to define disks, partitions, and file systems. These structures can generate a configuration for Ignition to provision partitions and file systems dynamically on cluster nodes.
Ignition can, for example, create swap
partitions or /scratch
file
systems.
Note
Warewulf is not currently able to provision the node image onto an explicitly provisioned root file system.
Requirements
Partition and file system creation requires both ignition
and sgdisk
to
be installed in the image.
Rocky Linux
dnf install ignition gdisk
Note
Packages for Ignition are not currently available for Rocky Linux 8, but it is available for Rocky Linux 9 as part of “appstream.”
openSuse Leap
zypper install ignition gptfdisk
Disks and partitions
A node or profile can have several disks. Each disk is identified by the path to
its block device. Each disk holds a map to its partitions and a bool
switch
to indicate if an existing, non-matching partition table should be overwritten.
Each partition is identified by its label. The partition number can be omitted,
but specifying it is recommended as Ignition may fail without it. Partition
sizes should also be set (specified in MiB), except for the last partition: if
no size is given, the maximum available size is used. Each partition has the
switches should_exist
and wipe_partition_entry
which control the
partition creation process. When omitting a partition number the
wipe_partition_entry should be true, as this allows ignition to replace the
existing partition.
wwctl node set n1 \
--diskname /dev/vda --diskwipe \
--partname scratch --partcreate --partnumber 1
File systems
File systems are identified by their underlying block device, preferably using
the /dev/by-partlabel
format. Except for a swap
partition, an absolute
path for the mount point must be specified for each file system. Depending on
the image used, valid formats are btrfs
, ext3
, ext4
, and xfs
.
Each file system has the switch wipe_filesystem
to control whether an
existing file system is wiped.
wwctl node set n1 \
--diskname /dev/vda --partname scratch \
--fsname scratch --fsformat btrfs --fspath /scratch
Boot-time configuration
Ignition uses systemd, as the underlying sgdisk
command relies on dbus
notifications.
ignition-disks-ww4.service
uses Ignition to create the specified partitions and file systems.ww4-disks.target
depends on a matching.mount
unit for each mounted file system.Each
.mount
creates the necessary mount points in the root file system and mounts the provisioned file systems during boot.
These services and mount units are generated by the ignition
overlay and
depend on the existence of the file /warewulf/ignition.json
, also generated
by the ignition
overlay.
Example disk configurations
This command formats a btrfs file system on a “scratch” partion of
“vda” and mounts it at /scratch
.
wwctl node set n1 \
--diskname /dev/vda --diskwipe \
--partname scratch --partcreate --partnumber 1 \
--fsname scratch --fsformat btrfs --fspath /scratch
This command adds a swap partition to the “vda” disk.
wwctl node set n1 \
--diskname /dev/vda \
--partname swap --partsize=1024 --partnumber 2 \
--fsname swap --fsformat swap --fspath swap
Re-using or wiping disks
For empty disks the desired configuration is created and the filesystems are
mounted. If partitions or file systems already exist on the disk, ignition
tries to reuse existing file systems by default.
To ignore existing file systems and provision fresh file systems on each boot,
specify the --fswipe`
flag for that filesystem, and --diskwipe
for the
disk, as necessary.
If you would like to re-use existing partitions but want to replace existing file systems once, you may
wipe the existing data with tools like
wipefs
or dd [1]; orset the
--fswipe
flag and remove it after one reboot.
See the upstream ignition documentation for additional information.