Managing fstab Overlays in Warewulf
Introduction
In Warewulf 4.6.x you can mount NFS shares on provisioned nodes either by managing entries in /etc/fstab
via overlays and profiles, or by dropping systemd
mount units via overlays. The systemd-unit
approach is now preferred because it avoids duplicate entries and leverages advanced templating.
Problem
When you define the same NFS mount in multiple profiles the fstab
overlay simply concatenates entries, leading to duplicate or unintended mounts on nodes. For example, if both default
and demo
specify a mount to /mnt
, your rendered /etc/fstab
may contain:
demo-server:/export /mnt nfs defaults 0 0
default-server:/export /mnt nfs defaults 0 0
The fstab
overlay currently provides no built-in method for deduplication.
Resolution
There are two recommended approaches:
Use systemd mount units via overlays
Using systemd
mount units provides greater overall flexibility. Not only can you create an individual overlay per mount and assign it to profiles or nodes, you can also apply Warewulf’s advanced templating and utilize features such as tags to dynamically generate your mounts. You can follow this guide on how to add NFS shares via systemd.
Split fstab mounts into dedicated profiles
If you want to use multiple profiles, follow these steps below:
-
Backup your current configuration.
-
Create separate profiles for each NFS profile:
wwctl profile create nfs-1 wwctl profile create nfs-2
-
Populate
nfs-1
with your mounts:wwctl profile edit nfs-1
nfs-1: resources: fstab: - file: /mnt/folder1 mntops: defaults spec: 10.0.0.15:/share/folder1 vfstype: nfs4 - file: /mnt/folder2 mntops: defaults spec: 10.0.0.15:/share/folder2 vfstype: nfs4
-
Repeat for
nfs-2
or any other profiles. -
Apply the new profiles to your nodes appending them to your current profile:
wwctl node set node01 --profile="default,nfs-1,nfs-2"
-
Verify profiles and rendered fstab:
wwctl node list node01 --all wwctl overlay show --render node01 fstab /etc/fstab
-
Test on a non-production node before rolling out.
Notes
- We do not typically recommend editing the node or profile YAML directly with
wwctl profile edit
, however, there is currently no other method for modifying thefstab
in this regard. - Always back up your Warewulf configuration before editing profiles, especially when editing the YAML directly.
- YAML spacing and indentation is very important and must be exact or Warewulf will reject the changes.
- Test changes on a non-production node to avoid disruption.
References & related articles
Add NFS Share via Warewulf Overlays
Warewulf Overlays
Setting Warewulf Tags