Move OCI Windows Instances between regions and tenants

By | April 27, 2019

IGNORE THIS POST: OCI now officially supports exporting Windows Instances, so you no longer need to do any of this trickery 🙂

Most instances (VMs and Bare Metal) can be exported, so that they can be copied/transferred to other regions or other Cloud Accounts. One type of instance does not support this, these are the instances created based on Oracle provided Windows. This has to do with the licensing deal between Oracle and VMware.

So is it really not possible to move you your Windows VMs??? Of course you can 🙂

Here is a method on how to move / copy / duplicate your Windows instances between regions / tenants.

Prepare the destination:

  • Create on the destination, where you want to move your Windows VM to, a new Windows Instance.
  • After it is provisioned, stop the instance and wait for the instance to be stopped.
  • Go to the Boot Volume and Detach the boot disk from the Instance
  • Create a (temporary) Linux VM on the destination side, I tested this with Ubuntu 18.04. Make sure the Linux VM is in the same Availability Domain as the Destination Windows VM.
  • Goto attached block volumes on the Destination Linux VM and add the Destination Windows Boot disk, as paravirtualized and with read/write permissions.

Prepare the source:

  • Stop the Original Windows VM you wan to move. When it is stopped, also detach it’s boot volume.
  • Create also on the source side a Linux VM and attach the Original Windows boot volume to this VM as paravirtualized, but you can give it just READ ONLY permission (to be on the safe side).

Block level copying:

Open a SSH / Putty session to both source and destination Linux VMs. The default username is: ubuntu

We are going to use the linux dd command to copy over the source disk, block by block (very low level) and overwrite the destination disk. This is done over the network, so this can be done to anywhere you like.

While the dd command is very powerful, it’s “interface” is pretty shitty as there is no displayed output. I do like to know what is going on, so we need to install a small utility called pv. Run the following commands in both your Linux VMs:

sudo apt install pv

There are a few options on how we can send over the data. You can use SSH, which is slow but encrypted or use Netcat which is fast but unencrypted. Here an interesting blog post about the difference between the 2 options: https://www.ndchost.com/wiki/server-administration/netcat-over-ssh

Below the example of using Netcat. You can use any port number for the traffic, just make sure you modify your security list for the destination target, that is allows that port as incoming traffic. In my example, I will use port 1900. Important: also disable the firewall inside the Destination Linux VM by running the command:

sudo iptables -F

Now we start NetCat listening on the Destination Linux VM:

nc -l 1900 | pv | sudo dd of=/dev/sdb bs=100M

Then we start the copying process on the Source Linux VM:

sudo dd if=/dev/sdb bs=100M | pv | nc 130.61.125.192 1900

Depending on the size of the Boot disk and the speed of the public internet, this can take “some time”.

Extra option:

If you are worried about your ssh session disconnecting during the transfer, you can first run the command screen in both sessions.

The Netcat session will stay for ever, so you need to stop is manually by control-C when you see that the transfer is done.

All you need to do, to complete this operation:

  • Stop the linux VMs and detach the Attached boot volumes
  • Re-attach the Windows Boot disks to the Windows instances.
  • The new Windows instance will now be an exact copy of the orginal Windows instance.

This method leaves you with a “new” official OCI Windows VM, that has the contents of your source VM. It runs in the same native mode and you will still be paying for a Windows VM.

Category: OCI

5 thoughts on “Move OCI Windows Instances between regions and tenants

  1. Kumar

    In the first para, you say: “This has to do with the licensing deal between Oracle and VMware.”

    Did you mean “Oracle and Microsoft”?

    Reply
  2. ZeroNetSorcer

    Why not use the volume groups and volume group backups? You can put this into object storage, issue a PAR for the bucket in question, and load the back-up into the new environment’s vm.compute image running windows w/o causing any issue, data is moved, new image is now instantiated, and you can continue operating your snowflake compute effectively…

    https://blogs.oracle.com/cloud-infrastructure/introducing-volume-groups:-enabling-coordinated-backups-and-clones-for-application-protection-and-lifecycle-management

    https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumebackups.htm

    https://docs.cloud.oracle.com/iaas/Content/Block/Tasks/copyingvolumebackupcrossregion.htm

    https://docs.cloud.oracle.com/iaas/Content/Block/Tasks/restoringavolumefromabackup.htm

    Reply
    1. richard Post author

      i am not aware of this method, will for sure test it out when back from holiday and update the article accordingly if it works.

      Reply
    2. RichardJ

      Unfortunately, cross region copying of boot volumes/boot volume backups via tooling is not supported at this time.

      Reply
  3. Tony Walker

    Export / Import doesn’t include block volumes attached to instances. There is currently no way copy block volumes between tenancies.
    This method is the only way.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.