Expanding Storage for CADES VMs

Suhas Somnath and Whitney Nelson
Advanced Data and Workflows Group
National Center for Computational Sciences
Oak Ridge National Laboratory

Updated: 06/12/2018

While it is remarkably easy to switch the flavors of Virtual Machines, it is not as trivial to expand the storage volume associated with your VM. There are two ways one can expand the storage of an instance:

Option 1: Expand the existing (boot) volume

Pros: - Requires no system admin work

Cons: - Must delete the current instance and create a new one - Generates a new IP address for Virtual Machine

Option 2: Add an additional volume

Pros: - IP address remains the same - Can add multiple volumes

Cons: - Requires some system administration work

Option 1 - Expanding the existing volume

Proceed only if you ensured that your volume would not be deleted upon deletion of your instance and do not mind losing the IP address of your machine.

Ensure that your volume is bootable

  1. Go to Horizon
  2. Login with your UCAMS credentials.
  3. Navigate to ProjectComputeVolumes.

  4. Check the Bootable column for your volume. It should read "Yes" in the cell.

  5. If the volume is not bootable, click Edit Volume.

  6. In the resulting dialog, check the Bootable box then click submit. The cell under the Bootable column should now read "Yes".

Expanding the existing volume

  1. Navigate to ProjectComputeInstances.

  2. Select the box next to your instance name, then click Delete Instances.

  3. Navigate to the Volumes tab.

  4. Resize your volume by clicking the down arrow next to Edit Volume then select Extend Volume.

  5. In the resulting dialog, enter the desired size in the New Size (GiB) field.

  6. Click Extend Volume. The new volume size should appear in the Size column of your volume.
  7. Click the down arrow next to Edit Volume again, then select Launch as Instance.

  8. Fill out the tabs in the resulting dialog box for your new instance. Under the Source Tab, ensure that your volume appears under the Allocated table with the correct size.

  9. Once you have entered all required fields, click Launch Instance. The instance will have a new IP address which will change the way you access your Virtual Machine. Refer to Access Your VM Instance Running in OpenStack for additional help.

Option 2 - Adding a new Volume

Provisioning a new volume

  1. Go to Horizon and login with your credentials.
  2. Navigate to ProjectComputeVolumes.

  3. In the Volumes screen, click + Create a New Volume.

  4. In the resulting Create Volume dialog, fill out the required field by entering the size of your new volume.

    • Volume Name: a case-sensitive sequence of characters naming the volume.
    • Description: short description of the volume
    • Volume Source: the default value is "No source, empty value".
    • Type: the type is default to "Net Type". However, if your requires a higher volume of data, utilize "Large_Data_Store".
    • (Required) Size: Enter the desired size in GiB.
    • Availability Zone: The default value is set to "nova".
  5. Select Create Volume in the bottom right dialog to continue. The new volume should appear under the Volumes tab.

Attach to instance on Horizon

  1. Next, attach it to your existing instance by selecting the down arrow next to Edit Volume then select Manage Attachments.

  2. In the resulting Manage Volume Attachments dialog, fill out the required field by selecting the appropriate instance.

  3. Click Attach Volume to continue.

Format and mount the volume in your instance

Much of the following steps have been adapted from this page.

  1. Access your VM instance's Bash terminal (for additional help refer to Access VM Instances Running in Open Stack).

  2. Once you have accessed the VM via SSH, find out the name of the new volume:

$ lsblk

You should see something like:

# vda    253:0    0   8G  0 disk
# └─vda1 253:1    0   8G  0 part /
# vdb    253:16   0  80G  0 disk
  1. In our case, vdb is the volume we want to mount. In the bash type the following:
$ sudo fdisk /dev/vdb
  1. In the prompts do the following to set the correct flags:

  2. type: c and hit enter

  3. type: u and hit enter
  4. type: w and hit enter

  5. Next, find out what file system is being used on the boot drive, let’s use the same:

$ mount | grep "\^/dev"

This should show you something like:

# /dev/vda1 on / type ext4 (rw,relatime,data=ordered)
  1. Make the file system on the new volume:
$ sudo mkfs -t ext4 /dev/vdb

If asked to overwrite the partition table, type: y then hit enter.

  1. Make a new folder. This is where the data will be stored.
$ cd \~
$ mdkir data
  1. Finally, mount the volume.
$ sudo mount /dev/vdb /home/cades/data

You should see two lines now:

# /dev/vda1 on / type ext4 (rw,relatime,data=ordered)
# /dev/vdb on /home/cades/data type ext4 (rw,relatime,data=ordered)
  1. Verify that the mounting was done correctly:
$ lsblk

You should see something like:

# vda 253:0 0 8G 0 disk
# └─vda1 253:1 0 8G 0 part /
# vdb 253:16 0 80G 0 disk /home/cades/data
  1. Check to see that data is indeed on the new volume:
$ df anaconda/

You should see something like:

# Filesystem 1K-blocks Used Available Use% Mounted on
# /dev/vda1 8065444 5962536 2086524 75% /

This indicates that anaconda is on the boot drive (/dev/vda1).

Let's do the same for the newly mounted volume at /data/:

$ df data/

You should see something like:

# Filesystem 1K-blocks Used Available Use% Mounted on
# /dev/vdb 82438832 57088 78171056 1% /home/cades/data

Clearly, the new folder data is actually on the new volume /dev/vdb while the other folder, anaconda, was on the boot drive /dev/vda1.

  1. Move any data from your fixed sized boot volume to the new volume.
$ sudo mv old/folder/on/boot/volume/\* data/