Volumes 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. You can also create a snapshot from or delete a volume. Only administrative users can create volume types.

Create a volume

  1. Log in to the dashboard.
  2. Select the appropriate project from the drop down menu at the top left.
  3. On the Project tab, open the Volumes tab and click Volumes category.
  4. Click Create Volume. In the dialog box that opens (fig), enter or select the following values.
    Volume Name: Specify a name for the volume.
    Description: Optionally, provide a brief description for the volume.
    Volume Source: Select one of the following options:
    1. No source, empty volume: Creates an empty volume. An empty volume does not contain a file system or a partition table.
    2. Snapshot: If you choose this option, a new field for Use snapshot as a source displays. You can select the snapshot from the list.
    3. Image: If you choose this option, a new field for Use image as a source displays. You can select the image from the list.
    4. Volume: If you choose this option, a new field for Use volume as a source displays. You can select the volume from the list. Options to use a snapshot or a volume as the source for a volume are displayed only if there are existing snapshots or volumes.
      Type: Leave this field blank.
      Size (GB): The size of the volume in gibibytes (GiB). Note the green bars on the right side of the image (Volume Limits), which represent the disk space and the number of volumes that you want to occupy.
      Availability Zone: Leave the default Nova.
  5. Click Create Volume.

Create Volume

The dashboard shows the volume on the Volumes tab.

Attach a volume to an instance

After you create one or more volumes, you can attach them to instances. You can attach a volume to one instance at a time.

  1. Log in to the dashboard.
  2. Select the appropriate project from the drop down menu at the top left.
  3. On the Project tab, open the Volumes tab and click Volumes category.
  4. Select the volume to add to an instance and click Manage Attachments.
  5. In the Manage Volume Attachments dialog box (fig), select an instance.
  6. Enter the name of the device from which the volume is accessible by the instance.
  7. Click Attach Volume.
    The dashboard shows the instance to which the volume is now attached and the device name.

Note: The actual device name might differ from the volume name because of hypervisor settings.

Manage Volume AttachmentsYou can view the status of a volume in the Volumes tab of the dashboard. The volume is either Available or In-Use. Now you can log in to the instance and mount, format, and use the disk. To find out which name has been assigned to our volume, go to the Volume tab (fig): in our case it is called vdb.

Volume

So, let's connect to our instance and check that the disk has been added. To find your disk, let's use the command

Check disk existence
$ cat /proc/partitions

If needed, create a file system on it (this will scratch the disk!)

Create FileSystem
$ sudo mkfs -t ext4 /dev/<volume>

Finally, mount the disk with

Mount Disk
$ sudo mount /dev/<volume> /mnt

Detach a volume from an istance

First, you need to unmount the volume, using the command

Unmount Disk
$ sudo umount /mnt

So, follow the steps:

  1. Log in to the dashboard.
  2. Select the appropriate project from the drop down menu at the top left.
  3. On the Project tab, open the Volumes tab and click the Volumes category.
  4. Select the volume and click Manage Attachments.
  5. Click Detach Volume and confirm your changes.

A message indicates whether the action was successful. The detached volume can then be associated to another VM, as described above (you won’t have to re-create the file system, otherwise you will loose the content of the volume!).

Create a snapshot from a volume

  1. Log in to the dashboard.
  2. Select the appropriate project from the drop down menu at the top left.
  3. On the Project tab, open the Volumes tab and click Volumes category.
  4. Select a volume from which to create a snapshot.
  5. In the Actions column, click Create Snapshot.
  6. In the dialog box that opens, enter a snapshot name and a brief description.
  7. Confirm your changes.
    The dashboard shows the new volume snapshot in Volume Snapshots tab.

Edit a volume

  1. Log in to the dashboard.
  2. Select the appropriate project from the drop down menu at the top left.
  3. On the Project tab, open the Volumes tab and click Volumes category.
  4. Select the volume that you want to edit.
  5. In the Actions column, click Edit Volume.
  6. In the Edit Volume dialog box, update the name and description of the volume.
  7. Click Edit Volume.

Note: You can extend a volume by using the Extend Volume option available in the More dropdown list and entering the new value for volume size.

Delete a volume

When you delete an instance, the data in its attached volumes is not deleted.

  1. Log in to the dashboard.
  2. Select the appropriate project from the drop down menu at the top left.
  3. On the Project tab, open the Volumes tab and click Volumes category.
  4. Select the check boxes for the volumes that you want to delete.
  5. Click Delete Volumes and confirm your choice.
    A message indicates whether the action was successful.


Extend a volume

