Automatically mount a volume

How to automatically mount a volume to an instance in OneQode Cloud

Here's how to create a volume in your account, attach it to an instance, and configure the settings to make it accessible.

Create a volume in your OCS account

From the OCS dashboard, navigate to Cloud → Volumes in the left hand navigation panel, then click the "+" button in the bottom right corner to create a volume.

Enter/select the values you like in each field. Then click "Create".

You will see the new volume on the list.

Attach the new volume to an instance

In Cloud → Instances, open the instance which you want to attach the volume to.

Navigate to "Volumes" in the horizontal tab and click the "Attach Volume". Choose the volume you want to attach and then click "Attach".

After attaching the volume, you will see the attached volume show up in the list.

Configuring your instance

Just attaching a volume to an instance doesn't let the operating system to read/write files on the volume. To make it accessible to a volume, you need to format and mount the volume.

Format the volume

Open the console of the instance to which you attached the volume.

While you can do the below step via the console in the OneQode Cloud dashboard, we recommend doing this step via SSH as you'll need to copy and paste some values later.

Enter the command lsblk and take note of the volume's name for the next step.

Create an ext4 filesystem on the volume with the command mkfs.ext4 /dev/***(replacing *** with the volume name). Make sure you prepend /dev/ to the volume's name.

Take note of the "Filesystem UUID". You need this UUID to configure the mounting setting later.

Configure the mounting setting

Create the directory to which you want to mount the volume. In this guide, we will use /testmount as the mounting point.

To do this run the command sudo mkdir /testmount

Open "/etc/fstab" with a text editor (you can do this by running the command sudo nano /etc/fstab) and configure the mounting setting as in the below image.

Change the UUID and /testmount depending on your environment.

Finally, enter the mount -a command to mount the volume to /testmount.

You can check if the volume is properly mounted with the lsblk command.

Your system is now configured to automatically mount the volume and begin reading and writing files to the new storage space.

Having trouble? Reach out to our team if you have any problems.

Last updated