Add a Volume to an Existing VM Instance
- Navigate to your Volumes List at https://cloud.cades.ornl.gov/dashboard/project/volumes/.
- At the top right click on
Create Volume
. - Fill in the following fields:
- Name :
user choice
- Description :
optional and can be left blank
- Source :
No source, empty volume
(this is default) - Type :
Netapp
(this is default) - Size :
Size you need up to your quota, which is displayed on the right
- Availability Zone:
nova
(this is default)
- Name :
- Click
Create Volume
. - Once created use the drop down ( ▾ ) on the right of the volume you just created and choose
Manage Attachments
. - Select the instance from the drop down to which you would like to attach your new volume.
- Next, the volume will have to be partitioned, formatted, and mounted. To begin, SSH into your VM.
- Check that the volume was assigned by listing the available disks: type
lsblk
. You should see a new disk with the allotted storage amount in the listed output. Example output is shown below.
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 8G 0 disk
- In this case, the disk
vda
is the original disk that has a partition namedvda1
. You may want to create a partition invdb
(optional).
Optional: To create partition of the new disk, type sudo fdisk /dev/vdb
. This command expects you to enter additional information.
- To create a new partition, enter
n
then pressEnter
. - Choose
p
for primary ore
for an extended partition. Usually, you will choosee
then pressEnter
. - The next two prompts request space allocations. In typical situations, press
Enter
on these two prompts to select the defaults. If you would like more information about your options, check the "SIZES" section in the fdisk manual by typingman fdisk
. - Type
w
and then pressEnter
to write your changes and reboot the system. - You will be returned to your bash prompt.
- To check that the partition was created correctly, type
lsblk
and you should see the new partition labelledvdb1
(in this example case).
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 8G 0 disk
└─vdb1 253:17 0 8G 0 part
Next, the new volume/partition must be formatted. Type sudo mkfs.ext4 /dev/vdb1
.
📝 Note: OpenStack and/or fdisk
may impart a default filesystem type on the new volume. In this case, you will be asked if you would like to proceed with the formatting although an existing partition table exists. If you choose to proceed by typing y
, you will rewrite the partition.
⚠ DO NOT PROCEED if this partition contains data that you need to keep!
- To check the formatting, type
lsblk -f
. You should see that thevdb1
entry has theext4
filesystem type. - To mount the volume for use, you need to create the mountpoint. For example:
mkdir volume
. - Then, to mount the volume to the newly-created mountpoint, type
sudo mount /dev/vdb1/ ./volume
. - Lastly, to check the mountpoint. type
lsblk -f
and you should seevdb
is mounted at the location you chose:/home/cades/volume
. - To avoid having to mount the volume every time you boot your VM Instance, you may set up automounting by viewing the contents of
/etc/fstab
.- Type
sudo nano /etc/fstab
. - Check for an existing line of code:
/dev/vdb /data auto defaults,nofail 0 2
- If it is not present, add it. Save your changes.
- Type
- The new storage volume is ready to use.