> 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/how-to/how-to-migrate-volumes-using-cli.md).

# How-To Migrate Volumes Using CLI

## Problem

### You want to migrate volumes from one Cinder pool to another pool.

## Environment

* Platform9 Managed OpenStack - All Versions
* Cinder

## Answer

There are two major scenarios for which volume migration is supported in Cinder:

1. Migration between two back-ends with the same volume type, regardless if they are located on the same cinder-volume host or not.

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

```none
cinder migrate [--force-host-copy [[True|False]]] [--lock-volume [[True|False]]] [volume] [host]

Mandatory arguments:  
[volume] ID of volume to migrate.  
[host]Destination host.The format of host is host@backend#POOL, while 'host' is the host name of the volume node, 'backend' is the back-end name and 'POOL' is a logical concept to describe a set of storage resource, residing in the back-end. If the back-end does not have specified pools, 'POOL' needs to be set with the same name as 'backend'.

Optional arguments:  
--force-host-copy [[True|False]] Enables or disables generic host-based force-migration,which bypasses the driver optimization.Default=False.  
--lock-volume [[True|False]] Enables or disables the termination of volume migration caused by other commands. This option applies to the available volume. True means it locks the volume state and does not allow the migration to be aborted. The volume status will be in maintenance during the migration. False means it allows the volume migration to be aborted. The volume status is still in the original status. Default=False.
```

{% endtab %}
{% endtabs %}

**Note**: Currently, error handling for failed migration operations is under development in Cinder. If you would like the volume migration to finish without any interruption, please set **–-lock-volume** to **True**. If it is set to **False**, Openstack cannot predict what will happen, if other actions like attach, detach, extend, etc, are issued on the volume during the migration. It all depends on which stage the volume migration has reached and when the request for another action comes.

2. Migration between two back-ends with different volume types, regardless if the back-ends are located on the same cinder-volume host or not. Here, the source volume type and destination volume type must be different and they must refer to different back-ends.

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

```none
cinder retype --migration-policy on-demand
                  [volume] [volume-type]
    Mandatory arguments:
      [volume]              Name or ID of volume for which to modify type.
      [volume-type]         New volume type.
```

{% endtab %}
{% endtabs %}

## Additional Information

Please refer to the official document for more information.

[Volume Migration via CLI](https://docs.openstack.org/cinder/rocky/contributor/migration.html).


---

# 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/how-to/how-to-migrate-volumes-using-cli.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.
