Detaching volumes from an instance
Ordinarily, Cinder volumes can only be attached to one instance at a time. Thus, you need to detach it from one instance before attaching it to another. To detach a volume, we will use another OpenStack client command called openstack server remove volume
.
Getting ready
To detach a volume from an instance, you will need the following:
The
openstack
command-line clientAn
openrc
file with appropriate credentials for the environmentThe name or ID of the volume to detach
The name or ID of the instance to detach the volume from
For our example, these values are as follows:
Volume:
cookbook.volume
Instance:
cookbook.test
Mount point:
/mnt1
How to do it...
Carry out the following steps to detach a volume to an instance using the openstack
client:
List running instances to get the ID of our instance:
List the volumes that are available and
in-use
in our environment:openstack volume list
This will bring back an output like the following. Note that the information provided...