Managing Volumes

Creating Volumes

Creating Volumes in the Control panel

To create a network (additional) volume in the Control panel:

  1. Go to the Volumes tab in the project.
  2. Click Create volume.
  3. Set the volume parameters in the new window.
  4. Click Create.

The new volume will appear in the list.

Creating Volumes through Console Clients

To create an empty additional volume, run the command with the required parameters — volume size (in GB) and type (it is the optional parameter but we recommend you to specify it), for example:

openstack volume create --size 1 --type fast.ru-2b VOLUME_NAME

The response will look as follows:

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | ru-2a                                |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2020-04-28T00:21:16.000000           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | 9494fee0-8d59-4081-97b5-89b8c        |
| multiattach         | False                                |
| name                | VOLUME_NAME                          |
| properties          |                                      |
| replication_status  | None                                 |
| size                | 1                                    |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | fast.ru-2b                           |
| updated_at          | None                                 |
| user_id             | d38f8bea67f94083803c5076f458p64a8io  |
+---------------------+--------------------------------------+

An empty volume is created as unbootable by default, and when created from image, it automatically receives a boot label.

You can use the following sources when creating a non-empty volume:

--image <image> | --snapshot <snapshot> | --source <volume>

The size of a new volume must be larger than or equal to the size of the source.

The –size parameter can be omitted if the volume is created from snapshot or another volume.

When creating a volume from image, the volume –size is required.

Example of creating a non-empty volume from a 5 GB image:

openstack volume create --image 'Ubuntu 18.04 LTS 64-bit' --size 5 --type fast.ru-2b  VOLUME_NAME

The response will look as follows:

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | ru-2b                                |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2020-04-28T00:43:21.000000           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | 08ed209f-5e7f-465c-b1e1-221b850db    |
| multiattach         | False                                |
| name                | VOLUME_NAME                          |
| properties          |                                      |
| replication_status  | None                                 |
| size                | 5                                    |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | fast.ru-2b                           |
| updated_at          | None                                 |
| user_id             | d38f8bea67f94083803c5066f458664ak9   |
+---------------------+--------------------------------------+

Creating Volumes from other Volumes

Creating Volumes from other Volumes in the Control panel

To create a volume from another volume in the Control panel:

  1. Go to the Volumes tab in the project.
  2. Click Create volume.
  3. Click the Source field in the new window.
  4. Go to the Volumes tab and select the volume from which you want to create a new one.
  5. Click Select.
  6. Specify the remaining parameters and click Create.

Creating Volumes from other Volumes through Console Clients

To create a volume from another volume:

openstack volume create --source 08ed209f-5e7f-465c-b1e1-221b850298db --size 5 --type fast.ru-2a --availability-zone ru-2a VOLUME_NAME_from_volume

When creating a volume from a volume in another zone, add the –availability-zone parameter, for example:

openstack volume create --source <volume> --size <size> --type <type> <VOLUME_NAME_from_volume>

Actions on Volumes

Actions on Volumes in the Control panel

Three tabs are available in the expanded block of the volume card:

  • Size — changing the volume size within the allocated resources;
  • Control — attaching or detaching to the cloud server, deleting volumes, transferring volumes between projects;
  • Snapshots — creating and viewing the snapshots. Read more about managing snapshots in the article.

The context (⋮) menu duplicates the possible actions on the volume:

  • rename a volume;
  • detach/attach a volume to the cloud server;
  • change the volume size;
  • make a snapshot;
  • transfer a volume to another project;
  • delete a volume.

Actions on Volumes through Console Clients

Viewing the Volume Types

Run the following command to view available volume types:

openstack volume type list

The response will look as follows:

+--------------------------------------+-----------------+-----------+
| ID                                   | Name            | Is Public |
+--------------------------------------+-----------------+-----------+
| ce80ecbd-385a-4e5a-aed9-8b6e5f3359ba | iso.ru-3a       | True      |
| b82dcef4-a977-4311-add4-dd08c847da2b | iso             | True      |
| f42f37b2-062f-4ce2-a6b3-28ca5e619030 | basic.ru-3a     | True      |
| 9c16598e-342b-4ff2-b948-8c05cf8f1490 | fast.ru-3a      | True      |
| fca113dd-a80f-4996-be54-cf2515d4ddee | universal.ru-3a | True      |
+--------------------------------------+-----------------+-----------+

The volume can be fast, basic or universal. The volume type is displayed in the format VolumeType.ZoneName, for example, fast.ru-2a.

The iso volume type appears when the client loads the ISO image from which the iso volume is created. When starting a cloud server, if the boot volume is of the ISO type, the operating system installer starts.

Viewing the List of Volumes

To view the list of volumes, run the command with the long key to display the Type and Bootable fields:

openstack volume list --long

Renaming the Volumes

To rename a volume, run the following command:

openstack volume set --name <new volume name> <volume>

Viewing the Volume Properties

