Block volume backup allow you to make a point in time snapshot of the data on a block volume. It can be backed up anytime whether it is attached or detached from an instance. Backing up block volume can be achieved easily using the OCI web console. You can select from 3 oracle defined backup policies which are gold, silver and bronze with different backup type, backup schedules and retention period. Should you find the configuration not appropriate, you may define a custom backup policy with your own configuration of backup type, backup schedule and retention period.
If you take a closer look to the configuration as shown in the following screenshot, when adding schedule, you can choose the schedule type as either, Daily, Weekly, Monthly or Yearly.
And for daily schedule, if you scroll down the hour of the day, as per the screenshot shown below, you can only select at most once everyday.
What if you want to backup every 2 or 3 hourly. There is no way (at least as of now) that you can achieve it in the web console. So here is the workaround that I would show you.
For information on how to install OCI CLI, you may refer to here.
To create a backup of a block volume, find out the block volume id. It is the OCID field in the block volume details.
To run a backup using OCI CLI, run the following command. This will by default run an incremental backup. If you want a full backup, just add -type full at the end of the command.
|oci bv backup create –volume-id <Block Volume OCID>|
For backup created using OCI CLI, you will need to maintain the retention of the backup manually, which means that you will need to manually delete the backup, or else the backup will be stored indefinitely.
I will show an example of housekeeping the backup using bash script with OCI CLI. Please take this as a reference and test thoroughly before you adopt it.
The script will required a command line tool called "jq" to parse the output of OCI CLI.
compartmentList=$(oci bv backup list --compartment-id "ocid1.compartment.oc1..aaaaaaaau337m2maguz3zrssc4ie3jfkyfxalbpmgu2wglo26l7dg3nxmyaa")
for i in $(echo "$compartmentList" | jq '.data | keys | .')
# Enable the following block only when you want to delete block volume backup that is greater than $retention
Backing up block volume could be done either in OCI web console or OCI CLI. However, if you have a requirement to backup a block volume multiple times within a day, OCI CLI should be the tool for you.
If you want to know more about how to setup OCI CLI to perform manual backup of block volume in OIC, you may follow links as below.
Click here to learn more about OCI CLI.
Click here to learn more about backup policies in OCI console.