Skip to main content
RunBook Academy

LinuxLXIV · Rolling MaintenanceBatch and rollback

Batch sizing and rollback - the change control discipline

Intermediate⏱ ~10 minbash

What you'll learn

  • Choose batch size for cluster changes
  • Bound batch size by the quorum and capacity ceilings
  • Have a tested rollback plan
  • Time the change and the rollback
  • Document the change

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

Batch sizing and rollback are the change control discipline for HA clusters. Wrong batch size or no rollback turns a change into an outage.

Batch size has two hard ceilings

Batch size is how many nodes change at once. It is not a preference, and it is not a speed dial. Two ceilings bound it before risk appetite is even considered.

1. Quorum. An N-node Corosync cluster is quorate while at least floor(N/2) + 1 members are present. Every node in the batch is a node that may restart, reboot, or lose membership, so the batch size B is bounded by:

B  <=  N - (floor(N/2) + 1)

N = 3  ->  quorum 2  ->  B = 1
N = 4  ->  quorum 3  ->  B = 1
N = 5  ->  quorum 3  ->  B = 2
N = 7  ->  quorum 4  ->  B = 3

Exceed that and the survivors are inquorate. With the default no-quorum-policy=stop, an inquorate partition stops every resource it is running. The “faster” batch becomes a guaranteed full outage, caused by the maintenance rather than by any fault.

2. Capacity. The N - B surviving nodes must carry 100% of the load for the whole batch window. If steady-state per-node utilisation is above (N - B) / N, the survivors saturate and you get a latency incident instead of a clean rolling change. Reduce B until the arithmetic works.

Take the smaller of the two ceilings. Then apply risk on top: for high-risk changes - kernel, storage stack, cluster stack, anything that reboots - use B = 1 with a canary hold regardless of what the ceilings would allow.

When to use each

ChangeBatch size
Kernel update1 node, hold 24h
Security patch1 node canary
Application updatemin(quorum ceiling, capacity ceiling)
Configuration changemin(quorum ceiling, capacity ceiling)
Routine patch1 node at a time, health gate between batches

The risk of the change chooses where you sit below the ceilings. It never lets you exceed them.

Between batches, gate on health rather than on a timer: quorum restored, all resources started, no failed actions, and the service’s own smoke test green. If the gate fails, the change stops there - a half-applied fleet is recoverable, a fully-applied broken fleet is not.

sudo pcs status --full          # quorate? any Failed Resource Actions?
sudo corosync-quorumtool -s     # expected votes vs total votes

Rollback

For every change, have a tested rollback:

  • Packages: capture the old .deb before the change, then reinstall it and hold. apt-get install --allow-downgrades PKG=VERSION only works while that version is still fetchable, and after a security update it usually is not - see below. On RHEL, sudo dnf history undo <id> works while the old package remains in the cache or the repository.
  • Configuration: revert from git.
  • Container: redeploy the previous image.
  • Service: restart with the previous config.

Test the rollback in staging. The first time should not be a real production change.

Time the change

Time the change and the rollback:

START=$(date +%s)

# Apply change
...

END=$(date +%s)
echo "Change took $((END-START)) seconds"

If the change takes longer than expected, abort. If the rollback is faster, that’s the target for the next change.

Change record

Every change produces a record:

CHANGE: 2026-08-09 14:00 - nginx 1.27.2
DESCRIPTION: Security update for CVE-2024-XXXXX
NODES: 1 canary, then 1/3 cluster
CHANGE DURATION: 5 minutes per node
ROLLBACK DURATION: 3 minutes per node
VALIDATION: smoke test, latency, log scan
RESULT: success
NOTES: no issues observed

The change record is the audit trail. Compliance and post-incident review depend on it.

Knowledge check

Knowledge check · 5 questions

  1. Q1. What is the safest batch size for a kernel update?

  2. Q2. Every change must have a tested rollback.

  3. Q3. Which of the following are valid change control disciplines? Select all that apply.

  4. Q4. You have a 5-node Corosync cluster and a change window that is too short to do one node at a time. What is the largest batch you may take?

  5. Q5. A routine patch is low-risk enough to apply to every cluster node at the same time.

Passing score: 75%. Answers are checked in this browser.