Use case: you have an Oracle Cloud instance but lost SSH access to it. To recover access, you need to know which pubkey you used on it, or which port SSH is listening on. Or, you don't want to terminate it before you make sure it doesn't contain important data.
Solution: you will have to clone a boot volume of that instance and attach it to another 'dummy' instance
Clone the boot volume
- Go to https://cloud.oracle.com/block-storage/boot-volumes
- Find the boot volume of the instance you need to recover. Click the three dots on it and Create Clone. Give the new clone a name that makes sense (so you can recognise it later when cleaning up).
Create an empty dummy instance
Attach the cloned volume to the dummy instance
- Open your dummy instance and under Resources on the left click Attached block volumes → Attach block volume
- In the pop-up that appears:
- Volume: choose your cloned volume
- Attachment type: Paravirtualized
- Access: Read/write
At this point, your dummy instance should see the newly attached volume without rebooting
Mount the volume on the dummy instance
SSH into your dummy instance and elevate to root (sudo su -
)
- Run
lsblk -o NAME,FSTYPE,LABEL,SIZE,MOUNTPOINT
(alternatively,fdisk -l
) to list the volumes attached to your instance. The cloned volume you just attached is likely to be listed last and it's partitions won't have a mountpoint. - Create a directory to mount into
mkdir /mnt/recovery
mount -t auto -v /dev/sdb1 /mnt/recovery
The files from the attached volume are available at /mnt/recovery
Cleaning up
Oracle may charge you for the extra resources you just created. Clean up to avoid unnecessary costs
- Terminate the dummy instance
- Terminate the boot volume for the dummy instance
- Terminate the cloned volume