Skip to end of metadata
Go to start of metadata

This guide assumes you associated your SSH Key Pair with the instance when it was created, and that you are connected to the Anvil VPN.

Once you have created and attached your volume, it must be formatted and mounted in your Linux instance to be usable.  This procedure is identical to what would be done when attaching a second hard drive to a physical machine.  In this example, a 10GB volume was created and attached to the instance.  Note that the majority of this guide is for a newly created volume.  If you are attaching an existing volume with data already on it, skip to creating a directory and mounting the volume.

Follow the relevant guide (WindowsMac) for your operating system to connect to your instance.  Formatting and mounting the volume requires root privileges, so first run the command sudo su - to get a root shell.

Running commands as root

Extreme care should be taken when running commands as root. It is very easy to permanently delete data or cause irreparable damage to your instance.

Next, you will need to determine what device the volume is presented as within Linux.  Typically this will be /dev/vdb, but it is necessary to verify this to avoid mistakes, especially if you have more than one volume attached to an instance.  The command fdisk -l will list the hard drive devices.  

Here there is a completely empty (no partitions) disk device matching the 10GB size of the volume, so /dev/vdb is the correct device.  The fdisk utility will first be used to create a single partition.  Run the command fdisk /dev/vdb to start the program using the volume disk device.

Press n for new partition and hit enter.

Press p for primary partition and hit enter.

Enter 1 for the partition number.

At the next two prompts hit enter to accept the defaults and return to the main command prompt.

Finally, press w followed by return to save the changes and exit fdisk.

Now that a partition has been created, it can be formatted.  Here, the EXT4 filesystem will be used.  This is the default filesystem used by many Linux distributions including CentOS and Ubuntu, and is a good general choice.  An alternate filesystem may be used by running a different format command.  To format the partition using EXT4, run the command mkfs.ext4 /dev/vdb1.  You will see a progress message and then be returned to the shell prompt.

Mounting an existing volume

If you are attaching a pre-existing volume, start here.

Finally, the formatted partition must be mounted as a directory to be used.  By convention this is done under /mnt, but you may choose to mount it elsewhere depending on the usage.  Here, a directory called myvolume will be created and the volume mounted there.  Run the command mkdir /mnt/myvolume, followed by mnt /dev/vdb1 /mnt/myvolume to create the directory and mount the volume.

Running the command df -h should then show the new mounted empty volume.  

The volume can now be used.

  • No labels