OCI Block Volume - Export Steps
This document is intended as guide for the steps OCI customers can take to extract OCI Block Volume data and move it to another cloud provider or to their on-prem facility. Similar steps can be used when migrating OCI Block Volume data across tenancies with restricted security access.
Option 1: Extract and Transfer Block Volume Data
If your block volume is not a boot volume, then the block volume data can be extracted manually and then converted to the proper format required by another Cloud Provider or for on-prem usage.
Step 1: Attach the Block Volume to an OCI Compute Instance
Prerequisite: A Linux-based compute instance must be available for attaching the block volume to.
- On the Block Volumes list page, select the block volume that you want to attach to an instance. If you need help finding the list page or the volumes, see Listing Volumes.
- On the details page, select Attached Instances.
- Select Attach to Instance.
- On the Attach to instance panel, enter the following information.
- Attachment type: Select ISCI.
- Instance: Select the instance that you want to attach the block volume to.
- Select Attach.
- Connect to the Linux instance by running each command in sequence, in the Console:Note
All command arguments are essential. Success returns no response.sudo iscsiadm -m node -o new -T <volume-IQN> -p <iSCSI-IP-address>:<iSCSI-port>
sudo iscsiadm -m node -T <volume-IQN> -o update -n node.startup -v automatic
sudo iscsiadm -m node -T <volume-IQN> -p <iSCSI-IP-address>:<iSCSI-port> -l
For more information on connecting to a volume on a Linux instance, see Connecting to a Volume on a Linux Instance.
- Verify the block device appears (typically as
/dev/sdb
or similar) by use of the Linuxlsbk
(list block devices) command:lsblk
Step 2: Create a Raw Disk Image
- Decide where to store the block volume image.
- If the image file is small enough (for example, less than 100 GB), you can store it locally in
/mnt/
or another large partition on the boot volume. - If the image file is large, you might need to attach an additional block volume to store it.
- If the image file is small enough (for example, less than 100 GB), you can store it locally in
- Run the
dd
command to capture the entire block volume into a raw disk image:sudo dd if=/dev/sdb of=/mnt/volume.img bs=1M status=progress
where:/dev/sdb
is the attached block volume./mnt/volume.img
is the location to store the Block Volume image.bs=1M
indicates large blocks to improve read/write efficiency.status=progress
shows progress.
Step 3: Convert the Image to Another Format
Prerequisites: To get the functionality in this step, you might need to install qemu-img
or qemu-tools
on your distribution.
Convert the raw image to the required format based on the target cloud or on-prem destination:
qemu-img convert -f raw -O vmdk /mnt/volume.img /mnt/volume.vmdk
qemu-img convert -f raw -O vhdx /mnt/volume.img /mnt/volume.vhd
qemu-img convert -f raw -O qcow2 /mnt/volume.img /mnt/volume.qcow2
Step 4: Upload the Block Volume Image to OCI Object Storage
Move the image from the instance to a bucket using the following command:
oci os object put -bn my-bucket --file /mnt/<filename>
Example for an unconverted image:
oci os object put -bn my-bucket --file /mnt/volume.img
Example for an image converted to VMDK format:
oci os object put -bn my-bucket --file /mnt/volume.vmdk
Step 5: Transfer to Another Cloud Provider
Prerequisite: The image must be converted to VHD format. See Step 3: Convert the Image to Another Format.
Option 2: Create a Bootable Image for a Boot Volume and Export It
If your block volume is attached to a compute instance as a boot volume, you can create a custom image and export it.
- Create a custom image from the instance that uses the block volume as a boot volume.
- Export the custom image to a bucket in Object Storage.
- Download and transfer the image:
- Use the OCI CLI to download the exported image to your workstation:
oci os object get -bn my-bucket --name exported-image.qcow2 --file exported-image.qcow2
- Upload the file from your workstation to your target cloud provider and import it in the native virtual disk format using commands at Step 5: Transfer to Another Cloud Provider.
- Amazon Web Services (AWS): Upload to S3, then convert it into an EBS snapshot.
- Google Cloud Provider (GCP): Upload to Cloud Storage and create a persistent disk.
- Microsoft Azure: Convert to VHD format, upload to Azure Blob Storage, then create a managed disk.
- Use the OCI CLI to download the exported image to your workstation: