Skip to main content

Recovering from full OSDs and full pools

Problem​

A Ceph cluster is in HEALTH_ERR and has stopped serving client I/O because OSDs or pools have reached their capacity thresholds. One or more of these health checks is reported:

  • OSD_FULL
  • OSD_BACKFILLFULL
  • OSD_NEARFULL
  • POOL_FULL
  • POOL_BACKFILLFULL

Note: A cluster can also enter HEALTH_ERR and block client I/O for reasons that have nothing to do with capacity, for example inactive PGs. This procedure does not address those conditions. Run ceph health detail and continue only if the health checks it reports are the capacity checks listed above:

$ ceph health detail
HEALTH_ERR 32 backfillfull osd(s); 1 full osd(s); 19 nearfull osd(s); 1 pool(s) backfillfull; 5 pool(s) full
[WRN] OSD_BACKFILLFULL: 32 backfillfull osd(s)
osd.14 is backfill full
...
[ERR] OSD_FULL: 1 full osd(s)
osd.30 is full
[WRN] OSD_NEARFULL: 19 nearfull osd(s)
osd.8 is near full
...
[WRN] POOL_BACKFILLFULL: 1 pool(s) backfillfull
pool 'ceph-objectstore-3.rgw.buckets.data' is backfillfull
[WRN] POOL_FULL: 5 pool(s) full
pool '.mgr' is full (no space)
pool 'ceph-objectstore-3.rgw.buckets.data' is full (no space)
...

Solution​

Step 1: Raise full_ratio temporarily to unblock I/O​

Raise full_ratio slightly, for example to 0.97:

$ ceph osd set-full-ratio .97

This unblocks client I/O, but only buys a small amount of headroom. For an explanation of the ratios, see Discussion.

Warning: When clients start writing again, they can consume the remaining space quickly. Treat the raised ratio as a temporary measure: move on to Step 2 immediately and set full_ratio back to its default value as described in Step 3.

Step 2: Find the cause​

The fix depends on whether data is spread evenly across the OSDs. Check per-OSD utilization:

$ ceph osd df

The OSDs are unbalanced​

If some OSDs are much fuller than others, a few OSDs can hit full_ratio while the cluster as a whole still has free space. Turn on the balancer in upmap mode and set upmap_max_deviation to 1:

$ ceph balancer mode upmap
$ ceph config set mgr mgr/balancer/upmap_max_deviation 1
$ ceph balancer on

Monitor progress with ceph osd df and ceph health detail until the OSD_FULL and backfillfull warnings clear.

The pools are evenly full​

If utilization is even across the OSDs, the cluster has run out of capacity. In the output of ceph df, full pools show %USED of 100.00 and MAX AVAIL of 0 B:

$ ceph df
--- RAW STORAGE ---
CLASS SIZE AVAIL USED RAW USED %RAW USED
hdd 663 TiB 79 TiB 584 TiB 584 TiB 88.12
nvme 26 TiB 26 TiB 65 GiB 65 GiB 0.24
TOTAL 689 TiB 105 TiB 584 TiB 584 TiB 84.78

--- POOLS ---
POOL ID PGS STORED OBJECTS USED %USED MAX AVAIL
.mgr 1 4 4.6 MiB 2 18 MiB 100.00 0 B
ceph-objectstore-3.rgw.buckets.data 2 1024 192 TiB 69.51M 576 TiB 100.00 0 B
...

To fix this, either:

  • Delete data that is no longer needed, for example duplicated or already backed-up data. Do this as soon as possible after unblocking I/O.
  • If you cannot delete enough data, add capacity: extend the cluster with additional hardware, or bring offline hardware back online.

Monitor progress:

$ ceph df
$ ceph health detail

Step 3: Set full_ratio back to its default value​

When the cause of HEALTH_ERR has been fixed and OSD utilization is back below the default thresholds, run the following command to set full_ratio back to its default so that the cluster is protected again:

$ ceph osd set-full-ratio .95

Discussion​

How Ceph's full ratios work​

Ceph protects stored data by refusing writes before any OSD runs completely out of space. It does not wait for the whole cluster to fill: as soon as a single OSD reaches the full threshold, client I/O to the pools that use that OSD is blocked. This means a cluster with plenty of free raw capacity overall can still stop serving writes if only a single OSD is full.

The thresholds are configurable ratios of each OSD's capacity. As you can see, they represent eighty-five, ninety, and ninety-five percent of OSD capacity, respectively:

RatioDefaultEffect when an OSD crosses it
nearfull_ratio0.85Ceph raises the OSD_NEARFULL warning.
backfillfull_ratio0.9Ceph raises OSD_BACKFILLFULL.
full_ratio0.95Ceph raises OSD_FULL and blocks client I/O.

To see the current values of these ratios, run the following command:

$ ceph osd dump | grep ratio
full_ratio 0.95
backfillfull_ratio 0.9
nearfull_ratio 0.85