Attaching volumes to an instance – OpenStack

For VM instances, volumes provide additional storage. You might think of them as an external storage device that you can attach and detach from your virtual machine as needed, similar to a hard drive or a USB drive. The steps for attaching volumes to an Openstack-based instance are discussed in this article.

This procedure details the steps involved in attaching a Cinder volume to an existing to compute instance using the cinder and nova command-line interfaces.
Now that we have a usable volume, we can attach this to any instance. We do this by using the nova volume-attach command in Nova Client.

If you would like to become an OpenStack Certified professional, then visit Mindmajix - A Global online training platform:" OpenStack Certification Training Course ". This course will help you to achieve excellence in this domain.

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

Getting ready

Steps to Attach Volumes to an Instance using Nova Client

Carry out the following steps to attach a volume to an instance using Nova Client:

  • If you have no instance running, spin one up. Once running, run the nova list command and note the instance ID.
instance ID

MindMajix YouTube Channel

The following output is generated:

instance ID 1
  • Using the instance ID, we can attach the volume to our running instance, as follows
  • The preceding command will output the name of the volume when successful. To view this, log in to your running instance and view the volume that is now attached:   

 view the log                                                                                                                                                                                                                                                                                                           

  • We should see 1 GB of space available for the running instance. As this is like adding a fresh disk to a system you need to format it for use and then mount it as part of your filesystem.
adding a fresh disk
Related Article: OpenStack Tutorial

Attaching a Cinder-Volume

Attaching a cinder-volume is no different from plugging in a USB stick on your own computer—we attach it, (optionally) format it, and mount it.
Under Nova Client, the option volume-attach takes the following syntax:

nova volume-attach instance_id volume_id device

instance_ id is the ID returned from the nova list for the instance that we want to attach the volume to. The volume_id is the name of the device within the instance that we will use to mount the volume that can be retrieved using nova volume-list. This device is the device that will be created on our instance that we use to mount the volume.

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 TrainingNov 23 to Dec 08View Details
OpenStack TrainingNov 26 to Dec 11View Details
OpenStack TrainingNov 30 to Dec 15View Details
OpenStack TrainingDec 03 to Dec 18View Details
Last updated: 03 Apr 2023
About Author

I am Ruchitha, working as a content writer for MindMajix technologies. My writings focus on the latest technical software, tutorials, and innovations. I am also into research about AI and Neuromarketing. I am a media post-graduate from BCU – Birmingham, UK. Before, my writings focused on business articles on digital marketing and social media. You can connect with me on LinkedIn.

read less
  1. Share:
OpenStack Articles