Skip to main content
RunBook Academy

CephCVII · CephFS BackupCephFS Backup

Restoring CephFS data

Advanced⏱ ~18 mincephrsync

What you'll learn

  • Choose the appropriate recovery path
  • Restore from a snapshot
  • Restore from an off-cluster backup
  • Handle a whole-filesystem recovery

Prerequisites

None — start here.

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

CephFS has no rollback, so every recovery is a copy — and the right copy mechanism differs by an order of magnitude in cost.

Choosing the path

ScopePathCost
One filecopy from .snapseconds
A directorycopy from .snapproportional to that directory
A whole subvolume, keeping the live onesubvolume clonefull copy of the subvolume
A whole subvolume, replacing itclone, then repoint the consumerfull copy
Data older than snapshot retentionoff-cluster backuptransfer time
The filesystem is goneoff-cluster backup, into a rebuilt filesystemfull restore
The first two cover the overwhelming majority of real recoveries, and
they are nearly free.

From a snapshot

# find the snapshot holding the wanted state
ls /mnt/cephfs/projects/.snap/
# restore one file
cp -a /mnt/cephfs/projects/.snap/backup-20260817/report.xlsx \
      /mnt/cephfs/projects/report.xlsx.restored
# restore a directory, without clobbering current content
rsync -aHAX \
  /mnt/cephfs/projects/.snap/backup-20260817/design/ \
  /mnt/cephfs/projects/design.restored/
Restore to a new path and let the owner confirm before replacing the
live copy. Copying over the live path destroys whatever was there.
# subvolume equivalent
ceph fs subvolume snapshot clone cephfs acme snap-20260817 acme-restored \
  --group_name tenants --target_group_name tenants
ceph fs clone status cephfs acme-restored --group_name tenants

From off-cluster backup

# SNAPSHOT_ID: the short id from the restic snapshots listing below
SNAPSHOT_ID=7f3c1a9e

restic snapshots --tag projects
restic restore "$SNAPSHOT_ID" --target /mnt/cephfs/projects-restored \
  --include /projects/design
# reapply layouts, which the backup did not carry
setfattr -n ceph.dir.layout.pool -v cephfs.cephfs.data \
  /mnt/cephfs/projects-restored/design
ls -la /mnt/cephfs/projects-restored/design | head
getfattr -n ceph.dir.layout /mnt/cephfs/projects-restored/design 2>/dev/null

Whole-filesystem recovery

If the filesystem itself is lost, recovery is:
  create a new filesystem with the intended layout
  restore the tree from off-cluster backup
  reapply layouts
  recreate subvolumes and their quotas
  reissue or restore client capabilities
  repoint clients
ceph fs volume create cephfs-new
ceph fs subvolumegroup create cephfs-new tenants
ceph fs subvolume create cephfs-new acme --size 5497558138880 --group_name tenants
ceph fs ls
ceph fs status cephfs-new
Note that recreating the shape is fast and restoring the data is not.
The RTO is dominated by the transfer, which is why it must be measured.

Quiz

Knowledge check · 4 questions

  1. Q1. What dominates CephFS whole-filesystem recovery time?

  2. Q2. Restoring a directory from `.snap` should be copied directly over the live path.

  3. Q3. Choose a CephFS recovery path.

    A tenant reports a directory was deleted this morning. Nightly subvolume snapshots exist and the subvolume holds 4 TiB.

  4. Q4. What must be reapplied after restoring a CephFS tree from off-cluster backup?

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

Production discipline

Restore alongside the live tree and let the owner confirm before replacing — copying over the live path destroys work done since the snapshot. For CephFS, include file count as well as byte count in the RTO estimate; metadata operations dominate large-tree restores.

Cross-course references

  • Kubernetes: restoring into a new PVC before switching keeps the original available
  • Linux: file-count dominates restore time for large trees more often than byte-count