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:

openstack volume list


To create a 10 GB volume, you can do:

openstack volume create --size 10 ${OS_USERNAME}-10GVolume

Then you can attach it to an instance for use:

openstack server add volume vm-uid-number volume-uid-number

 

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 /vol_b
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 /vol_b


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


touch /vol_b/foo
ls -la /vol_b/
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% /vol_b

 

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 /vol_b

To detach it from the VM, you'll do:

openstack server remove volume vm-uid-number volume-uid-number

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


openstack volume list
+--------------------------------------+------------------+------------+------+------------------------------+
|  ID                                  |   Display Name   |  Status    | Size | Attached to                  |
+--------------------------------------+------------------+------------+------+------------------------------+
| af59d4fa-ced2-4049-a062-7b2a15807b7f | jlf599-10GVolume | available  |  10  |                              |
+--------------------------------------+------------------+------------+------+------------------------------+

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

openstack volume delete volume-uid-number
  • No labels