CRUSHTOOL(8)
π CRUSHTOOL π (section 8, bestie)
okay so bestie, buckle up, because we're talking about crushtool β the CRUSH map manipulation tool from Ceph. yes it's a system administration page (section 8, iykyk) and yes it's lowkey iconic. let's get into it π«Ά
β¨ NAME β¨
crushtool β CRUSH map manipulation tool. that's it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
crushtool ( -d map | -c map.txt | --build --num_osds numosds
layer1 ... | --test ) [ -o outfile ]
look at her. four modes, one little tool. main character energy fr fr β¨
π¦ DESCRIPTION π¦
crushtool is a utility that lets you create, compile, decompile and test CRUSH map files. so basically the whole lifecycle, no cap.
CRUSH is a pseudo-random data distribution algorithm that efficiently maps input values (which, in the context of Ceph, correspond to Placement Groups) across a heterogeneous, hierarchically structured device map. the algorithm was originally described in detail in the following paper (although it has evolved some since then, bestie β it's been through things):
http://www.ssrc.ucsc.edu/Papers/weil-sc06.pdf
the tool has four modes of operation. four. count them. π
--compile|-c map.txtβ will compile a plaintextmap.txtinto a binary map file.--decompile|-d mapβ will take the compiledmapand decompile it into a plaintext source file, suitable for editing. (yes it's giving "take it apart and look inside" π)--build --num_osds {num-osds} layer1 ...β will create map with the given layer structure. see below for a detailed explanation. β¬οΈ--testβ will perform a dry run of a CRUSH mapping for a range of input values[--min-x,--max-x](default[0,1023]) which can be thought of as simulated Placement Groups. see below for a more detailed explanation. β¬οΈ
unlike other Ceph tools, crushtool does not accept generic options such as --debug-crush from the command line. they can, however, be provided via the CEPH_ARGS environment variable. for instance, to silence all output from the CRUSH subsystem:
CEPH_ARGS="--debug-crush 0" crushtool ...
π§ RUNNING TESTS WITH --TEST π§
the test mode will use the input crush map ( as specified with -i map ) and perform a dry run of CRUSH mapping or random placement (if --simulate is set ). on completion, two kinds of reports can be created.
- the
--show-...option outputs human readable information on stderr. - the
--output-csvoption creates CSV files that are documented by the--help-outputoption.
note, bestie: each Placement Group (PG) has an integer ID which can be obtained fromceph pg dump(for example PG2.2fmeans pool id 2, PG id 32). the pool and PG IDs are combined by a function to get a value which is given to CRUSH to map it to OSDs.crushtooldoes not know about PGs or pools β it only runs simulations by mapping values in the range[--min-x,--max-x]. she's just doing math, she's not nosy. π
--show-statisticsβ displays a summary of the distribution. for instance:
rule 1 (metadata) num_rep 5 result size == 5: 1024/1024
shows that rule 1 which is named metadata successfully mapped 1024 values to result size == 5 devices when trying to map them to num_rep 5 replicas. when it fails to provide the required mapping, presumably because the number of tries must be increased, a breakdown of the failures is displayed. for instance:
rule 1 (metadata) num_rep 10 result size == 8: 4/1024
rule 1 (metadata) num_rep 10 result size == 9: 93/1024
rule 1 (metadata) num_rep 10 result size == 10: 927/1024
shows that although num_rep 10 replicas were required, 4 out of 1024 values ( 4/1024 ) were mapped to result size == 8 devices only. π
--show-mappingsβ displays the mapping of each value in the range[--min-x,--max-x]. for instance:
CRUSH rule 1 x 24 [11,6]
shows that value 24 is mapped to devices [11,6] by rule 1.
one of the following is required when using the --show-mappings option:
--num-rep- both
--min-repand--max-rep
--num-rep stands for "number of replicas", indicates the number of replicas in a pool, and is used to specify an exact number of replicas (for example --num-rep 5). --min-rep and --max-rep are used together to specify a range of replicas (for example, --min-rep 1 --max-rep 10). pick your fighter, bestie π₯
--show-bad-mappingsβ displays which value failed to be mapped to the required number of devices. for instance:
bad mapping rule 1 x 781 num_rep 7 result [8,10,2,11,6,9]
shows that when rule 1 was required to map 7 devices, it could map only six : [8,10,2,11,6,9]. she tried her best okay π
--show-utilizationβ displays the expected and actual utilization for each device, for each number of replicas. for instance:
device 0: stored : 951 expected : 853.333
device 1: stored : 963 expected : 853.333
...
shows that device 0 stored 951 values and was expected to store 853. implies --show-statistics.
--show-utilization-allβ displays the same as--show-utilizationbut does not suppress output when the weight of a device is zero. implies--show-statistics. (no skipping, we're looking at everyone β¨)--show-choose-triesβ displays how many attempts were needed to find a device mapping. for instance:
0: 95224
1: 3745
2: 2225
..
shows that 95224 mappings succeeded without retries, 3745 mappings succeeded with one attempts, etc. there are as many rows as the value of the --set-choose-total-tries option.
--output-csvβ creates CSV files (in the current directory) containing information documented by--help-output. the files are named after the rule used when collecting the statistics. for instance, if the rule :'metadata'is used, the CSV files will be:
metadata-absolute_weights.csv
metadata-device_utilization.csv
...
the first line of the file shortly explains the column layout. for instance:
metadata-absolute_weights.csv
Device ID, Absolute Weight
0,1
...
--output-name NAMEβ prependNAMEto the file names generated when--output-csvis specified. for instance--output-name FOOwill create files:
FOO-metadata-absolute_weights.csv
FOO-metadata-device_utilization.csv
...
the --set-... options can be used to modify the tunables of the input crush map. the input crush map is modified in memory. for example:
$ crushtool -i mymap --test --show-bad-mappings
bad mapping rule 1 x 781 num_rep 7 result [8,10,2,11,6,9]
could be fixed by increasing the choose-total-tries as follows:
$ crushtool -i mymap --test
--show-bad-mappings --set-choose-total-tries 500
see? fixable. slay. π
ποΈ BUILDING A MAP WITH --BUILD ποΈ
the build mode will generate hierarchical maps. the first argument specifies the number of devices (leaves) in the CRUSH hierarchy. each layer describes how the layer (or devices) preceding it should be grouped.
each layer consists of:
bucket ( uniform | list | tree | straw | straw2 ) size
the bucket is the type of the buckets in the layer (e.g. "rack"). each bucket name will be built by appending a unique number to the bucket string (e.g. "rack0", "rack1"...).
the second component is the type of bucket: straw should be used most of the time.
the third component is the maximum size of the bucket. a size of zero means a bucket of infinite capacity. π
π EXAMPLE π
suppose we have two rows with two racks each and 20 nodes per rack. suppose each node contains 4 storage devices for Ceph OSD Daemons. this configuration allows us to deploy 320 Ceph OSD Daemons. lets assume a 42U rack with 2U nodes, leaving an extra 2U for a rack switch.
to reflect our hierarchy of devices, nodes, racks and rows, we would execute the following:
$ crushtool -o crushmap --build --num_osds 320 \
node straw 4 \
rack straw 20 \
row straw 2 \
root straw 0
# id weight type name reweight
-87 320 root root
-85 160 row row0
-81 80 rack rack0
-1 4 node node0
0 1 osd.0 1
1 1 osd.1 1
2 1 osd.2 1
3 1 osd.3 1
-2 4 node node1
4 1 osd.4 1
5 1 osd.5 1
...
CRUSH rules are created so the generated crushmap can be tested. they are the same rules as the ones created by default when creating a new Ceph cluster. they can be further edited with:
# decompile
crushtool -d crushmap -o map.txt
# edit
emacs map.txt
# recompile
crushtool -c map.txt -o crushmap
decompile, edit, recompile. the little loop that could π
π RECLASSIFY π
the reclassify function allows users to transition from older maps that maintain parallel hierarchies for OSDs of different types to a modern CRUSH map that makes use of the device class feature. for more information, see <https://docs.ceph.com/en/latest/rados/operations/crush-map-edits/#migrating-from-a-legacy-ssd-rule-to-device-classes>.
glow-up arc, honestly. β¨
β EXAMPLE OUTPUT FROM --TEST β
see <https://github.com/ceph/ceph/blob/master/src/test/cli/crushtool/set-choose.t> for sample crushtool --test commands and output produced thereby.
π«Ά AVAILABILITY π«Ά
crushtool is part of Ceph, a massively scalable, open-source, distributed storage system. please refer to the Ceph documentation at <https://docs.ceph.com> for more information.
π SEE ALSO π
ceph<>(8), osdmaptool<>(8),
π AUTHORS π
John Wilkins, Sage Weil, Loic Dachary
π Copyright π
2010-2014, Inktank Storage, Inc. and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0)
okay so that's the whole page bestie, every flag, every default, every [0,1023], nothing skipped, we ate and left no crumbs π₯
this was brought to you by the dev source, version-dated Oct 06, 2026 β so go forth and crush it (literally, it's a CRUSH tool) ππ
β¨
π¦ where this page comes from
- ubuntu stonking: ceph-base 20.2.4+ds1-0ubuntu1 Β· LGPL2.1 (see COPYING-LGPL2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms