Device name persistence in the cloud: OCI

Device name persistence is an important concept for everyone deploying the Oracle database. In this little series I’ll show how you can achieve device name persistence with Oracle Cloud Infrastructure (OCI) and block storage. I am hoping to share future parts for Azure and AWS.

In the example I’m going to prepare a cloud VM for the installation of Oracle Grid Infrastructure 19.9.0. To do so I have created a number of block devices in addition to the boot volume:

  • One block volume to contain the Oracle binaries
  • Two block volumes to be used as +DATA
  • Two more block volumes for +RECO

This is going to be a playground environment, the block volume size is unrealistically small. You will certainly need larger block devices for a production environment. Additionally there is most likely a cost associated with creating these resources, be careful!

Block devices

The following block devices have been created previously, and are waiting to be attached to the VM:

cloudshell:~ (eu-frankfurt-1)$ oci bv volume list -c $C \
 --query "data [?contains(\"display-name\", 'dbinst1')].{AD:\"availability-domain\",name:\"display-name\"}" \
 --output table
+--------------------------+--------------+
| AD                       | name         |
+--------------------------+--------------+
| IHsr:EU-FRANKFURT-1-AD-3 | dbinst1-bv01 |
| IHsr:EU-FRANKFURT-1-AD-3 | dbinst1-bv02 |
| IHsr:EU-FRANKFURT-1-AD-3 | dbinst1-bv03 |
| IHsr:EU-FRANKFURT-1-AD-3 | dbinst1-bv04 |
| IHsr:EU-FRANKFURT-1-AD-3 | dbinst1-bv05 |
+--------------------------+--------------+ 

These now need to be attached to my VM, called dbinst1. You may have guessed ;)

Block device attachment

Once the block devices are created, they need to be attached to the VM. There are many ways to do so, but since I’m using a script in Cloud Shell I went with the OCI Command Linue Interface (CLI). For example:

oci compute volume-attachment attach-paravirtualized-volume \
--instance-id ocid1.instance.oc1.eu-frankfurt-1.a...a \
--volume-id ocid1.volume.oc1.eu-frankfurt-1.a...q \
--device "/dev/oracleoci/oraclevdf" 

This command attached the 5th block volume to the VM as /dev/oracleoci/oraclevdf. I have other volumes attached as /dev/oracleoci/oraclevd[a-e] already. Note that I opted to add the block volumes using paravirtualised option. This is fine for my playground VM where I don’t really expect or need the last bit of I/O performance. If you need performance, you need go with the iSCSI attachment type.

Block device use

And this is all there is to it: the para-virtualised block devices are immediately visible on dbinst1:

[opc@dbinst1 ~]$ lsscsi
[2:0:0:1]    disk    ORACLE   BlockVolume      1.0   /dev/sde 
[2:0:0:2]    disk    ORACLE   BlockVolume      1.0   /dev/sda 
[2:0:0:3]    disk    ORACLE   BlockVolume      1.0   /dev/sdb 
[2:0:0:4]    disk    ORACLE   BlockVolume      1.0   /dev/sdd 
[2:0:0:5]    disk    ORACLE   BlockVolume      1.0   /dev/sdc 
[2:0:0:6]    disk    ORACLE   BlockVolume      1.0   /dev/sdf 
[opc@dbinst1 ~]$  

The only thing to be aware of is that you shouldn’t use the native block device. Instead, use the device name you assigned when attaching the block device:

[opc@dbinst1 ~]$ ls -l /dev/oracleoci/*
lrwxrwxrwx. 1 root root 6 Nov 24 06:38 /dev/oracleoci/oraclevda -> ../sde
lrwxrwxrwx. 1 root root 7 Nov 24 06:38 /dev/oracleoci/oraclevda1 -> ../sde1
lrwxrwxrwx. 1 root root 7 Nov 24 06:38 /dev/oracleoci/oraclevda2 -> ../sde2
lrwxrwxrwx. 1 root root 7 Nov 24 06:38 /dev/oracleoci/oraclevda3 -> ../sde3
lrwxrwxrwx. 1 root root 6 Nov 24 06:38 /dev/oracleoci/oraclevdb -> ../sda
lrwxrwxrwx. 1 root root 6 Nov 24 06:38 /dev/oracleoci/oraclevdc -> ../sdb
lrwxrwxrwx. 1 root root 6 Nov 24 06:38 /dev/oracleoci/oraclevdd -> ../sdd
lrwxrwxrwx. 1 root root 6 Nov 24 06:38 /dev/oracleoci/oraclevde -> ../sdc
lrwxrwxrwx. 1 root root 6 Nov 24 07:18 /dev/oracleoci/oraclevdf -> ../sdf
[opc@dbinst1 ~]$  

My Ansible playbooks reference /dev/oracleoci/oraclevd*, and that way ensure device name persistence across reboots. Happy automating!