Recovering from Prometheus TSDB and WAL corruption

A Prometheus server that will not start after TSDB or WAL corruption needs a careful order of steps: back up first, restore damaged blocks from backup, and remove data only as a last resort.

On this page

Recovering Prometheus TSDB and WAL corruption when the server will not start

When Prometheus stops on boot after a crash, a disk fault or an unclean shutdown, monitoring is blind until the server runs again, and the order of recovery steps decides how much history you keep. Back up the data directory first, restore damaged blocks from backup second, and remove data only as a last resort. Every step before removal keeps the data intact, so take the copy before you touch anything else.

Prometheus keeps its local store in a time series database (TSDB) under the storage directory. Samples are written to a write-ahead log (WAL) first and then compacted into blocks, each covering two hours of data. Local storage is single-node: it is not clustered or replicated, so a damaged block or WAL segment on this server has no second copy inside Prometheus. The storage documentation says to manage it like any other single-node database, and that is the right frame for recovery. Confirm where your storage directory lives, how the disk is mounted, and whether your host's disk logs show I/O errors before you restart the process again.

Start by copying the whole storage directory to separate storage with the Prometheus process stopped, and record its size and free space so you know whether the copy will fit. Then decide whether a usable backup of the affected block directories exists, either from your own file-level backups or from an earlier admin snapshot. If it does, restore those blocks. Only when no backup covers the damaged range should you remove individual block directories or the WAL, accepting that the data for the time they cover is gone. Ask your team to document which time range you expect to lose before the removal, so the gap can be explained to anyone who queries it later.

Back up the data directory before choosing a recovery step

The path starts when Prometheus fails to start because of a damaged block or WAL. The first hand-off is always a copy of the whole storage directory, so every later attempt can be undone. Next, check whether a clean backup of the damaged block or WAL exists. If it does, restore that block from backup. Only when no backup exists should the damaged block or WAL be removed as a last resort, which accepts the loss of data for the time range it covers. Confirm the time range before removing anything.

Decision path for recovering a Prometheus storage directory that will not start.

How to back up and recover a damaged Prometheus data directory

This sequence protects the remaining data before any change, isolates the damaged blocks or WAL, restores them from backup where possible, and confirms that Prometheus starts and answers queries. Each step ends with a check so the team knows whether to continue or stop.

  1. Stop Prometheus and record the startup error

    Stop the Prometheus process or container so nothing writes to the storage directory during recovery, then start it once in the foreground and capture the full error from the log. Note the file or block directory named in the message, the Prometheus version, and the storage path from the --storage.tsdb.path flag. Done when the stopped state is confirmed with the service manager or docker ps, and the error text is saved to a ticket or file for the change record.

  2. Copy the entire storage directory to separate storage

    Before changing anything, copy the whole storage directory, including the wal directory, chunks and any block directories, to storage that is separate from the Prometheus host's data volume. Use a copy method that preserves files, such as rsync -a, and record checksums of the copy. The check is that the copied tree has the same file count and total size as the source, and that the checksum list matches when recomputed on the copy. Keep this copy untouched for the rest of the work.

  3. Identify the damaged blocks or WAL

    Match the error to the storage layout. Block directories are named with ULIDs and each contains a meta.json file, while the WAL lives in the wal subdirectory and is made of numbered segment files. Run promtool tsdb analyze against a copy of the data directory to see which blocks open cleanly, and check each candidate block's meta.json for readability. The step is complete when you have a written list of the damaged block directories or WAL segments and a list of healthy ones.

  4. Restore damaged blocks from a known-good backup

    Locate the most recent backup that contains the damaged block directories, such as a snapshot taken through the admin API or an off-host copy. Replace only the damaged block directories with their backup copies, leaving healthy blocks in place, and keep the damaged originals in the separate copy. The check is that each restored block directory exists with its meta.json and that its file sizes match the backup manifest or backup record. If no backup covers the damaged data, record that fact before moving on, because the next steps lose that data.

  5. Remove damaged blocks or WAL as a last resort

    Only when no backup holds the damaged data, move the damaged block directories or the WAL out of the storage directory into a quarantine folder, not delete them. Removing a block or the WAL discards the samples for the time range it covers, and the storage docs note that this loss applies to that time window. Record the time range from each removed block's meta.json, or the WAL's time window, so the gap is documented for dashboards and for anyone reviewing the incident. Confirm the quarantine folder holds the moved files before restarting.

  6. Restart Prometheus and confirm it starts cleanly

    Start Prometheus with the same configuration and storage path, then watch the log until the storage and scrape managers report that they are running without a corruption error. Confirm the process stays up through at least one compaction cycle, since a fault can appear later. Check that the up metric returns series for your jobs at /api/v1/query or in the expression browser. The step is complete when Prometheus is healthy and the error no longer appears in the log.

  7. Verify data coverage and document the gap

    Query a known series across the window before the fault and confirm the expected samples are present, and check that the time ranges you recorded match the gaps visible in dashboards. Compare the recorded gaps with the quarantine list so the incident record matches the data. Confirm that alert rules evaluate again and that Alertmanager receives alerts. Finish by taking a fresh backup of the recovered directory and storing the checksums with the incident record, so the next recovery starts from a known state.

