Mindmajix

OpenStack – Detaching volumes from an instance

Since Cinder Volumes are persistent storage and the best way of thinking of them is as a USB drive, this means that you can only attach them to a single computer at a time. When you remove a USB drive from the computer, you can then move it to another one and attach it. The same principle works with Nova Volumes. To detach a volume, we use another Nova Client option volume-detach.

Getting started

To begin with, ensure you are logged into the Ubuntu client that has access to Nova Client tools. These packages can be installed using the following commands:

sudo apt-get update
sudo apt-get install python-novaclient

How to do it…

Carry out the following steps to detach a volume using Nova Client:

  • First, we identify the volumes attached to running instances, by running the command nova volume-list, as follows:
nova volume-list
  • This brings back the following output:

Screenshot_635

  • On the instance that has the volume mounted, we must first unmount it as follows (if using the example before, this is on /mnt1):
sudo unmount /mnt1
  • Back on the Ubuntu client, where Nova Client is installed, we can now detach this volume as follows:
nova volume-detach <instance_id> <volume_id>
  • We are now free to attach this to another running instance, with data preserved.

How it works…

Detaching cinder-volume is no different from removing a USB stick from a computer. We first unmount the volume from our running instance. Then, we detach the volume from the running instance using nova volume-detach from Nova Client.

nova volume-detach has the following syntax:

nova volume-detach instance_id volume_id

instance_id is the ID from the Attached to column returned from nova volume-list for the instance we want to detach the volume from volume id column from the nova volume-list command.

 

http://docs.openstack.org/user-guide/dashboard_manage_volumes.html


 

0 Responses on OpenStack – Detaching volumes from an instance"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.