cephadm commands

The cephadm is a command line tool to manage the local host for the cephadm Orchestrator. It provides commands to investigate and modify the state of the current host.

Some of the commands are generally used for debugging.
Note: cephadm is not required on all hosts, however, it is useful when investigating a particular daemon. The cephadm-ansible-preflight playbook installs cephadm on all hosts and the cephadm-ansible purge playbook requires cephadm be installed on all hosts to work properly.
Table 1. The cephadm commands
Command Description Syntax Example
adopt

Convert an upgraded storage cluster daemon to run cephadm.

cephadm adopt [-h] --name DAEMON_NAME --style STYLE [--cluster CLUSTER] --legacy-dir [LEGACY_DIR] --config-json CONFIG_JSON] [--skip-firewalld] [--skip-pull]
[root@host01 ~]# cephadm adopt --style=legacy --name prometheus.host02
ceph-volume This command is used to list all the devices on the particular host. Run the ceph-volume command inside a container Deploys OSDs with different device technologies like lvm or physical disks using pluggable tools and follows a predictable, and robust way of preparing, activating, and starting OSDs.
cephadm ceph-volume inventory/simple/raw/lvm [-h] [--fsid FSID] [--config-json CONFIG_JSON] [--config CONFIG, -c CONFIG] [--keyring KEYRING, -k KEYRING]
[root@host01 ~]# cephadm ceph-volume inventory --fsid f64f341c-655d-11eb-8778-fa163e914bcc
check-host Check the host configuration that is suitable for a Ceph cluster.
cephadm check-host [--expect-hostname HOSTNAME]
[root@host01 ~]# cephadm check-host --expect-hostname host02
deploy Deploys a daemon on the local host.
cephadm shell deploy DAEMON_TYPE [-h] [--name DAEMON_NAME] [--fsid FSID] [--config CONFIG, -c CONFIG] [--config-json CONFIG_JSON] [--keyring KEYRING] [--key KEY] [--osd-fsid OSD_FSID] [--skip-firewalld] [--tcp-ports TCP_PORTS] [--reconfig] [--allow-ptrace] [--memory-request MEMORY_REQUEST] [--memory-limit MEMORY_LIMIT] [--meta-json META_JSON]
[root@host01 ~]# cephadm shell deploy mon --fsid f64f341c-655d-11eb-8778-fa163e914bcc
enter Run an interactive shell inside a running daemon container.
cephadm enter [-h] [--fsid FSID] --name NAME [command [command …]]
[root@host01 ~]# cephadm enter --name 52c611f2b1d9
help View all the commands supported by cephadm.
cephadm help
[root@host01 ~]# cephadm help
install Install the packages.
cephadm install PACKAGES
[root@host01 ~]# cephadm install ceph-common ceph-osd
inspect-image Inspect the local Ceph container image.
cephadm --image IMAGE_ID inspect-image
[root@host01 ~]# cephadm --image 13ea90216d0be03003d12d7869f72ad9de5cec9e54a27fd308e01e467c0d4a0a inspect-image
list-networks List the IP networks.
cephadm list-networks
[root@host01 ~]# cephadm list-networks
ls List daemon instances known to cephadm on the hosts. You can use --no-detail for the command to run faster, which gives details of the daemon name, fsid, style, and systemd unit per daemon. You can use --legacy-dir option to specify a legacy base directory to search for daemons.
cephadm ls [--no-detail] [--legacy-dir LEGACY_DIR]
[root@host01 ~]# cephadm ls --no-detail
logs Print journald logs for a daemon container. This is similar to the journalctl command.
cephadm logs [--fsid FSID] --name DAEMON_NAME
cephadm logs [--fsid FSID] --name DAEMON_NAME -- -n NUMBER # Last N lines
cephadm logs [--fsid FSID] --name DAEMON_NAME -- -f # Follow the logs
[root@host01 ~]# cephadm logs --fsid 57bddb48-ee04-11eb-9962-001a4a000672 --name osd.8
[root@host01 ~]# cephadm logs --fsid 57bddb48-ee04-11eb-9962-001a4a000672 --name osd.8 -- -n 20
[root@host01 ~]# cephadm logs --fsid 57bddb48-ee04-11eb-9962-001a4a000672 --name osd.8 -- -f
prepare-host Prepare a host for cephadm.
cephadm prepare-host [--expect-hostname HOSTNAME]
[root@host01 ~]# cephadm prepare-host
[root@host01 ~]# cephadm prepare-host --expect-hostname host01
pull Pull the Ceph image.
cephadm [-h] [--image IMAGE_ID] pull
[root@host01 ~]# cephadm --image 13ea90216d0be03003d12d7869f72ad9de5cec9e54a27fd308e01e467c0d4a0a pull
registry-login Give cephadm login information for an authenticated registry. cephadm attempts to log the calling host into that registry.
cephadm registry-login --registry-url REGISTRY_URL --registry-username USERNAME --registry-password PASSWORD [--fsid FSID] [--registry-json JSON_FILE]

