← All guides

UPS and graceful shutdown: protecting a home lab from power cuts

Hardware · 8 min read

A home lab does not fear the dark; it fears the half-written file. A power cut mid-write can corrupt a filesystem or a database, and spinning disks are at their most vulnerable in exactly that moment, homelab design notes treat protecting storage from power loss during writes as non-negotiable. An uninterruptible power supply (UPS) fixes this, but not by doing what most buyers imagine. Its job is not to keep the lab running through an outage. Its job is to buy enough orderly minutes for every machine to shut itself down cleanly, and to do it automatically, at 3 a.m. with nobody home.

Reframe: minutes, ordered, automatic

Three words define a correct setup. Minutes: you need enough runtime for detection plus an orderly shutdown, typically a handful of minutes, not an evening of computing. Ordered: virtual machines and containers stop first, their hosts next, storage last, because each layer depends on the one below it being alive while it closes. Automatic: a human with a flashlight is not a shutdown strategy. Software, almost always NUT, Network UPS Tools, in the open-source world, watches the UPS and issues the commands.

Sizing without the marketing math

UPS capacity is sold in VA, but your loads are in watts; the electricity guide on this site shows how to measure your lab's actual draw. The working method: total the watts of everything that will sit on battery outlets (measure, do not guess from power-supply labels), then choose a UPS whose watt rating exceeds that total with comfortable headroom, running a UPS near its limit shortens runtime drastically and stresses the battery. Then check the manufacturer's runtime chart at your load: you want the chart to promise meaningfully more than your shutdown sequence needs, so that an aging battery (see below) still clears it in two years. Pure sine wave output is worth preferring with modern active-PFC power supplies, a documented homelab decision record makes exactly that call after finding a stepped-wave unit unsuitable for its server's PSU.

Load triage: what earns a battery outlet

On batterySurge-only / not at all
Servers and NAS (they must shut down cleanly)Monitors (a convenience, not a protection need)
Router, modem/ONT, and the switch the servers use (the shutdown signals travel the network)Printers (laser printers also draw heavily)
The host that runs the NUT server, if separateDesk lamps, chargers, speakers

The network row is the one beginners miss: if the switch dies with the power, the shutdown broadcast never arrives. Keep the path from UPS to every protected machine alive for the same minutes you keep the machines alive.

The NUT pattern

The standard homelab architecture, visible across documented builds, is: the UPS connects by USB to one always-on host, which runs the NUT server; every other protected machine runs a NUT client. On power loss the server tracks battery state; at the configured trigger it broadcasts shutdown, and clients power off in the designed order, workloads first, hypervisors next, the storage host last, after its clients are confirmed down. Standard drivers (the common usbhid-ups for USB HID devices) mean no vendor software is required on the hosts.

Trigger policy is a real decision. A documented approach with sound logic: ride through short blips on battery, most outages are seconds long and need no response, and trigger the shutdown on the UPS's low-battery signal, which maximizes uptime while still guaranteeing a clean exit before the battery is empty. Timer-based triggers (shut down after N minutes on battery) trade some of that uptime for earlier, gentler shutdowns; either is defensible if it is chosen deliberately and tested.

The unplug test (non-optional)

  1. Announce the test to your household and confirm backups are current.
  2. Pull the UPS plug from the wall. Dashboards should flip to “On Battery” immediately.
  3. Watch the battery drain and confirm the trigger fires at the configured threshold.
  4. Verify the order: workloads stop, hosts shut down, storage last, all gracefully, before the battery dies.
  5. Restore power, boot in order, and confirm every service returns. Log the measured runtime in your lab documentation.

Builders who document their setups treat this physical test as the only real proof, because it exercises the entire chain, detection, signalling, and shutdown, rather than each link separately. Success looks like: every machine off cleanly with runtime to spare, and a boring, event-free boot when power returns.

Batteries age; plan for it

Lead-acid UPS batteries degrade over a few years, and runtime shrinks with them. The defences are calendared, not heroic: repeat the unplug test (or a shorter self-test) periodically, note the runtime trend in your lab log, and budget for a replacement battery on roughly a three-to-five-year horizon. Discovering the degradation during a scheduled test is the system working; discovering it during a storm is the system reporting its own neglect.

Common failure modes the test will catch

The unplug test earns its place by surfacing a predictable set of failures while the stakes are zero. The most common: the NUT client on a second machine was never configured, so it rides the outage down to a hard stop while the server shuts down politely beside it. Next, the shutdown order inverts, a hypervisor stops before a VM that stores its disks on the NAS has exited, or the NAS itself goes first and strands everything mounted on it. Third, runtime is far shorter than the box promised, because the load calculation quietly included a monitor, a gaming PC, or a printer that someone plugged into a battery outlet “temporarily” a year ago. Fourth, the machines shut down beautifully and never come back, because power-restore behaviour was never set, turning a two-minute blip into an outage that lasts until someone gets home.

Each failure has the same signature: it is invisible until exercised. That is why experienced homelab builders schedule the test rather than trusting the configuration, and why the test's result, measured runtime, observed order, clean restart, belongs in the lab documentation next to the UPS purchase date and battery age. The documentation habit and the power habit reinforce each other: the test produces the numbers, the log preserves them, and the trend across tests is what tells you the battery is fading while there is still time to replace it on your schedule instead of the weather's.

Treat the whole system. UPS, NUT, shutdown order, restart behaviour, test log, as one appliance with one job. When that job is verified, power stops being a source of lab anxiety entirely, which for a hobby built on leaving computers alone in a closet is worth more than any runtime figure.

FAQ

Can one UPS protect machines in different rooms? The battery outlets are local, but NUT shutdown signalling travels the network, machines on a different (smaller) UPS, or even on wall power you are willing to lose abruptly, can still receive the signal and shut down cleanly if their network path stays up.

Should the lab auto-restart when power returns? Most BIOS/UEFI settings offer “power on after AC loss.” It pairs well with graceful shutdown, but consider a delay: power that flickers back unstably can bounce machines repeatedly.

Next: What a home lab actually costs to run →