Restore from backup or remove damaged data

Restoring from backup is the path that keeps data. When a block directory is damaged but a copy of it exists, you replace the damaged directory with the copy and Prometheus reads the same samples it held before the fault. This path applies when the backup is recent enough to cover the blocks in question and was taken while the data was still intact. Before you copy anything back, stop Prometheus, keep the damaged directory aside instead of deleting it, and confirm the restore source is the one you intend.

  • Confirm the backup covers the damaged blocks: list the block directories in the backup and compare their time ranges with the ones named in the startup error.
  • Preserve the damaged data: move the broken directory to a quarantine location so it can be inspected or recovered later.
  • Restore one block at a time: copy the matching block directory back, then start Prometheus and confirm it loads before moving on.
  • Check the backup's own integrity: a backup that was copied while Prometheus was writing may carry the same fault, so verify it before relying on it.
  • Plan for the gap: data written after the backup was taken is not in it, so note the time window that remains missing.

Confirm with your own backup tooling how it captures the data directory and whether restores are tested on a schedule.

What data is lost when blocks or the WAL are removed

Removing damaged storage is a deliberate loss of samples, and the loss is bounded by what each component holds. The cards below separate block loss, WAL loss, the gaps they leave in alerts and dashboards, and the configuration that needs review afterward.

Removed block loses its window

A block covers a two-hour window of samples. Deleting one removes every series sample recorded in that window, for all series, not only the one that caused the failure. Before you delete, check which block directories were written in the affected period and confirm with your team which time range your dashboards and incident records depend on. Restoring the block from a backup is always preferable to removing it.

Block window
2 hours
Storage docs

Removed WAL loses recent samples

The write-ahead log holds samples that have not yet been compacted into blocks. Removing it discards the most recent data, which is often the window an operator most needs to see during an incident. Check the WAL directory and its timestamps before deciding, and record how far back the surviving blocks reach so you can state the exact gap to stakeholders.

Alerts and dashboards show gaps

Missing samples appear as gaps in graphs and as absent series for any query that spans the removed window. Alert rules that use for durations or rate functions may reset or fire unexpectedly around the gap. Review alert history for the affected period, since alerts that fired or resolved during the outage may not be reproducible from storage.

Recording rules need review

Recording rules write derived series into the same storage, so any precomputed series for the lost window are lost with the raw data. Dashboards that depend on those series will show gaps even when the raw metrics are intact. List the recording rules that evaluate over the removed period and confirm whether they can be backfilled from remaining data or must be left with a documented gap.

Retention settings affect what remains

Default retention is 15 days, and retention can be set by time or size. If retention is tight, older blocks may be removed soon after recovery, reducing the window available for comparison. Confirm the retention flags in your service configuration before recovery, and decide whether a longer-term store must hold the data you cannot afford to lose.

Local storage is single node

The storage docs state that local storage is not clustered or replicated, so a corrupted disk has no replica to recover from. Samples removed from one Prometheus server cannot be restored from another server unless remote write sent them elsewhere. Ask whether remote write or a long-term store already holds the lost window, because that copy is often the only way to recover it.

Recovery options and when each fits

This table compares the five recovery options for a Prometheus instance that will not start because of damaged blocks or WAL. Read each row from the top down, starting with the least destructive option, and move to the next only when the earlier one has failed. The main takeaway is that every option except copying the data directory discards or leaves behind some samples, so confirm what remote storage holds before you delete anything.

