3 ==============================================
4 ceph-dencoder -- ceph encoder/decoder utility
5 ==============================================
7 .. program:: ceph-dencoder
12 | **ceph-dencoder** [commands...]
18 **ceph-dencoder** is a utility to encode, decode, and dump ceph data
19 structures. It is used for debugging and for testing inter-version
22 **ceph-dencoder** takes a simple list of commands and performs them
30 Print the version string for the **ceph-dencoder** binary.
32 .. option:: import <file>
34 Read a binary blob of encoded data from the given file. It will be
35 placed in an in-memory buffer.
37 .. option:: export <file>
39 Write the contents of the current in-memory buffer to the given
42 .. option:: list_types
44 List the data types known to this build of **ceph-dencoder**.
46 .. option:: type <name>
48 Select the given type for future ``encode`` or ``decode`` operations.
50 .. option:: skip <bytes>
52 Seek <bytes> into the imported file before reading data structure, use
53 this with objects that have a preamble/header before the object of interest.
57 Decode the contents of the in-memory buffer into an instance of the
58 previously selected type. If there is an error, report it.
62 Encode the contents of the in-memory instance of the previously
63 selected type to the in-memory buffer.
67 Print a JSON-formatted description of the in-memory object.
69 .. option:: count_tests
71 Print the number of built-in test instances of the previosly
72 selected type that **ceph-dencoder** is able to generate.
74 .. option:: select_test <n>
76 Select the given build-in test instance as a the in-memory instance
79 .. option:: get_features
81 Print the decimal value of the feature set supported by this version
82 of **ceph-dencoder**. Each bit represents a feature. These correspond to
83 CEPH_FEATURE_* defines in src/include/ceph_features.h.
85 .. option:: set_features <f>
87 Set the feature bits provided to ``encode`` to *f*. This allows
88 you to encode objects such that they can be understood by old
89 versions of the software (for those types that support it).
94 Say you want to examine an attribute on an object stored by ``ceph-osd``. You can do this:
98 $ cd /mnt/osd.12/current/2.b_head
99 $ attr -l foo_bar_head_EFE6384B
100 Attribute "ceph.snapset" has a 31 byte value for foo_bar_head_EFE6384B
101 Attribute "ceph._" has a 195 byte value for foo_bar_head_EFE6384B
102 $ attr foo_bar_head_EFE6384B -g ceph._ -q > /tmp/a
103 $ ceph-dencoder type object_info_t import /tmp/a decode dump_json
104 { "oid": { "oid": "foo",
109 "locator": { "pool": 2,
114 "prior_version": "0'0",
115 "last_reqid": "client.4116.0:1",
117 "mtime": "2012-02-21 08:58:23.666639",
119 "wrlock_by": "unknown.0.0:0",
125 Alternatively, perhaps you wish to dump an internal CephFS metadata object, you might
130 $ rados -p metadata get mds_snaptable mds_snaptable.bin
131 $ ceph-dencoder type SnapServer skip 8 import mds_snaptable.bin decode dump_json
132 { "snapserver": { "last_snap": 1,
136 "pending_create": [],
137 "pending_destroy": []}}
143 **ceph-dencoder** is part of Ceph, a massively scalable, open-source, distributed storage system. Please
144 refer to the Ceph documentation at http://ceph.com/docs for more
151 :doc:`ceph <ceph>`\(8)