Creating volumes In OpenStack
Recommended by 0 users
On Cinder, a drive is called a volume. The first thing you need to do is to create a new volume in the region you want. They are block storage devices that you attach to instances to enable persistent storage. You can attach a volume to a running instance, or detach a volume and attach it to another instance at any time.
Now that we have created a Cinder volume service, we can create volumes for use by our instances. We do this under our Ubuntu client using one of the Cinder Client tool, aka the python-Cinderclient, so we are creating volumes specific to our tenancy (project).
To begin with, ensure that you are logged into your Ubuntu client that has access to the Cinder Client tools. These packages can be installed using the following command:
sudo apt-get update
sudo apt-get install python-cinderclient
How to do it…
Carry out the following to create a volume using Cinder Client:
1. First, create the volume that we will attach to our instance.
# Source in our OpenStack Nova credentials
cinder create --display-name cookbook 1
2. On completion, the command returns the following output:
How it works…
Creating Cinder-volumes for use within our project, cookbook, is very straightforward.
With Cinder Client, we use the create option with the following syntax:
cinder create --display_name volume_name size_Gb
Here, volume_name can be any arbitrary name with no spaces.
We can see the actual LVM volumes on c inder-volumes, using the usual LVM tools as follows:
sudo lvdisplay cinder-volumes
--- Logical volume ---
LV Name /dev/Cinder-volumes/volume-fc2152ff-dda9-
VG Name Cinder-volumes
LV UUID cwAmEF-HGOH-54sr-pOXx-lOof-iDmy-lYyBEQ
LV Write Access read/write
LV Status available
# open 1
LV Size 1.00 GiB
Current LE 256
Read ahead sectors auto
- currently set to 256
Block device 252:2