Mounting a Block Volume in OCI: A Quick Reference Guide

Gemini_Generated_Image_qftgynqftgynqftg.png

Every once in a while, I go back to the basics because of something I need to work on for a client. In this case, I had corrupted my Oracle Database 23ai (Beta) environment while attempting an upgrade to Oracle Database 26ai. Since the Beta was running in a custom OCI compute node, I was able to reinitialize a new instance.

This time around, I mounted a 1TB block volume to the instance. This mount point will be the location where I store all my datafiles for testing. As a refresher, I walked through the mounting process for adding the 1TB disk to my OEL machine.

The platform I’m using is Oracle Linux Server 8.9.

Step 1: Connect to the Compute Node

Log in to your compute node via SSH:

$ ssh -i ~/.ssh/id_oci_rsa opc@{ip address}

Step 2: Verify the Disk Configuration

Check to see if the disk is correctly recognized by the OS:

$ ll /dev/oracleoci/oraclevd*

You should see output similar to this:

lrwxrwxrwx. 1 root root 6 Dec 23 18:27 /dev/oracleoci/oraclevda -> ../sda
lrwxrwxrwx. 1 root root 7 Dec 23 18:27 /dev/oracleoci/oraclevda1 -> ../sda1
lrwxrwxrwx. 1 root root 7 Dec 23 18:27 /dev/oracleoci/oraclevda2 -> ../sda2
lrwxrwxrwx. 1 root root 7 Dec 23 18:27 /dev/oracleoci/oraclevda3 -> ../sda3
lrwxrwxrwx. 1 root root 6 Dec 23 19:13 /dev/oracleoci/oraclevdb -> ../sdb

The disk we are looking for is /dev/sdb, which corresponds to /dev/oracleoci/oraclevdb.

Step 3: Create the Mount Point

Create the directory where you want to mount the disk:

$ mkdir /oracle_data

Step 4: Update /etc/fstab

Add the disk to /etc/fstab so it automatically mounts on reboot:

$ vi /etc/fstab

Add the following line:

/dev/oracleoci/oraclevdb /oracle_data xfs defaults,_netdev,nofail 0 2

A few things to note here: the file system on the disk is xfs. In order for the disk to remount on a reboot, I added _netdev. The nofail option is optional and was only added because I was using a custom image for the build.

Step 5: Reload the Daemon and Mount

Refresh the systemd daemon before mounting:

$ systemctl daemon-reload

Now mount the disk:

$ mount /oracle_data

Step 6: Verify the Mount

Confirm the disk is mounted correctly:

$ df -h

You should now see /dev/sdb mounted under /oracle_data, giving you the additional storage space for your development environment.

Summary

Mounting a block volume in OCI is straightforward once you understand the process. The key steps are verifying the disk configuration, creating the mount point, updating /etc/fstab with the correct options, and mounting the disk. This approach ensures your storage persists across reboots.


Let me know if you’d like any adjustments to the length, technical depth, or formatting.

Please follow and like:

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.