Skip to main content
RunBook Academy

CephXLIII · CephFS Failure ScenariosCephFS Failure Scenarios

MDS journal damage and recovery

Expert⏱ ~20 mincephcephfs-journal-toolcephfs-table-tool

What you'll learn

  • Recognise journal damage from its symptoms
  • Follow the recovery sequence in the correct order
  • Understand what each recovery tool discards
  • Preserve evidence and recovery options

Prerequisites

  • T
  • h
  • e
  • f
  • i
  • l
  • e
  • s
  • y
  • s
  • t
  • e
  • m
  • m
  • a
  • r
  • k
  • e
  • d
  • d
  • o
  • w
  • n
  • ,
  • a
  • m
  • o
  • n
  • i
  • t
  • o
  • r
  • s
  • t
  • o
  • r
  • e
  • b
  • a
  • c
  • k
  • u
  • p
  • ,
  • a
  • n
  • d
  • c
  • o
  • n
  • f
  • i
  • r
  • m
  • a
  • t
  • i
  • o
  • n
  • t
  • h
  • a
  • t
  • o
  • r
  • d
  • i
  • n
  • a
  • r
  • y
  • r
  • e
  • c
  • o
  • v
  • e
  • r
  • y
  • p
  • a
  • t
  • h
  • s
  • h
  • a
  • v
  • e
  • f
  • a
  • i
  • l
  • e
  • d
  • .

Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18

Not yet marked complete on this device.

Why this matters in production

Journal damage is rare and the recovery tools are genuinely destructive. Working the sequence in order, and knowing exactly what each step discards, is what separates a recovery from a data-loss event you caused yourself.

Recognising it

ceph fs status cephfs
# rank 0 stuck in replay, or repeatedly crashing there

journalctl -u ceph-mds@a | grep -iE 'journal|corrupt|assert'
ceph tell mds.a damage ls
cephfs-journal-tool --rank=cephfs:0 journal inspect
# Overall journal integrity: DAMAGED

That last command is read-only and is how you confirm rather than assume.

Before anything destructive

# 1. take the filesystem down so nothing is writing
ceph fs fail cephfs

# 2. export the journal — this is the evidence and the fallback
cephfs-journal-tool --rank=cephfs:0 journal export /backup/journal-rank0.bin

# 3. back up the monitor store if not already done

The export is not optional. Every subsequent step is potentially destructive, and the exported journal is the only way to reconsider.

The recovery sequence

Step 1 — recover what the journal still holds.

cephfs-journal-tool --rank=cephfs:0 event recover_dentries summary

This replays recoverable dentry operations into the metadata pool, salvaging metadata the damaged journal still describes. Non-destructive.

Step 2 — reset the journal.

cephfs-journal-tool --rank=cephfs:0 journal reset

Destructive. Discards journal entries not recovered in step 1 — recent creations, deletions, and renames are lost. The filesystem becomes mountable again.

Step 3 — reset the session and inode tables.

cephfs-table-tool all reset session
cephfs-table-tool all reset snap
cephfs-table-tool all reset inode

Clears stale allocation state that would otherwise conflict with the reset journal.

Step 4 — bring the filesystem back.

ceph fs set cephfs joinable true
ceph fs status cephfs

Step 5 — verify and repair.

ceph tell mds.0 scrub start / recursive repair
ceph tell mds.0 scrub status
ceph tell mds.a damage ls

The scrub walks the tree and reconciles metadata against the data pool, finding orphaned inodes and inconsistencies the reset left behind.

If the metadata pool itself is damaged

DATA_POOL=rbd-vms
cephfs-data-scan scan_extents ${DATA_POOL}
cephfs-data-scan scan_inodes ${DATA_POOL}
cephfs-data-scan scan_links
cephfs-data-scan cleanup ${DATA_POOL}

These rebuild metadata by scanning the data pool objects — a last resort that recovers file contents into lost+found with much of the namespace structure gone. It takes a very long time on a large filesystem.

Quiz

Knowledge check · 4 questions

  1. Q1. Why must `event recover_dentries` be run before `journal reset`?

  2. Q2. `cephfs-journal-tool journal inspect` is safe to run against a live filesystem.

  3. Q3. Respond to a suspected journal problem.

    Rank 0 has crashed three times in `replay` with assertion failures mentioning the journal. The filesystem is unavailable. The team is considering running `journal reset` to get it back up quickly.

  4. Q4. What does `cephfs-data-scan` recover, and what does it lose?

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

Production discipline

Treat every step of this sequence as a decision requiring confirmation rather than a procedure to execute, and make the journal export a mandatory gate before anything destructive. If a support relationship exists, engage it at the export stage — that file is what any serious diagnosis starts from.

Cross-course references

  • Kubernetes: etcd disaster recovery follows the same confirm-backup-then-repair sequence
  • Linux: filesystem repair tools carry identical warnings for identical reasons