Volume Setup and Tutorial¶
These instructions are intended for researchers who want to setup a persistent volume for use across instances. To follow these instructions you'll need to have already setup an Instance.
Important
If you are viewing this page as part of the cloud.rc tutorial, please follow the steps in order from top to bottom. Ignore any sections on deleting or releasing resources unless you need to correct a mistake.
Note
Virtual machines are disposable! If you get stuck at any point, or things don't seem like they're working as expected, etc., feel free to delete the instance and start over.
Creating a Volume¶
-
Click the "Volumes" fold-out in the left-hand navigation pane - the fold-out should open.
-
Click "Volumes" within the fold-out to open the "Volumes" table page.
-
Click "+ Create Volume" to open a dialog box.
-
Fill out the dialog box.
- Enter a "Volume Name". See Naming Conventions.
- Enter a "Description".
- Select "No source, empty volume" in the "Volume Source" drop-down box to create an empty volume.
- Select "__DEFAULT__" in the "Type" drop down box.
- Select a size in GB appropriate for your needs.
- Select "nova" in the "Availability Zone" drop down box.
- Select "No group" in the "Group" drop down box.
-
Click "Create Volume"
Attaching a Volume to a Running Instance¶
To attach a volume you must have already created at least one using the cloud.rc interface. More information can be found in [link]
-
Open the instances table by clicking "Compute" in the left-hand navigation pane and clicking "Instances".
-
In the "Actions" column entry, click the drop down triangle button and select "Attach Volume".
-
A dialog box will open.
-
Select a volume in the "Volume ID" drop down box.
-
Click "Attach Volume".
Now the volume should be attached to the instance. From here you may format the volume and mount it.
Formatting a Volume¶
To format a volume, you must have created a volume and attached it to an instance capable of formatting it correctly. These instructions assume a Linux operating system.
-
Click "Compute" in the left-hand navigation pane, then open the "Instances" menu. Click the name of any instance you wish to use to format the volume. Then click "Overview".
-
Scroll down to "Volumes Attached" and make note of the
<mount>
part of<volume-name> on <mount>
for your attached volume as it will be used in later steps. -
SSH into the instance from your local machine or from Cheaha.
-
Verify the volume is attached by using
sudo fdisk -l | egrep "<mount>""
-
Format the volume using
sudo fdisk "<mount>"
- You will be in the
fdisk
utility. - Enter
n
to create a new partition. - Enter
p
to make it the primary partition. - Enter numeral
1
to make it the first partition. - Press enter to accept the default first sector.
- Press enter to accept the default last sector.
- Enter
t
to change partition type. - Enter numerals
83
to change to Linux partition type. - Enter
p
to display the partition setup. Note that the partition will be labeled<mount>1
. This literally whatever<mount>
was from earlier followed by the numeral1
. Further steps will refer to this as<pmount>
- Enter
w
to execute the setup prepared in the previous substeps.
- You will be in the
-
Verify the volume is not mounted using
sudo mount | egrep "<mount>"
. If there is no output, then move to the next step. If there is some output then usesudo umount -l "<mount>"
to unmount the volume and verify again. -
Create the filesystem using
sudo mkfs.ext4 "<pmount>"
. Ensure that the output looks like the following:ubuntu@my-instance:~$ sudo mkfs.ext4 /dev/vdb1 mke2fs 1.45.5 (07-Jan-2020) Discarding device blocks: done Creating filesystem with 26214144 4k blocks and 6553600 inodes Filesystem UUID: 335704a9-2435-440a-aeea-8ae29438ac64 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 654208, 4096000, 7962624, 11239424, 20480000, 23887872 Allocating group tables: done Writing inode tables: done Creating journal (131072 blocks): done Writing superblocks and filesystem accounting information: done
The volume is now formatted and ready for mounting within an attached instance OS. You will need to make note of <pmount>
for when you are ready to mount the volume to an instance.
Mounting a Volume in an Instance¶
Mounting a volume needs to be done once per instance it will be attached to. It is assumed you've already created and formatted a volume and attached it to some instance. You'll need the <pmount>
label from when you formatted the volume.
-
SSH into the instance from your local machine or from Cheaha.
-
Obtain the uuid of the volume using
sudo blkid | egrep "<pmount>"
. This will be referred to as<uuid>
in future steps. -
Create a directory to mount the volume as. A good choice is
sudo mkdir /mnt/<volume-name>
where<volume-name>
is something meaningful for you or your project. This directory will be referred to as<directory>
in future steps. -
Mount the volume to the directory using
sudo mount -U <uuid> <directory>
. -
Verify the volume is mounted using
df -h | egrep <pmount>
-
Edit the
fstab
file to make mounting persistent across instance reboots.- Edit the file using
sudo nano /etc/fstab
. - Add the following line to the file:
- Edit the file using
-
Verify fstab was modified correctly by soft rebooting the instance and verifying the mount again using
df -h | egrep "<pmount>"
. -
Set access control using the following commands:
-
Verify the access controls were modified correctly by creating a test file and then listing files in
<directory>
to ensure the file was created. The following commands will achieve this:
The volume is now mounted to your instance and ready for use and re-use across sessions and reboots.
Deleting a Volume¶
Note
Deleting a Volume is not part of the tutorial, and is here as a reference.
To delete a volume, return to the "Volumes" page using the left-hand navigation pane. In the table, find the row with the volume you wish to delete, and click the drop-down arrow under "Actions" in that row. Then click "Delete Volume" to open a confirmation dialog.
Click "Delete Volume" again to delete the volume permanently.
Important
It will not be possible to delete a volume if it has an associated volume snapshot. The snapshot will need to be deleted first.