# Resize a volume

This tutorial describes steps to resize a <code class="expression">space.vars.product\_name</code> block storage volume.

When using <code class="expression">space.vars.product\_name</code> block storage volumes, it is possible to resize or extend a volume - both in use volume (live resize) as well as volume that is not currently in used can be resized.

## What to Know Before Resizing a Volume

Regardless of how you resize the volume, it's important to note that resizing a volume at the block level does not automatically extend the file system inside the virtual machine. After the underlying block storage volume has been successfully resized, **you must manually perform a file system resize operation** within the virtual machine to utilize the newly allocated disk space.

{% hint style="danger" %}
**Important**

Resizing a volume does not automatically extend the file system inside the VM. You must manually perform a file system resize within the VM to utilize the newly allocated space.
{% endhint %}

## Resizing a Volume via UI

1. Navigate to the Volumes option in the UI
2. Select the volume that needs to be resized.
3. Select 'extend' from the action bar.
4. A popup will appear displaying available options for volume resize.
5. Choose the desired volume size and click extend volume.

## Resizing a Volume via CLI

It’s possible to increase the size of an attached volume using the following command:

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

```bash
openstack volume set --size <NEW_SIZE_IN_GB> <VOLUME_ID>
```

{% endtab %}
{% endtabs %}

Verify that the volume resize operation has been completed successfully by checking the volume status:

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

```bash
openstack volume show <VOLUME_ID>
```

{% endtab %}
{% endtabs %}

### Live Volume Resize

You can also resize attached (in-use) volumes without detaching them, known as **live volume extend**.

Before performing a live volume resize, ensure the following steps are completed on all hosts:

Install **lsscsi** (if not already installed):

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

```bash
sudo apt install -y lsscsi
```

{% endtab %}
{% endtabs %}

Restart the `pf9-hostagent` service:

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

```bash
systemctl restart pf9-ostackhost
```

{% endtab %}
{% endtabs %}

Once the `pf9-hostagent` service is restarted you can use the `openstack` CLI with the `--os-volume-api-version 3.42` (required) to resize the attached volume.

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

```bash
openstack --os-volume-api-version 3.42 volume set --size <NEW_SIZE_IN_GB> <VOLUME_ID>
```

{% endtab %}
{% endtabs %}

Replace `<new_size_in_GB>` and `<volume_id>` with the desired size and the volume ID:

Verify that the volume resize operation has been completed successfully by checking the volume status:

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

```bash
openstack volume show <VOLUME_ID>
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
**Important**

Resizing the volume does not automatically extend the file system inside the VM. You must manually perform a file system resize within the VM to utilize the newly allocated space.
{% endhint %}

## Log Files

See [Log Files](https://docs.platform9.com/private-cloud-director/virtualized-clusters/add-hosts-virtualized-cluster#log-files) for locations of important log files, including the storage service logs.


---

# Agent Instructions: 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:

```
GET https://docs.platform9.com/private-cloud-director/tutorials/resize-a-volume.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
