1 .. _ceph-volume-simple-scan:
5 Scanning allows to capture any important details from an already-deployed OSD
6 so that ``ceph-volume`` can manage it without the need of any other startup
7 workflows or tools (like ``udev`` or ``ceph-disk``). Encryption with LUKS or
8 PLAIN formats is fully supported.
10 The command has the ability to inspect a running OSD, by inspecting the
11 directory where the OSD data is stored, or by consuming the data partition.
12 The command can also scan all running OSDs if no path or device is provided.
14 Once scanned, information will (by default) persist the metadata as JSON in
15 a file in ``/etc/ceph/osd``. This ``JSON`` file will use the naming convention
16 of: ``{OSD ID}-{OSD FSID}.json``. An OSD with an id of 1, and an FSID like
17 ``86ebd829-1405-43d3-8fd6-4cbc9b6ecf96`` the absolute path of the file would
20 /etc/ceph/osd/1-86ebd829-1405-43d3-8fd6-4cbc9b6ecf96.json
22 The ``scan`` subcommand will refuse to write to this file if it already exists.
23 If overwriting the contents is needed, the ``--force`` flag must be used::
25 ceph-volume simple scan --force {path}
27 If there is no need to persist the ``JSON`` metadata, there is support to send
28 the contents to ``stdout`` (no file will be written)::
30 ceph-volume simple scan --stdout {path}
33 .. _ceph-volume-simple-scan-directory:
37 Using this command without providing an OSD directory or device will scan the
38 directories of any currently running OSDs. If a running OSD was not created
39 by ceph-disk it will be ignored and not scanned.
41 To scan all running ceph-disk OSDs, the command would look like::
43 ceph-volume simple scan
47 The directory scan will capture OSD file contents from interesting files. There
48 are a few files that must exist in order to have a successful scan:
57 If the OSD is encrypted, it will additionally add the following keys:
63 In the case of any other file, as long as it is not a binary or a directory, it
64 will also get captured and persisted as part of the JSON object.
66 The convention for the keys in the JSON object is that any file name will be
67 a key, and its contents will be its value. If the contents are a single line
68 (like in the case of the ``whoami``) the contents are trimmed, and the newline
69 is dropped. For example with an OSD with an id of 1, this is how the JSON entry
74 For files that may have more than one line, the contents are left as-is, except
75 for keyrings which are treated specially and parsed to extract the keyring. For
76 example, a ``keyring`` that gets read as::
78 [osd.1]\n\tkey = AQBBJ/dZp57NIBAAtnuQS9WOS0hnLVe0rZnE6Q==\n
82 "keyring": "AQBBJ/dZp57NIBAAtnuQS9WOS0hnLVe0rZnE6Q==",
85 For a directory like ``/var/lib/ceph/osd/ceph-1``, the command could look
88 ceph-volume simple scan /var/lib/ceph/osd/ceph1
91 .. _ceph-volume-simple-scan-device:
95 When an OSD directory is not available (OSD is not running, or device is not
96 mounted) the ``scan`` command is able to introspect the device to capture
97 required data. Just like :ref:`ceph-volume-simple-scan-directory`, it would
98 still require a few files present. This means that the device to be scanned
99 **must be** the data partition of the OSD.
101 As long as the data partition of the OSD is being passed in as an argument, the
102 sub-command can scan its contents.
104 In the case where the device is already mounted, the tool can detect this
105 scenario and capture file contents from that directory.
107 If the device is not mounted, a temporary directory will be created, and the
108 device will be mounted temporarily just for scanning the contents. Once
109 contents are scanned, the device will be unmounted.
111 For a device like ``/dev/sda1`` which **must** be a data partition, the command
114 ceph-volume simple scan /dev/sda1
117 .. _ceph-volume-simple-scan-json:
121 The contents of the JSON object is very simple. The scan not only will persist
122 information from the special OSD files and their contents, but will also
123 validate paths and device UUIDs. Unlike what ``ceph-disk`` would do, by storing
124 them in ``{device type}_uuid`` files, the tool will persist them as part of the
127 For example, a ``block.db`` device would look something like::
130 "path": "/dev/disk/by-partuuid/6cc43680-4f6e-4feb-92ff-9c7ba204120e",
131 "uuid": "6cc43680-4f6e-4feb-92ff-9c7ba204120e"
134 But it will also persist the ``ceph-disk`` special file generated, like so::
136 "block.db_uuid": "6cc43680-4f6e-4feb-92ff-9c7ba204120e",
138 This duplication is in place because the tool is trying to ensure the
141 # Support OSDs that may not have ceph-disk special files
142 # Check the most up-to-date information on the device, by querying against LVM
144 # Support both logical volumes and GPT devices
146 This is a sample ``JSON`` metadata, from an OSD that is using ``bluestore``::
151 "path": "/dev/disk/by-partuuid/40fd0a64-caa5-43a3-9717-1836ac661a12",
152 "uuid": "40fd0a64-caa5-43a3-9717-1836ac661a12"
155 "path": "/dev/disk/by-partuuid/6cc43680-4f6e-4feb-92ff-9c7ba204120e",
156 "uuid": "6cc43680-4f6e-4feb-92ff-9c7ba204120e"
158 "block.db_uuid": "6cc43680-4f6e-4feb-92ff-9c7ba204120e",
159 "block_uuid": "40fd0a64-caa5-43a3-9717-1836ac661a12",
161 "ceph_fsid": "c92fc9eb-0610-4363-aafc-81ddf70aaf1b",
162 "cluster_name": "ceph",
165 "uuid": "86ebd829-1405-43d3-8fd6-4cbc9b6ecf96"
167 "fsid": "86ebd829-1405-43d3-8fd6-4cbc9b6ecf96",
168 "keyring": "AQBBJ/dZp57NIBAAtnuQS9WOS0hnLVe0rZnE6Q==",
169 "kv_backend": "rocksdb",
170 "magic": "ceph osd volume v026",