Check the properties of the created volume:

openstack volume show <volume>

The response will look as follows:

+------------------------------+---------------------------------------------------------------------------------------------------+
| Field                        | Value                                                                                             |
+------------------------------+---------------------------------------------------------------------------------------------------+
| attachments                  | []                                                                                                |
| availability_zone            | ru-2b                                                                                             |
| bootable                     | true                                                                                              |
| consistencygroup_id          | None                                                                                              |
| created_at                   | 2020-04-28T00:43:21.000000                                                                        |
| description                  | None                                                                                              |
| encrypted                    | False                                                                                             |
| id                           | 08ed209f-5e7f-465c-b1e1-221b850298db                                                              |
| multiattach                  | False                                                                                             |
| name                         | Volume                                                                                            |
| os-vol-tenant-attr:tenant_id | 04d92ef9fe2i4caia90d6ecd2849c1cf89u                                                               |
| properties                   |                                                                                                   |
| replication_status           | None                                                                                              |
| size                         | 5                                                                                                 |
| snapshot_id                  | None                                                                                              |
| source_volid                 | None                                                                                              |
| status                       | available                                                                                         |
| type                         | fast.ru-2b                                                                                        |
| updated_at                   | 2020-04-28T00:43:22.000000                                                                        |
| user_id                      | d38f89ea67f94083803c5066f4586698i4a                                                               |
| volume_image_metadata        | {u'x_sel_os_type': u'linux', u'x_sel_image_agent_type': u'cloud-init', u'container_format':       |
|                              | u'bare', u'min_ram': u'512', u'hw_scsi_model': u'virtio-scsi', u'x_sel_image_type': u'master',    |
|                              | u'watchdog': u'pause', u'size': u'2133000192', u'os_distro': u'ubuntu', u'disk_format': u'raw',   |
|                              | u'x_sel_kpti_patch': u'True', u'hw_disk_bus': u'scsi', u'x_sel_image_owner': u'Selectel',         |
|                              | u'x_sel_image_source_file': u'ubuntu-bionic-amd64-selectel-master-product-0.1.img',               |
|                              | u'x_sel_image_os_dist': u'ubuntu', u'hw_qemu_guest_agent': u'yes', u'x_sel_image_os_arch':        |
|                              | u'amd64', u'image_name': u'Ubuntu 18.04 LTS 64-bit', u'image_id': u'c5c8d3cc-9a2c-48ce-adfe-      |
|                              | 93e066e9ae6e', u'min_disk': u'5', u'checksum': u'd4b69f195a23edaaf3b88b7807f980cc', u'os_type':   |
|                              | u'linux'}                                                                                         |
+------------------------------+---------------------------------------------------------------------------------------------------+

Increasing Volume Size

Please note that we recommend creating a snapshot of your volume under the Snapshots tab or create a full volume backup before modifying partitions or the file system to avoid losing any data.

Learn more about the volume limits.

Increasing Volume Size in the Control panel

To increase volume size:

  1. Go to the Volumes tab in the project.
  2. Open the desired volume card and go to the Size tab.
  3. Enter a new value (in GB).
  4. Click Save.

If the operating system was installed from a preconfigured image in the Control panel, no additional steps are required.

Increasing Volume Size through Console Clients

To change the volume size (in GB), run the following command:

openstack volume set --size 1800 <volume> 

If the Volume Size didn’t increase automatically

If automatic volume expansion does not occur after you increase its size in the Control panel or through Console Clients, then you must expand the volume capacity manually.

It is not necessary to turn off the VM when using modern OS distributions (for example, Ubuntu 18.04 LTS 64-bit).

Use the growpart utility from the cloud-initramfs-growroot package to expand the volume capacity for Unix-based servers:

# growpart --help
growpart disk partition
   rewrite partition table so that partition takes up all the space it can
   options:
    -h | --help       print Usage and exit
         --fudge F    if part could be resized, but change would be
                      less than 'F' bytes, do not resize (default: 1048576)
    -N | --dry-run    only report what would be done, show new 'sfdisk -d'
    -v | --verbose    increase verbosity / debug
    -u | --update  R  update the the kernel partition table info after growing
                      this requires kernel support and 'partx --update'
                      R is one of:
                       - 'auto'  : [default] update partition if possible
                       - 'force' : try despite sanity checks (fail on failure)
                       - 'off'   : do not attempt
                       - 'on'    : fail if sanity checks indicate no support

   Example:
    - growpart /dev/sda 1
      Resize partition 1 on /dev/sda

After resizing partitions via growpart, run an additional change to the file system itself via resize2fs.

Launch example:

growpart /dev/sda 1
resize2fs /dev/sda1

If something went wrong or your distribution does not support resizing on-the-fly, boot into rescue mode and run the following commands:

growpart /dev/sda 1
resize2fs /dev/sda1

For a cloud server with Windows OS, after increasing the volume size, use the Disk Management program.

