DEV Community

Hari Bantwal
Hari Bantwal

Posted on • Updated on

OCI Instance with External Volume

In life, there are moments when simple tasks can slow down our progress, often because they're not part of our regular routine. A recent experience brought this to my attention when I decided to delve into self-hosting for Windmill.dev and Supabase.

While I had a solid understanding of more complex concepts, I realized that I needed external references to navigate the foundational aspects due to the multitude of available approaches. This post serves as a record of this experience, with the hope that the lessons learned can be valuable in future, more intricate endeavors.


Objective: Provision Instance in OCI, with external Block volumes to cater to Different Docker Services


Create compute instance through OCI Console
Create Instance

With below information:

Image: Oracle Linux 8
Shape: Ampere VM.Standard.A1.Flex
Cost: CHF 2.00/month
Subnet: Public
Add SSH Keys: Yes


Create Block Volumes through OCI Console
Create Block Volume

With below information:

Volume size: 50 GB Estimated Price: CHF 0.02301885/GB
Volume performance: Balanced 10 VPUs at CHF 0.00153459/PU/GB
IOPS: 25,000 IOPS (60 IOPS/GB)


Attach the Block Volume to the Instance
Navigate to Attached Instances on Block Volume Screen
Attach with below information

Attachment type: ISCSI
Access Type: Read/Write
Instance: Created in Step 1
Device path: /dev/oracleoci/oraclevdb


Run iSCSI commands & information

iSCSI commands to connect should be run using the commands shown "Attached Block Volumes"

Image description

Remote SSH to the Instance to run the commands

ssh -i <Your SSH Private Key> opc@<PUBLIC_IP>
sudo iscsiadm -m node -o new -T ...
sudo iscsiadm -m node -o update -T ...
sudo iscsiadm -m node -T ...
Enter fullscreen mode Exit fullscreen mode

Create Disk Partition, Create File System Mount File System

sudo fdisk -l /dev/oracleoci/oraclevdb
sudo mkfs -t ext4 /dev/oracleoci/oraclevdb
Enter fullscreen mode Exit fullscreen mode

Mount file system

sudo mkdir /vol
sudo mount /dev/oracleoci/oraclevdb /vol
Enter fullscreen mode Exit fullscreen mode

OCI Block Volume is now mounted on Instance under the path /vol


How to Detach

  • Unmount the drive
sudo umount /vol
Enter fullscreen mode Exit fullscreen mode
  • Run the disconnect commands
sudo iscsiadm -m node -T iqn....
sudo iscsiadm -m node -o delete -T iqn....
Enter fullscreen mode Exit fullscreen mode

Find the commands below iSCSI commands & information

Image description

  • Detach the instance

`

Top comments (0)