# Capacity and full-ratio planner

*HTML: https://book.ceph-s3.ir/en/lab-capacity.html*
*Licence: CC BY-NC-SA 4.0. Author: Ramin Najarbashi.*

[Interactive lab](lab.html)Capacity and full-ratio planner
In the book: [Chapter 7](07-cluster-operations.html#sec-07-9-4)
LabCapacity and full-ratio plannerGive hosts, OSDs, the pool type and the data stored: see MAX AVAIL, which OSD sets that limit, and which OSDs a lost host pushes past nearfull, backfillfull and full.**72 TiB**raw capacity in service**72 TiB**raw space used**0 TiB**MAX AVAIL of this pool**100.0%**fullest OSDFill of each OSD (bars) against nearfull, backfillfull and full (lines). Green: normal; amber: nearfull; orange: backfillfull; red: full; grey: the lost host. ▼ marks the OSD that sets MAX AVAIL.**HEALTH_ERR** OSD_FULL: 9 full OSD(s); writes to their pools stopMAX AVAIL = min over OSDs ( (kb_avail − kb × (1 − full_ratio)) × 1024 / wi ) / raw_used_rate, wi = crush_weighti / Σ crush_weight · raw_used_rate = 3 OSD state: ratio > failsafe → FAILSAFE · > full → FULL · > backfillfull → BACKFILLFULL · > nearfull → NEARFULLMAX AVAIL comes from the OSD that is fullest for its weight, not from the average. One unbalanced OSD, or one bigger OSD in a small host, limits the whole pool; the balancer (chapter 8) and OSDs of equal size help most.Follows:`src/mon/PGMap.cc :: get_rule_avail, dump_object_stat_sum (max_avail = avail / raw_used_rate)` the smallest writable space divided by the weight share`src/crush/CrushWrapper.cc :: get_rule_weight_osd_map, _get_take_weight_osd_map, _normalize_weight_map` the float weight of each OSD under the rule's take`src/osd/OSD.cc :: OSDService::recalc_full_state` the order of the failsafe, full, backfillfull and nearfull checks`src/osd/OSDMap.cc :: check_health (OSD_NEARFULL, OSD_BACKFILLFULL, OSD_FULL), pool_raw_used_rate` the health check names and raw_used_rate`src/common/options/global.yaml.in :: mon_osd_nearfull_ratio (0.85), mon_osd_backfillfull_ratio (0.90), mon_osd_full_ratio (0.95), osd_failsafe_full_ratio (0.97)` the default ratiosA fixed snapshot of the simulator; the interactive version is in the web edition's lab. [Interactive lab: Capacity and full-ratio planner](lab-capacity.html)The interactive version needs JavaScript; this is a fixed snapshot.
