33.6. Recovering and Evaluating Storage Clusters
Storage recovery is a sequence of observations and bounded actions, not a
single command. The cluster keeps serving from replicas while one component is
down; the danger is that an operator, seeing a warning, performs a second
disruptive action before the first one has finished. The rules are: find the
failure domain, confirm that the remaining copies are sufficient, restore one
thing at a time, and wait for active+clean before declaring success.
33.6.1. Lost Quorum, Unavailable Data, and Avoiding Conflicting Recovery Actions
The monitors are the control plane. With three monitors, two are a majority;
with two monitors, one is a majority and the loss of either leaves the cluster
unable to agree. Stopping two monitors demonstrates the failure. On
storage2, as root, stop the first monitor:
# systemctl stop ceph-mon@storage2
The stop normally prints nothing. On storage3, as root, stop the second:
# systemctl stop ceph-mon@storage3
This stop also normally prints nothing. The remaining monitor cannot form
quorum, and a client command that needs the map blocks or times out. On
storage1, as root, a Ceph command with a short connect timeout fails
rather than hanging forever:
# ceph --connect-timeout 5 -s
timed out
The command exits nonzero. The data OSDs may still be running and may still serve an existing client that has a valid map, but no new map changes, pool operations, or authentication decisions can be committed. Do not conclude that the data is lost; conclude that the control plane is unavailable.
On storage2 and storage3, as root, restart the stopped monitors:
# systemctl start ceph-mon@storage2
# systemctl start ceph-mon@storage3
The starts normally print nothing. On storage1, as root, once a majority is
back, the quorum reforms and the map is available again:
# ceph -s
cluster:
id: a2fd83c0-85a8-4b10-8b2d-6cf6a067ef46
health: HEALTH_WARN
...
services:
mon: 3 daemons, quorum storage1,storage2,storage3 (age 10s)
mgr: storage1(active, since 4h)
mds: 1/1 daemons up
osd: 3 osds: 3 up (since 70s), 3 in (since 3m)
rgw: 1 daemon active (1 hosts, 1 zones)
data:
...
pgs: 426/951 objects degraded (44.795%)
189 active+clean
53 active+recovery_wait+degraded
6 active+recovery_wait
Selected output; the warning summary, capacity, and I/O lines are omitted. The
hidden warnings include a degraded-redundancy notice: the OSD layer was still
completing the recovery that the reboot exercise in section 33.5.5 started.
That recovery finishes independently of the monitors; what this step
re-establishes is the quorum itself, which is the control plane the client
commands need. A monitor that has lost its local store or has a stale map may
need to be rebuilt from a healthy peer. Do not "fix" quorum by editing the
monmap on each host independently; that creates multiple cluster identities. Use
ceph mon_status on a running monitor to see the quorum list, and follow the
documented monitor recovery procedure, which rebuilds one monitor from the
quorum rather than letting each monitor guess.
The same principle applies to OSDs and metadata servers. If an OSD is down, wait for it to return or replace it; do not mark multiple OSDs out at once, and do not delete pools to "clear" a warning. If a metadata server is down, check whether a standby took over before starting a second active rank. A second recovery action that races the first is how a degraded cluster becomes a lost cluster.
33.6.2. Degraded Capacity, Backfill Pressure, and Full-Cluster Behavior
With three replicas and min_size 2, one OSD failure leaves the pool writable
but degraded. On storage1, as root, after stopping the OSD on storage3,
ceph -s reports:
# ceph -s
cluster:
...
health: HEALTH_WARN
1 osds down
1 host (1 osds) down
Reduced data availability: 22 pgs inactive
Degraded data redundancy: 317/951 objects degraded (33.333%), 54 pgs degraded
services:
mon: 3 daemons, quorum storage1,storage2,storage3 (age 8m)
osd: 3 osds: 2 up (since 15s), 3 in (since 80m)
data:
objects: 317 objects, 10 MiB
usage: 368 MiB used, 5.6 GiB / 6.0 GiB avail
pgs: 54.032% pgs not active
317/951 objects degraded (33.333%)
116 activating+undersized
78 active+undersized
36 active+undersized+degraded
18 activating+undersized+degraded
Selected output; the standing configuration warnings and the unvaried
service and data lines are omitted. The header
shows one OSD down and one host down. Seconds after the loss, some PGs were
still activating with the two remaining replicas, and a small set was not
yet active at all; they finish peering on their own. The rest of the pools
run undersized: two replicas instead of three. The cluster can still serve
reads from the remaining copies. A write is accepted only if at least two
copies can be written; with min_size 2, a single OSD loss leaves the pool
writable.
On client1, as john, verify that writes still work while the OSD is down:
$ sudo rbd map rbdpool/restored-volume --id handbook
/dev/rbd0
Create a fresh filesystem on it with sudo mkfs.ext4 -F /dev/rbd0; it
prints the normal creation report, and the write test only needs the result.
Mount the filesystem:
$ sudo mount /dev/rbd0 /mnt/rbd
The mount normally prints nothing. Write a file:
$ sudo sh -c 'echo degraded-write-ok > /mnt/rbd/degraded.txt'
Read it back:
$ cat /mnt/rbd/degraded.txt
degraded-write-ok
The write succeeds because two replicas are available. If min_size were 3,
the same write would fail until the third OSD returned, which is the safer
choice for data that cannot tolerate any window of reduced redundancy.
On storage3, as root, restart the OSD:
# systemctl start ceph-osd@2
The start normally prints nothing. On storage1, as root, watch recovery:
# ceph -s
cluster:
...
health: HEALTH_WARN
Degraded data redundancy: 1/951 objects degraded (0.105%), 1 pg degraded
services:
osd: 3 osds: 3 up (since 21s), 3 in (since 81m)
data:
pgs: 1/951 objects degraded (0.105%)
247 active+clean
1 active+recovery_wait+degraded
io:
recovery: 14 KiB/s, 1 objects/s
Selected output; the warning summary and capacity lines are omitted. Recovery
is incremental: the OSD is up, but the PGs behind it are still
copying objects. active+recovery_wait means the PG is waiting for a recovery
slot; active+recovering means it is actively copying. The recovery rate in
ceph -s is the number to watch. On a real cluster, backfill can saturate the
cluster network and increase client latency; throttle it with
osd_recovery_max_active, osd_max_backfills, and the recovery sleep options
if client service matters more than rebuild speed.
Capacity is not simply the sum of the disks. With three-way replication, the
usable capacity is roughly one third of the raw capacity, minus BlueStore
overhead and reserved space. A full cluster behaves differently from a
degraded one: when an OSD crosses the full ratio, Ceph stops accepting writes
to the PGs that need that OSD, and clients see ENOSPC or OSD_FULL. The
default thresholds in Reef are nearfull (85%), backfillfull (90%), and full
(95%) of the OSD's capacity. A cluster at 95% is not a cluster with 5% free
space for normal writes; it is a cluster that has already reserved the
remaining space for recovery and metadata.
When the cluster is full, add capacity or delete data. Do not raise the full ratio to make writes succeed: that consumes the space recovery needs and can turn a full cluster into an unavailable one. If a pool is the problem, set a quota or delete unnecessary snapshots and objects. If the cluster is genuinely out of space, add OSDs and let CRUSH rebalance; the rebalance itself needs free space, so plan for headroom above the raw capacity divided by the replication factor.
33.6.3. Application-Level Checks After Storage Recovery
active+clean means Ceph has restored its replicas. It does not prove that the
application's data is consistent. After any storage incident, run the checks
the application understands:
- For an RBD-backed filesystem, run a read-only filesystem check before
mounting read-write:
e2fsck -fn /dev/rbd0orxfs_repair -n. A filesystem that was mounted during a hard failure may need journal replay, and a read-only check tells you whether repair is required. - For CephFS, check that the metadata server is active and that a client can list, read, and write a test file. CephFS metadata is replicated and journaled; a client that reconnects after a monitor or MDS failover may need to retry its session.
- For object storage, list the bucket, fetch a known object, and compare its checksum with the source. S3 does not expose POSIX metadata, so the object's ETag and size are the available checks.
- For an NFS or SMB service layered on shared storage, mount from an independent client, read a known file, and write a new one. A successful local mount on the storage node is not a client test.
A simple application check on the restored RBD image is to mount it and read the file written before the failure. For a database, run the database's consistency check or a logical dump; a block device that reads successfully can still contain a torn transaction. Keep the check proportionate to the data's value and the failure's severity.
33.6.4. Version Compatibility, Rolling Maintenance, and Expansion Planning
Ceph requires all daemons to be within a supported release during an upgrade.
Mixing major releases is not supported for production, and the monitor quorum
should be upgraded before the OSDs. On storage1, as root, ceph versions
shows the release running on each daemon class:
# ceph versions
{
"mon": {
"ceph version 18.2.7 (6b0e988052ec84cf2d4a54ff9bbbc5e720b621ad) reef (stable)": 3
},
"mgr": {
"ceph version 18.2.7 (6b0e988052ec84cf2d4a54ff9bbbc5e720b621ad) reef (stable)": 1
},
"osd": {
"ceph version 18.2.7 (6b0e988052ec84cf2d4a54ff9bbbc5e720b621ad) reef (stable)": 3
},
"mds": {
"ceph version 18.2.7 (6b0e988052ec84cf2d4a54ff9bbbc5e720b621ad) reef (stable)": 1
},
"rgw": {
"ceph version 18.2.7 (6b0e988052ec84cf2d4a54ff9bbbc5e720b621ad) reef (stable)": 1
},
"overall": {
"ceph version 18.2.7 (6b0e988052ec84cf2d4a54ff9bbbc5e720b621ad) reef (stable)": 9
}
}
A rolling maintenance sequence for a package-based cluster is:
- Put one host's OSDs in maintenance by marking only that host's OSDs out,
or set the cluster-wide
nooutflag briefly for the reboot.nooutaffects every OSD, so do not leave it set; it prevents CRUSH from reacting to a real failure. Stopping the host's daemons and letting the cluster recover around them is the simpler alternative when the host will be down for a short, planned window. - Stop the host's
ceph-osd,ceph-mon,ceph-mgr,ceph-mds, andradosgwunits in an order that preserves quorum and one active manager. - Apply the Debian package upgrade on that host, restart the units, and wait
for
ceph -sto show the host's OSDs up and the PGs clean before moving to the next host. - Upgrade the monitors before the OSDs if the release notes require it, and keep at least two monitors running throughout.
- For a
cephadmcluster, useceph orch upgrade start --ceph-version ...and let the orchestrator enforce the order; do not upgrade containers by hand on individual hosts.
Expansion is easier than upgrade but still needs a plan. Adding an OSD means
adding a device to a host and letting CRUSH place data on it; adding a host
means adding a CRUSH bucket and, if the rule uses host-level placement,
increasing the number of failure domains. After adding capacity, the cluster
backfills; watch ceph -s and ceph osd df until the PGs are clean and the
utilization variance is acceptable. If the pool's PG count is too low for the
new OSD count, enable the PG autoscaler or increase pg_num in steps. Do not
increase PG counts and add OSDs in the same maintenance window; the resulting
backfill and PG split compete for the same resources.
33.6.5. Sizing a Deployment and Interpreting Performance Measurements
Sizing starts from the usable capacity the application needs, not from the raw disk count. For a replicated pool:
raw capacity = sum of OSD sizes
usable capacity ≈ raw capacity × (1 - BlueStore overhead) / replication factor
With three 2 GiB OSDs, the raw capacity is 6.0 GiB. Three-way replication
leaves roughly 2 GiB of usable capacity before overhead; ceph df reports
1.7 GiB MAX AVAIL for the practice pools. That number, not the 6.0 GiB raw
figure, is what a new object can consume. For erasure-coded pools the formula
changes: usable capacity is roughly k / (k + m) of raw capacity, with
different latency and recovery behavior. Erasure coding is a poor fit for RBD
and CephFS metadata because of the small-write and read-modify-write costs; it
is more often used for large immutable objects.
Placement-group sizing is the second constraint. A common starting point is:
target PGs ≈ (OSDs × 100) / replicas
For three OSDs and three replicas, that is 100 PGs, rounded to a power of two (128). The practice pools use 32 or 16 PGs because the cluster is tiny and the data set is measured in kilobytes; using 128 PGs per pool on a 6 GiB cluster would waste memory and produce tiny PGs. On a real cluster, the PG autoscaler and the pool's application setting are safer than a fixed formula, especially as OSDs are added.
Network sizing follows the replication factor. A client write to a three-replica pool sends one copy to the primary OSD and two copies from the primary to the replicas, so the cluster network carries roughly twice the client write volume (plus heartbeat and recovery). A read is served from one replica, but a recovery after a failure reads from the surviving replicas and writes the rebuilt copy, which can saturate the cluster network. Size the cluster network for recovery, not just for steady-state client traffic.
Performance measurements need context. A throughput number from fio on a
256 MiB image says more about the client's page cache and the tiny object
count than about the cluster. Report the workload (block size, read/write mix,
queue depth, image size, replication factor), the client and network path, and
the cluster state (active+clean versus recovering). Compare measurements only
when those conditions match. For a first sanity check, measure sequential
write throughput, random read IOPS, and latency on an RBD image from a client
on the public network, then repeat while an OSD is rebuilding. The difference
is the recovery cost the application will feel.
A three-OSD cluster on one hypervisor, with 2 GiB devices, is not a sizing guide for production. Use the commands in this section to observe the cluster's behavior, and size a real deployment from the application's latency, throughput, and capacity requirements with independent failure domains.