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
- Go to Horizon
- Login with your UCAMS credentials.
-
Navigate to
Project
→Compute
→Volumes
. -
Check the Bootable column for your volume. It should read "Yes" in the cell.
-
If the volume is not bootable, click
Edit Volume
. - 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
-
Navigate to
Project
→Compute
→Instances
. -
Select the box next to your instance name, then click
Delete Instances
. -
Navigate to the
Volumes
tab. -
Resize your volume by clicking the down arrow next to
Edit Volume
then selectExtend Volume
. -
In the resulting dialog, enter the desired size in the New Size (GiB) field.
- Click
Extend Volume
. The new volume size should appear in the Size column of your volume. -
Click the down arrow next to
Edit Volume
again, then selectLaunch as Instance
. -
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.
-
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
- Go to Horizon and login with your credentials.
-
Navigate to
Project
→Compute
→Volumes
. -
In the Volumes screen, click
+ Create a New Volume
. -
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 volumeVolume 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".
-
Select
Create Volume
in the bottom right dialog to continue. The new volume should appear under theVolumes
tab.
Attach to instance on Horizon
-
Next, attach it to your existing instance by selecting the down arrow next to
Edit Volume
then selectManage Attachments
. -
In the resulting Manage Volume Attachments dialog, fill out the required field by selecting the appropriate instance.
-
Click
Attach Volume
to continue.
Format and mount the volume in your instance
Much of the following steps have been adapted from this page.
-
Access your VM instance's Bash terminal (for additional help refer to Access VM Instances Running in Open Stack).
-
Once you have accessed the VM via SSH, find out the name of the new volume:
$ lsblk
You should see something like:
# NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
# vda 253:0 0 8G 0 disk
# └─vda1 253:1 0 8G 0 part /
# vdb 253:16 0 80G 0 disk
- In our case,
vdb
is the volume we want to mount. In the bash type the following:
$ sudo fdisk /dev/vdb
-
In the prompts do the following to set the correct flags:
-
type: c and hit enter
- type: u and hit enter
-
type: w and hit enter
-
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)
- 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
.
- Make a new folder. This is where the data will be stored.
$ cd \~
$ mdkir data
- 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)
- Verify that the mounting was done correctly:
$ lsblk
You should see something like:
# NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
# vda 253:0 0 8G 0 disk
# └─vda1 253:1 0 8G 0 part /
# vdb 253:16 0 80G 0 disk /home/cades/data
- 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
.
- Move any data from your fixed sized boot volume to the new volume.
$ sudo mv old/folder/on/boot/volume/\* data/