In order to extend a volume already attached to an instance, it following steps should be followed:

  1. Detach the volume from the instance so that is becomes available
  2. Extend the volume and save after specifying the desired size
  3. Re-attach the volume to the instance
  4. Connect to the instance and perform a resize so the the device show the entire disk size:

    check data
    root@minio-iotwins:~# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    udev            3.9G     0  3.9G   0% /dev
    tmpfs           798M  844K  798M   1% /run
    /dev/vda1        78G  2.3G   76G   3% /
    tmpfs           3.9G     0  3.9G   0% /dev/shm
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
    /dev/vda15      105M  3.6M  101M   4% /boot/efi
    overlay          78G  2.3G   76G   3% /var/lib/docker/overlay2/9984becaaa691c6aa6842273a6f2e137e1fa0737bbca94dec1554caeee021f44/merged
    overlay          78G  2.3G   76G   3% /var/lib/docker/overlay2/ca67048011fc1a9e67ecf4ebad11aa2f210cac4336ef9683ccd6005251d4e69e/merged
    shm              64M     0   64M   0% /var/lib/docker/containers/fa9ae914556ca58893dd248939e8132710f672289b0baa35d8fb43d790c1deb9/mounts/shm
    shm              64M     0   64M   0% /var/lib/docker/containers/8cab3616d80fa0f136447f301ab699c5d3e2abb88f6a23b914dd34f7cb3dbf7d/mounts/shm
    tmpfs           798M     0  798M   0% /run/user/1000
    /dev/vdc         45G   53M   42G   1% /data
    
    root@minio-iotwins:~# grep vdc /proc/partitions
     252       32   49283072 vdc
    
    root@minio-iotwins:~# resize2fs /dev/vdc
    resize2fs 1.44.1 (24-Mar-2018)
    Filesystem at /dev/vdc is mounted on /data; on-line resizing required
    old_desc_blocks = 6, new_desc_blocks = 6
    The filesystem on /dev/vdc is now 12320768 (4k) blocks long.
    
    root@minio-iotwins:~# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    udev            3.9G     0  3.9G   0% /dev
    tmpfs           798M  844K  798M   1% /run
    /dev/vda1        78G  2.3G   76G   3% /
    tmpfs           3.9G     0  3.9G   0% /dev/shm
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
    /dev/vda15      105M  3.6M  101M   4% /boot/efi
    overlay          78G  2.3G   76G   3% /var/lib/docker/overlay2/9984becaaa691c6aa6842273a6f2e137e1fa0737bbca94dec1554caeee021f44/merged
    overlay          78G  2.3G   76G   3% /var/lib/docker/overlay2/ca67048011fc1a9e67ecf4ebad11aa2f210cac4336ef9683ccd6005251d4e69e/merged
    shm              64M     0   64M   0% /var/lib/docker/containers/fa9ae914556ca58893dd248939e8132710f672289b0baa35d8fb43d790c1deb9/mounts/shm
    shm              64M     0   64M   0% /var/lib/docker/containers/8cab3616d80fa0f136447f301ab699c5d3e2abb88f6a23b914dd34f7cb3dbf7d/mounts/shm
    tmpfs           798M     0  798M   0% /run/user/1000
    /dev/vdc         47G   53M   44G   1% /data
  5. Check data is still present on the

    check data
    root@minio-iotwins:~# ll /data/
    total 40
    drwxr-xr-x  7 root root  4096 Dec 18 16:03 ./
    drwxr-xr-x 24 root root  4096 Dec 18 06:17 ../
    drwxr-xr-x  6 root root  4096 Dec 18 15:00 .minio.sys/
    drwxr-xr-x  2 root root  4096 Dec 18 15:47 cduma/
    drwx------  2 root root 16384 Dec 17 16:28 lost+found/
    drwxr-xr-x  3 root root  4096 Dec 18 16:05 rossitisbeni/
    drwxr-xr-x  4 root root  4096 Dec 18 16:02 scratch/
    
    root@minio-iotwins:~# ll /data/scratch/
    total 16
    drwxr-xr-x 4 root root 4096 Dec 18 16:02 ./
    drwxr-xr-x 7 root root 4096 Dec 18 16:03 ../
    drwxr-xr-x 2 root root 4096 Dec 18 16:01 pippo/
    drwxr-xr-x 2 root root 4096 Dec 18 16:02 rossitisbeni/
    root@minio-iotwins:~# ll /data/scratch/pippo/
    total 32
    drwxr-xr-x 2 root root  4096 Dec 18 16:01  ./
    drwxr-xr-x 4 root root  4096 Dec 18 16:02  ../
    -rw-r--r-- 1 root root 23407 Dec 18 16:01 'Screenshot 2020-12-18 at 10.50.50.png'
  • No labels