zaro

How Do I Remove a Pool from My Ceph?

Published in Ceph Pool Management 3 mins read

To successfully remove a pool from your Ceph cluster, you must first enable the mon_allow_pool_delete flag in your monitor's configuration; otherwise, the monitors will refuse the deletion request.

Deleting a Ceph pool is a critical operation that results in permanent data loss from that pool. Always ensure you have backed up any necessary data before proceeding.

Pre-Requisite: Enabling Pool Deletion

Before you can delete any pool, Ceph's monitors are configured by default to prevent accidental pool deletion. You need to explicitly allow this operation.

  1. Set mon_allow_pool_delete to true:
    • This flag must be set in the monitor's configuration.
    • You can set it temporarily for the current session or permanently in the Ceph configuration file (ceph.conf).
    • Temporary (for the current session, safest for one-off operations):
      ceph config set mon mon_allow_pool_delete true
    • Permanent (by editing ceph.conf on your monitor nodes):
      Add or modify the following line under the [mon] section:
      [mon]
          mon_allow_pool_delete = true

      After modifying ceph.conf, you might need to restart your Ceph monitors for the change to take effect (e.g., systemctl restart ceph-mon@<hostname>). However, using ceph config set is generally preferred as it's dynamic and doesn't require restarts.

Steps to Remove a Ceph Pool

Once mon_allow_pool_delete is set to true, you can proceed with the deletion.

  1. Verify the Pool Name:
    Ensure you know the exact name of the pool you intend to delete. You can list existing pools with:

    ceph osd lspools
  2. Execute the Deletion Command:
    Use the ceph osd pool delete command. Ceph requires you to type the pool name twice and include a confirmation flag for safety.

    Step Command/Action Description
    1 ceph config set mon mon_allow_pool_delete true Temporarily enables pool deletion.
    2 ceph osd pool delete <pool-name> <pool-name> --yes-i-really-really-mean-it Executes the deletion. Replace <pool-name> with the actual name of your pool.
    3 ceph config set mon mon_allow_pool_delete false Crucially, disable pool deletion immediately after the operation to prevent accidental deletions.

    Example: To delete a pool named my_old_pool:

    ceph osd pool delete my_old_pool my_old_pool --yes-i-really-really-mean-it

Post-Deletion Considerations

  • Delete Custom Rules: If the pool you removed had custom CRUSH rules associated with it that are no longer needed by any other pools, consider deleting those rules as well to keep your Ceph configuration clean. You can list existing rules using ceph osd crush rule ls.
  • Disable mon_allow_pool_delete: It is highly recommended to set mon_allow_pool_delete back to false immediately after deleting the pool to prevent accidental future deletions.
    ceph config set mon mon_allow_pool_delete false

Important Notes

  • Data Loss: Deleting a pool is irreversible and will permanently destroy all data stored within it.
  • Dependent Objects: Ensure no applications, RBD images, or RGW buckets are still using the pool you intend to delete. Terminate all client I/O to the pool beforehand.
  • Monitor Configuration: For more detailed information on monitor configuration, consult the Ceph documentation on Monitor Configuration. (Note: This is a placeholder link; refer to the official Ceph documentation for the exact URL).