xfs_scrub tool, which is part of the Talos base image and needs no system extension.
Scrubbing is controlled by the FilesystemScrubConfig document,
which sets the global scrub interval, and by an optional per-volume scrub section which overrides it.
Default behavior
Scrubbing is disabled by default, in Talos v1.14 and in clusters upgraded to it. Unlike filesystem trim, no scrub document is emitted bytalosctl gen config, so scrubbing has to be enabled explicitly.
Enable scrubbing
Add aFilesystemScrubConfig document with a non-zero interval to enable scrubbing for all eligible volumes on the machine:
168h0m0s for a week.
The minimum accepted value is 10s; the document is rejected at validation time if a shorter interval is set.
A document without an interval field does not enable scrubbing.
Removing the document disables scrubbing for every volume which does not enable it explicitly.
The change takes effect without a reboot.
Override the interval per volume
Scrubbing can be adjusted for a single volume with ascrub section on the volume document.
It is supported by VolumeConfig,
UserVolumeConfig and
ExistingVolumeConfig:
- Without a
scrubsection, the volume follows the globalFilesystemScrubConfiginterval, if any. - A
scrubsection enables scrubbing for the volume unlessenabled: falseis set explicitly. This works even when the global document is absent: ascrubsection with nointervalfalls back to a one week interval. scrub.interval, when set, overrides the global interval for this volume only.
enabled: false:
Which volumes are scrubbed
A volume is scrubbed on a schedule when all of the following hold:- Scrubbing is enabled for the volume with a non-zero interval.
- The volume is in the
readyphase. - The filesystem is
xfs. No other filesystem supports online scrubbing in Talos v1.14.
Scrub schedule
Talos does not scrub all volumes at once, and it does not scrub on a fixed wall-clock time such as midnight. Instead, each volume gets its own offset within the interval, derived by hashing the node ID together with the volume ID. This has two consequences:- The schedule is stable for a given machine: the same volume on the same node is always scrubbed at the same points in time, and a reboot does not shift or reset the schedule.
- The schedule is spread out across the cluster: because the node ID is part of the hash, every machine scrubs a given volume at a different time, and different volumes on one machine are scrubbed at different times. Since a scrub is a long, I/O-heavy operation, this keeps the load off the cluster as a whole.
Resource usage
A scrub reads a large amount of filesystem metadata, so Talos runs it as a background task at the lowest possible priority:- The lowest CPU priority (nice level 19) and the idle scheduling policy, so any other process on the machine preempts it.
- The idle I/O scheduling class, so the scrub only gets disk time which no other process wants.
- One volume at a time — scrubs are never run in parallel with each other.
xfs_scrub asks the kernel to repair the problems it finds where the kernel supports online repair.
Damage which cannot be repaired online requires the filesystem to be unmounted and checked with xfs_repair, which Talos does not run automatically.
Check the scrub status
TheFSScrubSchedule resource exists for every volume which is scheduled to be scrubbed, and shows the next scrub time:
FSScrubStatus resource reports the outcome of the most recent scrub of each volume:
success, and does not stop the volume from being scrubbed again at the next scheduled time.
The status is kept in memory, so a volume has no FSScrubStatus until its first scrub completes after the machine started.
The resolved scrub settings are also carried on the volume status itself, which is useful to check what the configuration resolved to:
xfs_scrub itself, including every problem it reports, is available as a service log:
Related
- Filesystem Trim applies the same scheduling model to discarding unused blocks.
- Disk Management documents the volume configuration these settings attach to.