Creating volumes
How to create, format and mount a volume on an instance
Introduction
Our instances launch with a default storage of 30 GB - enough for the OS and a little over.
In reality though, this might not be enough working storage to suit your needs. So when you need more working storage, you can add a volume to create more space on your machine (think of it as an external drive for your VM).
Volumes are for working storage, not back ups
Just like your VM's main volume, this additional storage space is not designed for storing your research data. It does not have the same protections as our purpose built research data storage solutions. It is only for increasing your VM’s working storage, specifically to improve its efficiency in processing, computing and analysing your research data (which should be stored elsewhere).
If you’re looking for space to store your research data, please instead see our data storage solutions in RCP: Mediaflux, DaRIS, Object Storage (S3-compatible) and Attica.
Creating the volume
This guide presumes you have an instance created.
To create a volume, go to the Volumes > Volumes on the dashboard and click
Create Volume
.
Fill in the details, making the volume large enough to fit your data.
To attach it to an instance, select ‘Manage Attachments’ from the drop down.
Caveat: both the instance and the volume will need to be in the same Availablility Zone.
Once successful, you will see where it is attached to the instance in question. In this image, you will see that it's been added to
/dev/vdb
:
Formatting the Volume
At this point, the volume is only attached to the instance in question. If the volume was created with Volume Source
set to ‘No source, empty volume,’ we still need to format the drive.
To format the volume, take note of where it is attached, and run:
ubuntu@dev-doc-1:~$ sudo mkfs -t ext4 /dev/vdb
mke2fs 1.44.1 (24-Mar-2018)
Creating filesystem with 13107200 4k blocks and 3276800 inodes
Filesystem UUID: 24db0256-4a5f-458d-8f95-36b28fa6a352
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done
ubuntu@dev-doc-1:~$
Mounting the Volume
To be used, the last step is to mount the drive. In this case we’ll make a directory at the root level called data
and mount the volume there:
ubuntu@dev-doc-1:~$ sudo mkdir /data
ubuntu@dev-doc-1:~$ sudo mount /dev/vdb /data
You will now be able to copy or write your data to the 50GB volume mounted at /data
:
ubuntu@dev-doc-1:~$ df -H
Filesystem Size Used Avail Use% Mounted on
udev 2.1G 0 2.1G 0% /dev
tmpfs 414M 3.0M 411M 1% /run
/dev/vda1 32G 2.0G 29G 7% /
tmpfs 2.1G 0 2.1G 0% /dev/shm
tmpfs 5.3M 0 5.3M 0% /run/lock
tmpfs 2.1G 0 2.1G 0% /sys/fs/cgroup
tmpfs 414M 0 414M 0% /run/user/1000
/dev/vdb 53G 55M 50G 1% /data
Permanently mounting the Volume
Unfortunately, that mount will not persist over a reboot. The data will be safe, but the mount will disappear and you will need to run the sudo mount
command again.
To prevent this, you can make the mount permanent. To do this, add an entry to the configuration file that controls the mounted volumes, /etc/fstab
. Using the text editor of your choice, add the following line to the bottom of the file /dev/vdb /data auto defaults 0 0
.
You can now rest easy knowing that your Volume will always be mounted at /data
when you reboot your instance.