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 client
  • An openrc file with appropriate credentials for the environment
  • The 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 ...

Get OpenStack Cloud Computing Cookbook - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.