> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmo/frequently-asked-questions/how-to-calculate-the-block-storage-usage-in-openstack.md).

# How to calculate the block storage usage in Openstack

## Problem

* How to calculate the block storage usage, free/total capacity, and oversubscription ratio using OpenStack Cinder metrics.

{% hint style="info" %}
**Info**

This article explains how to calculate the block storage usage from `cinder get-pools --detail` in OpenStack. It is applicable for **any Cinder backend** (e.g., Ceph, HPE 3PAR, NetApp, etc.) and helps you interpret key metrics related to block storage usage, provisioning, and backend status.
{% endhint %}

## Environment

* Platform9 Managed OpenStack - v4.0 and Higher
* Cinder

## Key Terms

| Term                       | Description                                                                                           |
| -------------------------- | ----------------------------------------------------------------------------------------------------- |
| Total Capacity             | Physical capacity of the backend storage.                                                             |
| Allocated Capacity         | Actual space used on the backend storage (physical usage).                                            |
| Free Capacity              | Unused portion of physical storage.                                                                   |
| Provisioned Capacity       | Total logical volume size requested by users. May exceed physical space if thin provisioning is used. |
| Oversubscription Ratio     | How much logical capacity is provisioned relative to what's physically used.                          |
| Max Oversubscription Ratio | Configured upper limit of how much Cinder is allowed to oversubscribe the backend.                    |

## Answer

* Source admin.rc file.

{% tabs %}
{% tab title="Bash" %}

```bash
$ source admin.rc
```

{% endtab %}
{% endtabs %}

* Run below command to list all the available cinder pools.

{% tabs %}
{% tab title="Bash" %}

```bash
$ cinder get-pools --detail
```

{% endtab %}
{% endtabs %}

* Example output for Cinder with **Ceph** as backend storage.

{% tabs %}
{% tab title="Bash" %}

```bash
$ cinder get-pools --detail

+-----------------------------+-------------------------------------------------------------------+
| Property                    | Value                                                             |
+-----------------------------+-------------------------------------------------------------------+
| allocated_capacity_gb       | 3132                                                              |
| backend_state               | up                                                                |
| driver_version              | [VERSION]                                                         |
| filter_function             | None                                                              |
| free_capacity_gb            | 36527.21                                                          |
| goodness_function           | None                                                              |
| location_info               | [LOCATION_INFO]                                                   |
| max_over_subscription_ratio | 20.0                                                              |
| multiattach                 | True                                                              |
| name                        | [CINDER_POOL_NAME]                                                |
| provisioned_capacity_gb     | 4532                                                              |
| replication_enabled         | False                                                             |
| reserved_percentage         | 0                                                                 |
| storage_protocol            | ceph                                                              |
| thin_provisioning_support   | True                                                              |
| timestamp                   | [TIMESTAMP]                                                       |
| total_capacity_gb           | 103680.78                                                         |
| vendor_name                 | Open Source                                                       |
| volume_backend_name         | ceph1                                                             |
+-----------------------------+-------------------------------------------------------------------+
.. more
```

{% endtab %}
{% endtabs %}

## Calculations

1. Allocated Capacity (Physical Usage)

{% tabs %}
{% tab title="Text" %}

```bash
total_allocated_capacity_gb = sum of allocated_capacity_gb of all cinder pools
```

{% endtab %}
{% endtabs %}

2. Provisioned Capacity (Logical Usage)

{% tabs %}
{% tab title="Text" %}

```bash
total_provisioned_capacity_gb = sum of provisioned_capacity_gb of all cinder pools
```

{% endtab %}
{% endtabs %}

3. Oversubscription Ratio (Actual)

{% tabs %}
{% tab title="Text" %}

```bash
oversubscription_ratio = total_provisioned_capacity_gb / total_allocated_capacity_gb
```

{% endtab %}
{% endtabs %}

4. Free and Total Capacity
   * If all the cinder pools use same backend storage pool.

{% tabs %}
{% tab title="Text" %}

```bash
grand_total_capacity_gb = total_capacity_gb of any one pool
total_free_capacity_gb  = free_capacity_g of any one pool
```

{% endtab %}
{% endtabs %}

```
- If cinder pools use different backend storage pools.
```

{% tabs %}
{% tab title="Text" %}

```bash
grand_total_capacity_gb = sum of total_capacity_gb of all pools
total_free_capacity_gb  = sum of free_capacity_gb of all pools
```

{% endtab %}
{% endtabs %}

5. Maximum Provisioned Capacity Allowed

{% tabs %}
{% tab title="Text" %}

```bash
max_allowed_provisioned_capacity = grand_total_capacity_gb × max_over_subscription_ratio
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://platform9.com/kb/pmo/frequently-asked-questions/how-to-calculate-the-block-storage-usage-in-openstack.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
