Hurry! 20% Off Ends SoonRegister Now

OpenStack – Detaching volumes from an instance

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.

How to detach Volume from an Instance

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:

Getting started

Steps to detach a volume using Nova client

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:

MindMajix YouTube Channel

Related Article: OpenStack Interview Questions for Experienced
How to do it
  • 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

  • We are now free to attach this to another running instance, with data preserved.
Related Article: Learn OpenStack

Detaching Cinder Volume

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 the volume id column from the nova volume-list command.

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

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
OpenStack TrainingDec 24 to Jan 08View Details
OpenStack TrainingDec 28 to Jan 12View Details
OpenStack TrainingDec 31 to Jan 15View Details
OpenStack TrainingJan 04 to Jan 19View Details
Last updated: 03 Apr 2023
About Author

Ravindra Savaram is a Technical Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.

read less
  1. Share:
OpenStack Articles