Data Volumes (Cinder)

About Volumes

Volumes are block storage devices that you can attach to instances. Unlike the instance’s root disk, volumes can be attached to a running instance, detached and attached to another.

Managing Volumes

Go to Volumes section in your OpenStack dashboard. Click Create Volume and enter the name and size of volume you want to create.

After volume is created, you can see it listed in Volumes. You can delete it by clicking Delete Volume in dropdown menu next to the volume.

OpenStack Data Volumes

Attach and Detach

Click on Edit Attachments next to your volume to show Manage Volume Attachments dialog. Select an instance you want the volume to be attached to and click on Attach Volume.

Detatching volume can be done in the same dialog Volumes -> Edit Attachments. Click on Detach Volume button located next to instance you want a volume to detach from.

Detaching volumes

Before detaching, you should unmount the device in your instance. You can do this with umount on Linux and offline in DiskPart utility on Windows. See text below for more details.

OpenStack Volumes Attach

Working with Volumes on Windows

Empty volume

After a newly created volume is attached, Windows will mark it as offline and read-only. You will have to make it online, create an empty partition and assign a drive letter. If you attached volume which is already formated, read section Formated volume.

Run Command Prompt or PowerShell as administrator and type diskpart. Check where the volume is attached with command list disk:

C:\Windows\system32>diskpart

Microsoft DiskPart version 6.2.9200

Copyright (C) 1999-2012 Microsoft Corporation.
On computer: WIN-SRV

DISKPART> list disk

Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 32 GB 0 B
Disk 1 Offline 32 GB 32 GB

Disk 0 is disk containing operating system, Disk 1 is the attached volume (if you attach more volumes, you will see Disk 2, Disk 3 etc.). Now activate disk with select and online commands.

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> online disk

DiskPart successfully onlined the selected disk.

Now, make your disk writable with attribute command:

DISKPART> attribute disk clear readonly

Disk attributes cleared successfully.

Finally, you can create empty partition with create and format commands and assign a drive letter with assign command:

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.

DISKPART> format fs=ntfs label="My new disk" quick

100 percent completed

DiskPart successfully formatted the volume.

DISKPART> assign

DiskPart successfully assigned the drive letter or mount point.

Formated volume

If you attached a volume with already formated partition(s), for example you detached the volume from another Windows instance and attached it again, you will just need to make disk online.

Run Command Promt or PowerShell as administrator and type diskpart. Then check which id does your disk have with list disk command and then make it online with select and online commands:

C:\Windows\system32>diskpart

Microsoft DiskPart version 6.2.9200

Copyright (C) 1999-2012 Microsoft Corporation.
On computer: WIN-SRV

DISKPART> list disk

Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 32 GB 0 B
Disk 1 Offline 32 GB 0 B

DISKPART> select disk 1

Disk 1 is now selected disk.

DISKPART> online

DiskPart successfully onlined the selected disk.

Before detaching

If you want to detach volume from running instance, you should unmount it first. You can do it simply with offline command in diskpart utility.

C:\Windows\system32>diskpart

Microsoft DiskPart version 6.2.9200

Copyright (C) 1999-2012 Microsoft Corporation.
On computer: WIN-SRV

DISKPART> select disk 1

Disk 1 is now selected disk.

DISKPART> offline

DiskPart successfully offlined the selected disk.

Working with Volumes on Linux / BSD

After a volume is attached, an instance will recognize it as a disk device. On most Linux instances, you will find it under /dev/vdb (if you attach more volumes, then vdc, vdd etc.).

Detaching volumes

If you’ve already created filesystem, skip to section Formated volume.

Empty volume

When you attach newly created volume, you will have to create a new filesystem on it. Connect to your instance (use either SSH, VNC or JavaVNC). Check where the device is located:

root@myinstance:~# ls /dev/vd*
/dev/vda /dev/vda1 /dev/vdb

First, create a new partition with fdisk. Run fdisk -u /dev/vdb where /dev/vdb is your volume device. In fdisk enter command n, then select primary partition (p), and enter 1 as partition number. Enter first sector as 2048 and press enter when prompted for Last sector. Then save partition table with w command.

For more advacent use, see fdisk man page.

root@myinstance:~# fdisk -u /dev/vdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x7c7470fb.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won´t be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It´s strongly recommended to
switch off the mode (command ´c´).

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-67108863, default 63): 2048
Last sector, +sectors or +size{K,M,G} (2048-67108863, default 67108863): 
Using default value 67108863

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Now, create a filesystem with mkfs

root@myinstance:~# mkfs /dev/vdb1</pre>

Finally, you can mount a device with mount or add it to your fstab:

root@myinstance:~# mount /dev/vdb1 /mnt/</pre>

Volume with a formated partition

If you attached a volume with already formated partition(s), for example you detached the volume from another instance and attached it again, all you need is the mount command.

root@myinstance:~# mount /dev/vdb1 /mnt/</pre>

Before detaching

If you want to detach volume from running instance, you should unmount it first. You can do it with umount command:

root@myinstance:~# umount /mnt/

Last modified: 0001-01-01