Skip to end of metadata
Go to start of metadata

Assuming you have an allocation for Jetstream storage, you can create and use volumes from the command line.

To view any volumes you might have:

cinder list

To create a 10 GB volume, you can do:

cinder create 10 --display-name ${OS_PROJECT_NAME}-10GVolume

Then you can attach it to an instance for use:

nova volume-attach vm-uid-number volume-uid-number auto

Nova will report back with information like the following:

+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/sdb                             |
| id       | af59d4fa-ced2-4049-a062-7b2a15807b7f |
| serverId | 6987520f-eae4-4505-8100-4857b5d7e3db |
| volumeId | af59d4fa-ced2-4049-a062-7b2a15807b7f |
+----------+--------------------------------------+

 

From your instance, you can now create a mount point, view the device, and create the filesystem (using ext4 as the filesystem type for this example).

mkdir /vol1

fdisk -l /dev/sdb

mkfs.ext4 /dev/sdb 

If you get the following warning, it's safe to hit 'y' to proceed. 

/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n)

mount /dev/sdb /vol1

Assuming you didn't get any errors, /dev/sdb should now be mounted on /vol1

touch /vol1/foo

ls -la /vol1/

total 24
drwxr-xr-x   3 root root  4096 Jul 13 13:37 .
dr-xr-xr-x. 18 root root  4096 Jul 13 11:50 ..
-rw-r--r--   1 root root     0 Jul 13 13:37 foo
drwx------   2 root root 16384 Jul 13 13:36 lost+found

df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       8.0G  2.4G  5.7G  30% /
devtmpfs        902M     0  902M   0% /dev
tmpfs           920M     0  920M   0% /dev/shm
tmpfs           920M   17M  904M   2% /run
tmpfs           920M     0  920M   0% /sys/fs/cgroup
tmpfs           184M     0  184M   0% /run/user/0
/dev/sdb        9.8G   37M  9.2G   1% /vol1

 

Once you are done with your volume or want to use it with another VM, if you are not shutting down the VM, you'll need to unmount it. 

umount /vol1

To detach it from the VM, you'll do a nova detach-volume:

nova volume-detach vm-uid-number volume-uid-number

Doing a cinder list now should show the volume as available:

cinder list

+--------------------------------------+-----------+------------------+------+-------------+----------+-------------+
|                  ID                  |   Status  |       Name       | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------------------+------+-------------+----------+-------------+
| af59d4fa-ced2-4049-a062-7b2a15807b7f | available | jlf599-10GVolume |  10  |      -      |  false   |             |
+--------------------------------------+-----------+------------------+------+-------------+----------+-------------+

If you want to completely destroy a volume, you can do:

cinder delete volume-uid-number

  • No labels