Decreasing Volume Size

To shrink a volume, we recommend creating a new volume with the appropriate volume size and transferring your data.

Transferring Volumes between Projects

Transferring Volumes between Projects in the Control panel

Volumes can be transferred between different projects in one region in two steps:

  1. Prepare the volume for transfer.
  2. Receive the volume in the new project.

To prepare a volume for transfer:

  1. In the expanded volume block, open the Control tab.
  2. Detach the volume from its current virtual machine by clicking Detach.
  3. In the Transfer volume to another project section, click Transfer volume.

The Transfer volume to another project section will contain the Transfer ID and Key until the transfer is completed.

To receive a volume in a new project:

  1. Open the project you wish to transfer your volume to and open the Volumes tab.
  2. From the drop down menu, click Transfer volume from another project.
  3. If the Volume ID and Key fields do not fill in automatically, those volumes can be taken from the Control block of the volume to be transferred.
  4. Click Transfer.

To cancel volume transfer in the expanded card of the volume to be transferred, open the Control tab and click Cancel transfer.

Transferring Volumes between Projects through Console Clients

To transfer a volume between projects, use the following command:

openstack volume transfer request create <volume>

Example of transferring a volume between projects:

openstack volume transfer request create fda41064-1aec-4b11-a427-5b46dafce12
+------------+--------------------------------------+
| Field      | Value                                |
+------------+--------------------------------------+
| auth_key   | 766e89ce43c8b96f                     |
| created_at | 2020-04-28T01:52:32.649970           |
| id         | c095a116-9728-4f79-846d-1ba52cf93ed6 |
| name       | None                                 |
| volume_id  | fda41064-1aec-4b11-a427-5b46dafce12  |
+------------+--------------------------------------+

The auth_key value must be saved, it is necessary to accept the transfer in another project.

Viewing the Transfer

Run the following command to view a transfer:

openstack volume transfer request show

Example of viewing a transfer:

openstack volume transfer request show 497ec351-edeb-44e4-b752-6576ebcde3b
+------------+--------------------------------------+
| Field      | Value                                |
+------------+--------------------------------------+
| created_at | 2020-04-28T02:11:35.000000           |
| id         | 497ec351-edeb-44e4-b752-6576ebcde3b  |
| name       | VOLUME_new_name                      |
| volume_id  | a86f0387-0827-4aea-9ebd-3f7e1020062c |
+------------+--------------------------------------+

Receiving a Volume in Another Project

In another project, specify the transfer ID and Key:

openstack volume transfer request accept --auth-key <key> <transfer-request-id>

Volume Transfer Cancellation

If you don’t need to transfer the volume, you can just transfer the volume from awaiting-transfer state to the normal state by deleting the transfer request:

openstack volume transfer request delete <request_uuid>

Deleting Volumes

Deleting Volumes in the Control panel

Prior to deleting a volume, it must first be detached from a virtual server. There are two ways to do this:

  1. Under the Volumes tab in the project menu.
  2. Under the Network volumes tab in the cloud server menu.

Afterwards, volumes can be deleted on the project page under the Volumes tab:

  1. Choose Delete volume from the volume drop down menu.
  2. Click Delete under the Control tab in the expanded block.

When deleting a cloud server, you can choose to delete volumes from the server, which will create a task to delete all of the volumes attached to the machine.

Deleting Volumes through Console Clients

Run the following command to delete a volume:

openstack volume delete <volume UUID>

Run the following command to delete multiple volumes:

openstack volume delete <volume UUID 1> <volume UUID 2> <volume UUID 3>

Run the following command to delete a volume along with the snapshots (before deleting a volume, all snapshots must be deleted or use the purge option):

openstack volume delete --purge <volume UUID>

Run the following command to delete multiple volumes along with the snapshots (before deleting a volume, all snapshots must be deleted or use the purge option):

openstack volume delete --purge <volume UUID 1> <volume UUID 2> <volume UUID 3>

Actions on Volumes in the Server’s Card

Attaching an Additional Volume

To attach an additional volume in the server’s card of the Control panel:

  1. Go to the Servers tab of the project and expand the card of the required server.
  2. Go to the Network volumes tab.
  3. Click Attach volume.
  4. Select a volume and confirm the attachment to the server.

The volume will appear in the volume list of the machine.

Detaching an Additional Volume

To detach an additional volume in the Control panel:

  1. Go to the Servers tab of the project and expand the card of the required server.
  2. Go to the Network volumes tab.
  3. Expand the context (⋮) menu of the desired volume.
  4. Click Detach.

Changing Boot Volume

To boot from a different network volume:

  1. Turn off the cloud server.
  2. Detach all volumes.
  3. Firstly attach the volume that you want to boot the cloud server from. Please note that you need to transfer the loader/OS and all related software in advance to the new volume.
  4. Attach the remaining volumes if necessary.
  5. Turn on the cloud server.