Additional overlays to support provision-to-disk without ignition
- sfdisk - partitions the disk - mkfs - formats partitions - mkswap - formats partitions for swap - systemd.mount - explicit creation of systemd mount units - systemd.swap - explicit creation of systemd swap units Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -4,7 +4,8 @@ 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.
|
||||
provision partitions and file systems dynamically on cluster nodes, or with
|
||||
sfdisk, mkfs, and mkswap during boot.
|
||||
|
||||
.. _Ignition: https://coreos.github.io/ignition/
|
||||
|
||||
|
||||
@@ -371,6 +371,105 @@ specified with a ``localtime`` tag.
|
||||
|
||||
wwctl profile set default --tagadd="localtime=UTC"
|
||||
|
||||
sfdisk
|
||||
------
|
||||
|
||||
The **sfdisk** overlay partitions block devices during wwinit. Configuration may
|
||||
be provided using native disk and partition configuration or via an ``sfdisk``
|
||||
resource.
|
||||
|
||||
Multiple devices can be partitioned, with each device provided as an item in
|
||||
``sfdisk`` list.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
sfdisk:
|
||||
- device: /dev/sda
|
||||
label: gpt
|
||||
partitions:
|
||||
- device: /dev/sda1
|
||||
name: sfdisk-rootfs
|
||||
size: 4194304
|
||||
- device: /dev/sda2
|
||||
name: sfdisk-scratch
|
||||
size: 1048576
|
||||
- device: /dev/sda3
|
||||
name: sfdisk-swap
|
||||
size: 2097152
|
||||
|
||||
All headers and named partition fields supported by the ``sfdisk`` input format
|
||||
are supported in the ``sfdisk`` resource.
|
||||
|
||||
If any disk/partition configuration is provided for a node with explicit
|
||||
arguments to ``wwctl <node|profile> set``, the ``sfdisk`` resource is ignored.
|
||||
|
||||
To use the sfdisk overlay, include sfdisk in the Dracut image. Optionally also
|
||||
include blockdev and/or udevadm, to allow the partition table to be re-scanned.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
wwctl image exec rockylinux-8 -- /usr/bin/dracut --force --no-hostonly --add wwinit --install sfdisk --install blockdev --install udevadm --regenerate-all
|
||||
|
||||
For more information, see the :ref:`provision to disk` section.
|
||||
|
||||
mkfs
|
||||
----
|
||||
|
||||
The **mkfs** overlay formats block devices during wwinit. Configuration may be
|
||||
provided using native filesystem fields or via an ``mkfs`` resource.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
mkfs:
|
||||
- device: /dev/sda1 # the device to format
|
||||
type: xfs # what type of file system to create
|
||||
options: -b 1024 # additional options to pass to mkfs
|
||||
overwrite: false # whether to overwrite an existing format
|
||||
size: 0 # defaults to the full device
|
||||
|
||||
If any filesystem configuration is provided for a node with explicit arguments
|
||||
to ``wwctl <node|profile> set``, the ``mkfs`` resource is ignored.
|
||||
|
||||
To use the mkfs overlay, include mkfs and any necessary file-system-specific
|
||||
sub-commands in the Dracut image. Optionally also include wipefs to detect
|
||||
existing file systems.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
wwctl image exec rockylinux-9 -- /usr/bin/dracut --force --no-hostonly --add wwinit --install mkfs --install mkfs.ext4 --install wipefs --regenerate-all
|
||||
|
||||
For more information, see the :ref:`provision to disk` section.
|
||||
|
||||
mkswap
|
||||
------
|
||||
|
||||
The **mkswap** overlay formats block devices during wwinit. Configuration may be
|
||||
provided using native filesystem fields or via a ``mkswap`` resource.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
mkswap:
|
||||
- device: /dev/sda2 # the device to format
|
||||
overwrite: false # whether to overwrite an existing format
|
||||
label: swap # the label to set for the swap device
|
||||
|
||||
If any filesystem configuration is provided for a node with explicit arguments
|
||||
to ``wwctl <node|profile> set``, the ``mkswap`` resource is ignored.
|
||||
|
||||
To use the mkswap overlay, include mkswap in the Dracut image. Optionally also
|
||||
include wipefs to detect existing file systems.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
wwctl image exec rockylinux-9 -- /usr/bin/dracut --force --no-hostonly --add wwinit --install mkswap --regenerate-all
|
||||
|
||||
systemd mounts
|
||||
--------------
|
||||
|
||||
Two overlays, **systemd.mount** and **systemd.swap**, configure mounted and swap
|
||||
storage based on the configuration of native file system fields. They are often
|
||||
paired with the ``mkfs`` and ``mkswap`` overlays.
|
||||
|
||||
host
|
||||
----
|
||||
|
||||
|
||||
@@ -95,6 +95,16 @@ referenced symlink.
|
||||
|
||||
{{ ImportLink "/etc/localtime" }}
|
||||
|
||||
When paired with ``file``, ``ImportLink`` can create multiple symlinks from a
|
||||
single template.
|
||||
|
||||
.. code-block::
|
||||
|
||||
{{ file "/tmp/test-link1"}}
|
||||
{{ softlink "/tmp/test-target1" }}
|
||||
{{ file "/tmp/test-link2"}}
|
||||
{{ softlink "/tmp/test-target2" }}
|
||||
|
||||
basename
|
||||
--------
|
||||
|
||||
@@ -133,6 +143,9 @@ Causes the processed template file to become a symlink to the referenced target.
|
||||
|
||||
{{ printf "%s/%s" "/usr/share/zoneinfo" .Tags.localtime | softlink }}
|
||||
|
||||
When paired with ``file``, ``softlink`` can create multiple symlinks from a
|
||||
single template.
|
||||
|
||||
.. _readlink:
|
||||
|
||||
readlink
|
||||
|
||||
@@ -454,6 +454,52 @@ Ignition must be included in the Dracut image.
|
||||
|
||||
The necessary file system may alternatively be prepared out-of-band.
|
||||
|
||||
With sfdisk and mkfs
|
||||
--------------------
|
||||
|
||||
Systems that do not have access to Ignition (e.g., Rocky Linux 8) can provision
|
||||
the root file system using a combination of ``sfdisk`` and ``mkfs``. To use
|
||||
them, include ``sfdisk`` and ``mkfs`` in your system overlay. The ``sfdisk`` and
|
||||
``mkfs`` overlays provision disk and file systems during the first stage of a
|
||||
two-stage boot. This allows the root file system to be provisioned before the
|
||||
image is loaded.
|
||||
|
||||
Configure the ``sfdisk`` and ``mkfs`` overlays using resources:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
wwctl node set wwnode1 \
|
||||
--diskname /dev/vda --diskwipe \
|
||||
--partname rootfs --partcreate --partnumber 1 \
|
||||
--fsname rootfs --fsformat ext4 --fspath /
|
||||
|
||||
In order to allow Dracut to provision the disk, partition, and file system, some
|
||||
additional commands must be included in the Dracut image, depending on which
|
||||
functionality is used:
|
||||
|
||||
- **sfdisk:** writes the partition table
|
||||
|
||||
- **blockdev:** used to re-read the partition table after writing
|
||||
|
||||
- **udevadm:** used to trigger udev events after writing the partition table
|
||||
|
||||
- **mkfs:** formats file systems (may also require file-system-specific commands like mkfs.ext4)
|
||||
|
||||
- **mkfs.ext4**, **mkfs.btrfs**, etc: used by mkfs to format specific file systems
|
||||
|
||||
- **wipefs:** used to determine if a file system already exists
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
wwctl image exec rockylinux-8 -- /usr/bin/dracut --force --no-hostonly \
|
||||
--add wwinit \
|
||||
--install sfdisk \
|
||||
--install blockdev \
|
||||
--install udevadm \
|
||||
--install mkfs \
|
||||
--install mkfs.ext4 \
|
||||
--install wipefs \
|
||||
--regenerate-all
|
||||
|
||||
Configuring the root device
|
||||
---------------------------
|
||||
|
||||
Reference in New Issue
Block a user