OptionWhen it fitsData lossConfirm before acting
Back up the data directory onlyAlways, as the first step, before any change to damaged filesNone, because nothing is removed or alteredFree disk space for a full copy and a restore point you can roll back to
Restore corrupted blocks from backupYou have a clean copy of the affected block directories from a recent backupSamples written after that backup for those blocks, usually none if the backup is recentWhen the backup was taken and whether it was taken from a stopped or consistent state
Copy blocks from remote storageRemote write was enabled and the long-term store holds the same time rangeLittle or none for the blocks you can copy back, if the remote copy is completeWhether remote storage holds the same samples, for the same time range, with no gaps from failed sends
Remove a single damaged blockOnly one block directory is unreadable and the rest of the data mattersSamples for the two-hour span that block covers, unless recovered from backup or remote storageWhich block is damaged, and that the remaining blocks load cleanly after removal
Remove the WALLast resort, when the WAL alone blocks startup and blocks cannot be repairedRecent samples still held only in the WAL, which may be the most recent hours of dataWhether remote storage or a backup already holds those samples, since they cannot be recovered afterward

Security and operational risks during recovery

Recovery work tends to multiply copies of the data and widen access to the server at the moment everyone is under pressure. The cards below cover the risks that follow from that: exposed data copies, weak backup controls, admin endpoints left open and recovery run on a disk with no safety copy.

Copies carry sensitive label values

Every copy of the data directory holds the full set of metric names, label values and sample history, not only the blocks that failed. Label values can include hostnames, customer or tenant identifiers, internal paths or usernames. Before copying anything off the host, ask the metric owners which labels they consider sensitive and confirm whether those labels were removed or relabeled at scrape time. Treat the copy as the same data classification as production.

Backups need production access control

A backup of the storage directory is a complete, readable copy of production monitoring data, so it should not sit on a file share that is looser than the Prometheus host itself. Check who can read the backup location, whether transfers are encrypted, whether the copies are logged and whether restores are approved by the same people who approve production changes. An unprotected backup can expose the same data as a compromised server.

Admin APIs widen exposure

Prometheus disables its admin HTTP APIs by default, and the --web.enable-admin-api flag turns on destructive operations. Recovery runbooks sometimes enable this flag to take snapshots or delete series, then forget to disable it. The --web.enable-lifecycle flag, which enables reload and shutdown endpoints, carries a similar risk. Record which flags were set before recovery, enable them only for the window needed, and confirm they are off after the server returns to service.

Prometheus security model

Shared disks leave no fallback

Running recovery on a volume shared with other workloads, or on the only copy of the data, removes your ability to roll back if a repair step deletes the wrong block. Removing a damaged block or the WAL is irreversible for the time range it covers. Before any repair, confirm a complete copy exists on separate storage and that the copy can be restored. If no backup exists, make one first, even if the server is down and the copy takes time.

Exposed endpoints during restart

A server that fails to start is often restarted several times with different flags and configuration changes. Each restart can bring up the web UI and API before the team has finished checking access. Confirm the listen address and whether the server is reachable from networks outside the operations team. Keep the web interface on a restricted interface until the repair is complete, and confirm TLS or authentication settings match production before exposing it.

Recovery actions need an audit trail

Recovery steps such as moving block directories, removing the WAL or restoring from a snapshot change the data your alerts and dashboards depend on. Record who ran each command, when, which directories were moved and what was deleted, along with the time range affected. This record supports the post-incident review and lets compliance or audit teams see what monitoring evidence was lost. Store the log outside the Prometheus data directory.

Questions buyers ask about Prometheus corruption recovery

What does Prometheus corruption recovery cost and what drives the effort?

Recovery is quoted from a written scope, so the cost depends on what has to be inspected and restored. The main drivers are how many block directories and WAL segments are damaged, whether usable backups exist and how complete they are, whether the data directory sits on a volume you can snapshot, and how much of the affected history must be proven intact before Prometheus is returned to service. Ask for a quote that separates the one-time investigation and recovery from any follow-up work, such as hardening storage or adding backups, which recurs as a service. Prometheus itself is licensed under Apache-2.0, so there is no license fee in the recovery cost; you pay for infrastructure, storage and the people doing the work.

How long does it take to recover a corrupted Prometheus TSDB?

