Back to Engineering Blog
Infrastructure & Reliability 3 min read

When the NVR Filled Its Own Disk: Frigate, Retention and a Flaky USB Drive

Frigate refused to start with 'No space left on device'. Continuous recording from four cameras had piled up while the retention cleanup could not run. The replacement USB drive then failed under write, and we stopped instead of retrying.

Jason NevillBy , Houston, TX
#Frigate#NVR#Storage#Incident

Key Architectural Takeaways

  • Retention that only runs inside the application cannot protect you while the application is down.
  • Stop writing to a device that keeps disconnecting; retries risk silent corruption.
  • Deleting recordings is a real, destructive action and needs an explicit go-ahead.

The symptom

The Frigate container would not start. pct start failed in the pre-start hook with "No space left on device".

Root cause

We mounted the container's volume directly with the container down and found it 100% full. The 40 GB root disk (already doubled from 20 GB the session before) held about 30 GB of continuous recordings from all four real cameras, accumulated in a single window of roughly five hours. That is about 5.5 GB per hour combined.

The retention policy was set to keep only footage with motion. But that pruning happens inside Frigate's own periodic cleanup pass. A gap in the early morning, visible in directory timestamps, showed Frigate had been down, so cleanup never ran and footage piled up without limit. The safety mechanism lived inside the thing that had failed.

The fix, and who approved it

Deleting camera footage is destructive, and the first attempt was correctly blocked until a person confirmed. With that go-ahead we deleted the oldest ~16 GB of that day's continuous footage, which the retention policy would have pruned anyway, unmounted, started the container, and confirmed healthy through the API (version 0.14.1).

The second problem: the new drive

A "new" USB drive had been added for recording. It was a repurposed 465 GB portable drive still full of an old Windows system image, and we confirmed with the owner that it was safe to wipe. The wipe failed with an I/O error. The kernel log showed the drive disconnecting and re-enumerating four times in about fifteen minutes, including during a plain read test that failed after 70 MB. It was on a root USB 2 port with no hub, so a hub power problem was off the table. Likely culprits were the drive's USB bridge, the cable or the port.

We did not keep retrying. Writing through a mid-disconnect can produce silent corruption that looks fine until it matters, which is the same class of risk we had already met with the backup datastores. The drive was left unformatted and unused, and recording was turned off globally so the container's own OS disk could not be used as a scratch disk again.

Verification

Frigate's API reported healthy after the restart, and recording was confirmed disabled in the live config.

Takeaway

Put a hard capacity boundary around anything that records, and put it outside the process doing the recording. And when a device misbehaves under write, stop; a flaky disk is a diagnosis, not a retry loop.

Follow the build on LinkedIn or by RSS.

All Articles

Follow the build

Questions about the build, or spotted something we got wrong? Find us on LinkedIn and GitHub.