# Sync/Migrating a kvm/xen vps to Amazon/similar cloud



## sanjay_arora (Aug 27, 2015)

Is it possible to sync a live kvm/xen vps to a cloud provider like amazon? Possible use case of bringing the cloud image to use by change of dns entries, in case of failure of main vps. Down time in such case limited to dns ttl plus dns propagation time. Possible at all? Issues involved?

And as regards to why not use cloud provider for vps directly so that they are migratelable? Well, commodity vps costs are much lower and they charge on a fixed basis, not by indeterminable factors like disk access, bandwidth etc., which can end up surprising you with huge bills.


----------



## perennate (Aug 27, 2015)

I don't understand, if the main virtual machine fails, then how do you intend to transfer its disk to the cloud provider (given that the host node that it was on is presumably now offline)? Or if you mean you want to keep the disk synchronized between two hypervisors, that's not really possible unless you have control over both, and usually it'd be accomplished with distributed block storage (although making disk redundant across data centers is always going to be slow).

Better to sync on an application level, e.g. MySQL master-slave replication + regular rsync.


----------



## sanjay_arora (Aug 27, 2015)

True, application level sync would be easier to implement.

That said, and agreeing that distributed block storage replication may be the way to go in os level sync, even if slower, my question is are the vps storage formats portable, does it or anything else have any dependency in the way of how the hypervisor is configured? e.g. if I were to copy the vps (not live) from one linux server to another, would it boot up & run, regardless of the os or how it is configured, provided the hypervisor is running correctly?

Similarly, would a  xen image boot up on amazon if shifted from a linux kvm server? I believe Amazon runs xen. My question is about the portability of vps container and would work across different vps servers regardless of server settings, kvm to kvm, xen to xen and kvm/xen to amazon/rackspace?


----------



## perennate (Aug 27, 2015)

On Xen HVM and KVM, the disk image can be copied over and usually the OS will boot without any problems (especially if it's Linux), this includes transferring between Xen HVM and KVM (qemu supports a wide range of disk formats, but your provider might have a restriction, so you may have to manually convert the image with a tool like qemu-img; although most Xen HVM and KVM providers either use raw storage, whether it's file or direct block device, or qcow2 image).

Xen PV is difficult to transfer to the other two, as you have to install bootloader and other stuff. Still possible though, but hard to automate.


----------

