As a lot of cloud providers offer a free tier option of their products now, i wanted to run some tests on the Oracle Cloud Infrastructure (OCI) and encountered some actually trivial problems on how to increase the volume of my instance.
TLDR:
After attaching you block volume you also need to partition, format and eventually mount bind your volume. But let’s not jump ahead of ourselves.
1. Creating resources
By using the webconsole, one can easily create the resources. However be sure to pick the same availability domain for both the block volume and the instance.
2. Attaching block volume to instance
Now you have to make both resources relate to eachother by attaching the volume to the VM instance. You can do that by clicking on your instance > Attached block volumes > Attach block volumes.
Pick your block volume in the drop down menu, alternatively you can also input the OCID of the block volume which is a global resource identifier.
There are two options on how to attach your block volume. Paravirtualized utilizes light virtualization but can not be used on bare metal. Due to the virtualization it has slightly more overhead, than mounting by iSCSI. However attaching in paravirtualized mode does not require to run some prededefined configuration (step 2.1) and simplifies block volume binding especially when handling infrastructure provisioning with Terraform. For more information see this oracle blog post.
2.1 Run the predefined iSCSI command
If you ssh into your VM you would not see the new volume. It (appears) that you have to register it first by running the predefined iSCSI commands. You can find them by clicking on the three vertical dots of the attached block volume
From here on out you are free to use the block volume as any other disk. For completness’ sake the next part will be following the tutorial of phoenixnap.com.
3. Create a partition
Using lsblk
you can now see, that the system recognizes a new disk device.
However if you try to mount the disk without partitioning , like i did (mind you it was already late) you will get the error “wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error “
To partition a disk use the following command
sudo fdisk /dev/sdb
To create a new partition press n
.
Afterwards follow through the interactive menu. For simplicity just hit enter to use the default values.
To write the changes press w
at the end.
4. Format the partition
sudo mkfs -t ext4 /dev/sdb1
5. Mount the partition
sudo mkdir -p /mt/sdb1
sudo mount -t auto /dev/sdb1 /mt/sdb1