You can also use a JSON registry file containing the login info formatted as:

cat REGISTRY_FILE

{
 "url":"REGISTRY_URL",
 "username":"REGISTRY_USERNAME",
 "password":"REGISTRY_PASSWORD"
}
[root@host01 ~]# cephadm registry-login --registry-url cp.icr.io/cp --registry-username myuser1 --registry-password mypassword1
[root@host01 ~]# cat registry_file

{
 "url":"cp.icr.io/cp",
 "username":"myuser",
 "password":"mypass"
}

[root@host01 ~]# cephadm registry-login -i registry_file
Give cephadm login information for an authenticated registry. cephadm attempts to log the calling host into that registry.
cephadm registry-login --registry-url REGISTRY_URL --registry-username USERNAME --registry-password PASSWORD [--fsid FSID] [--registry-json JSON_FILE]

You can also use a JSON registry file containing the login info formatted as:

cat REGISTRY_FILE

{
 "url":"REGISTRY_URL",
 "username":"REGISTRY_USERNAME",
 "password":"REGISTRY_PASSWORD"
}
[root@host01 ~]# cephadm registry-login --registry-url cp.icr.io/cp --registry-username myuser1 --registry-password mypassword1
[root@host01 ~]# cat registry_file

{
 "url":"cp.icr.io/cp",
 "username":"myuser",
 "password":"mypass"
}

[root@host01 ~]# cephadm registry-login -i registry_file
rm-daemon Removes a specific daemon instance. Use this command only for debugging or experimental purposes. If you run it directly on the host, cephadm removes the daemon, but the manager module detects the missing service and redeploys it.
cephadm rm-daemon --fsid FSID --name DAEMON_NAME [--force ] [--force-delete-data]
[root@host01 ~]# cephadm rm-daemon --fsid f64f341c-655d-11eb-8778-fa163e914bcc --name osd.8
rm-cluster Removes all daemons from the storage cluster on the host where the command is run. If the Ceph Orchestrator is not paused and the removed daemons belong to managed services, cephadm redeploys them automatically.
cephadm rm-cluster --fsid FSID [--force]
[root@host01 ~]# cephadm rm-cluster --fsid f64f341c-655d-11eb-8778-fa163e914bcc
rm-repo Remove a package repository configuration. This is mainly used for the disconnected installation of IBM Storage Ceph.
cephadm rm-repo [-h]
[root@host01 ~]# cephadm rm-repo
run Run a Ceph daemon, in a container, in the foreground.
cephadm run [--fsid FSID] --name DAEMON_NAME
[root@host01 ~]# cephadm run --fsid f64f341c-655d-11eb-8778-fa163e914bcc --name osd.8
shell Run an interactive shell with access to Ceph commands over the inferred or specified Ceph cluster. You can enter the shell using the cephadm shell command and run all the orchestrator commands within the shell.
cephadm shell  [--fsid FSID] [--name DAEMON_NAME, -n DAEMON_NAME] [--config CONFIG, -c CONFIG] [--mount MOUNT, -m MOUNT] [--keyring KEYRING, -k KEYRING] [--env ENV, -e ENV]
[root@host01 ~]# cephadm shell -- ceph orch ls
[root@host01 ~]# cephadm shell
unit Start, stop, restart, enable, and disable the daemons with this operation. This operates on the daemon’s systemd unit.
cephadm unit [--fsid FSID] --name DAEMON_NAME start/stop/restart/enable/disable
[root@host01 ~]# cephadm unit --fsid f64f341c-655d-11eb-8778-fa163e914bcc --name osd.8 start
version Provides the version of the storage cluster.
cephadm version
[root@host01 ~]# cephadm version