Duration depends on the damage and the environment rather than on a fixed rule. The work moves faster when a recent backup of the storage directory exists, the damaged blocks are few and clearly identified, and the server can be stopped and inspected without a change window problem. It slows when the corruption spreads across many blocks, when the data directory is large enough that copying it takes significant time, or when access to the host, backups or the team that owns the alerts is delayed. Ask any provider for a timeline that names the steps, the decision points where a last-resort removal would be considered, and the dependencies on your change process.

What does the client team need to provide for recovery?

Expect to supply privileged access to the Prometheus host or Kubernetes namespace, the storage directory location, the Prometheus configuration and the startup logs, plus access to any backups or snapshots. Someone who owns the monitoring estate should confirm which data matters most, such as the time ranges that feed compliance evidence or active alerts, because that decides what is restored first. You will also need a change window, a decision-maker who accepts data loss for any block or WAL that cannot be recovered, and a way to validate that alerts and dashboards work after restart. Confirm the exact access model and approval steps in your own environment before work starts.

Can our own engineers recover Prometheus from corruption without a partner?

Yes, if the team has Linux administration skills, can read Prometheus logs, and has tested procedures for stopping the service and handling the data directory. The documented approach is to back up the storage directory first, restore corrupted block directories from backups where possible, and only as a last resort remove individual block directories or the WAL, which loses data for the time those files cover. The risk lies in acting under pressure without a copy of the original directory, in deleting the wrong files, and in not knowing which time ranges are gone. Many teams handle routine restores themselves and bring in a partner when the damage is widespread, when evidence must be preserved, or when no tested backup exists.

Do backups prevent Prometheus TSDB and WAL corruption?

Backups do not stop corruption from happening, but they determine how much data you lose when it does. A consistent backup of the storage directory lets you restore damaged block directories instead of deleting them, which is the difference between recovering history and losing it. Corruption is commonly caused by abrupt termination, disk faults, full volumes or unsuitable storage, so reducing those causes matters as much as backing up. Prometheus local storage is not clustered or replicated, so it should be run like any other single-node database. Backups taken through the admin snapshot API need that API enabled and protected, and you should confirm whether remote storage already holds the data you need.

Which data is lost when Prometheus blocks or the WAL are removed?

Removing a block directory or the WAL deletes the samples those files cover, so the data for that time window cannot be queried again from the local server. The storage documentation describes this as a last resort because the loss is permanent unless a copy exists elsewhere. Data still in the WAL but not yet compacted into blocks is the most recent material, so removing the WAL can lose the latest hours of samples. Before any removal, check whether remote write or a long-term store holds the same series, since that copy may allow you to fill the gap. Record the affected time ranges so alerts, reports and compliance evidence reflect the gap accurately.

Does DeployOpen issue a compliance attestation for recovered monitoring data?

No. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports, attestations or certifications; independent auditors and certification bodies do that. A recovery engagement can document what was restored, what was lost, the backups used and the time ranges affected, which gives your auditor a factual record. Ask your auditor in advance which evidence they expect for gaps in monitoring data and how they want losses explained.

How DeployOpen scopes and supports Prometheus recovery

DeployOpen approaches TSDB and WAL corruption as a controlled recovery job on your own Prometheus host, starting with a written picture of what is damaged and what data it covers. The work is scoped in writing before anything is changed, so the backup, restore and any removal decisions are agreed in advance with your operations and compliance teams.

How we scope

  • Review the storage directory layout, Prometheus version, startup logs and any existing backups before agreeing the recovery approach.
  • Agree in writing which block directories and WAL segments are affected, and which data time ranges are at risk.
  • Confirm whether snapshots, copies or remote storage hold the missing data, and who approves any deletion of blocks or WAL.

How we build

  • Take a full copy of the storage directory before any change, and verify the copy is complete and readable.
  • Restore damaged block directories from your verified backups in a staging environment first, then in production.
  • Remove blocks or WAL only as a documented last resort, recording the exact time range and series that the removal makes unrecoverable.

How we hand over

  • Deliver a recovery record listing the steps taken, the data time ranges restored, and the ranges confirmed lost.
  • Document the backup procedure for the storage directory, including excluding WAL directories from ad hoc copies where appropriate.
  • Walk your operations team through restart checks, the startup logs to watch and the alerts that should catch future failures.

How we support

  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and backup testing are available as a retainer if you want a partner on call for future incidents.
  • Ask any partner to confirm how they handle your host, credentials and backup media, and where recovery work is performed.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.