Physical to Virtual Migration (P2V)

Switching to the cloud can appear daunting. But it’s actually fairly straightforward – and certainly no harder than expanding a physical server to cope with increased demand, which once you’re in the cloud, you’ll never have to do again.

So here is our easy to follow guide to moving data and applications from an existing server to an ElasticHosts cloud server. The approaches listed here will work for physical servers, or for virtual servers not created on ElasticHosts’ platform.

Basically, you have three options for setting up your applications and your data on your new server:

1. Set up OS from scratch

Set up your OS and applications from scratch, and just copy over your data from your old server. This is the most intuitive and approach, but potentially the most time-consuming: it can be a good choice if you have few applications or simply want a clean start for your new cloud server.

This approach may also be best if your applications rely on your server’s hardware configuration – for example, if hardware is tested as part of a licensing check. In these cases, installing from scratch can prevent problems arising when the software finds itself running in a new environment.

Please be aware that if you are running one of our Elastic Containers, you should always choose this method! Containers work very differently from physical or other types of virtual servers and in many cases, transferring the operating system from one of these environments won’t work as you might expect.

2. Backup and restore your server

Some backup tools allow you to create specific backup images which can be uploaded to the cloud and restored to a new disk. Many of these allow you to preserve files, structure and configuration, and some backup tools may offer additional features such as compression or encryption of sensitive data. Most of all, these often come with a built-in ‘restore’ feature of some kind, making it very simple to get your server up and running in the cloud.

3. Upload VM image

Upload a complete VM image using our API scripts, including all applications and data as a single file. This is possible with any OS, straightforward, and frankly, cool – but can involve your site being down for some time.

We’ll look at each option in turn.

Option 1: Set up the OS from scratch

The procedure for this is as follows:

  1. Create your ElasticHosts cloud server with an operating system that is the same as your existing server. You can use one of our pre-supplied OS images or, if you’re using a Virtual Machine (VM), upload the install media of your choice.
  2. On your new server, reinstall the applications you need to use.
  3. With your old server still running, copy over your data to the ElasticHosts server. Set up your ElasticHosts server and check everything works.
  4. At switchover time, stop your old server, and make any final changes needed to bring the cloud server up to date.

If possible, we recommend using an incremental backup tool here so that you only copy changed files or file deltas (diffs): this will be much faster and lighter, minimising any downtime involved.

This is a conceptually simple approach, and usually results in a cleaner install.

If you’re using an Elastic Container, or a Folder filesystem with a VM, don’t forget that you can upload files directly to your Folder – making this even easier.

Option 2: Backup and restore your server

Some backup software can create ‘bare metal’ images, so that you do not have to build a new OS or install any software but can quickly restore to a new disk using the saved image.

Our control panel and API upload tools let you easily upload such images to the cloud and restore them to a new disk to get you up and running as fast as possible.

Option 3: Upload a complete VM image

This may be the most straightforward approach for VM users, and has the benefit of being available to upload complete, working copies of machines running any operating system to the cloud.

However, it can involve your existing server or site being down for some time, particularly if your filesystem is large: you may also find that uploading your site takes considerable bandwidth.

We’ll cover this in a bit more detail than the other methods, since it requires some introduction to our API scripts. To do this:

  • Stop your old server and reboot it from a Linux Live CD. This will ensure no files are being modified during the transfer, and provide an easy environment for us to run the API scripts.
    You can use any version of Linux you choose: we like Linux Mint, as it has a great GUI interface and is simple to use even if you’re not familiar with Linux.
  • Once it’s loaded, open a terminal and give yourself superuser privileges. Most LiveCDs will let you do this by typing
    $ sudo bash
  • Here’s the clever part. In Linux, everything is treated as a file – even disk devices. We just need to know the name of the file we’re uploading.
    Typing ‘fdisk -l’ or ‘lsblk’ will show you the name of your disk: here’s some output from fdisk on our sample system:
    $ fdisk -l
    Disk /dev/sda: 320.0 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1         122      979933+  fd  Linux 
    /dev/sda2             123       38913   311588707+  fd  Linux
The disk here is /dev/sda, and the partitions are /dev/sda1 and /dev/sda2\. We’re going to upload the whole thing, including partitions and bootloader: so we’ll be pointing the scripts at “/dev/sda”.

* After that, uploading is as simple as following this step-by-step worked example. When prompted for a filename, simply enter the name of your disk as seen earlier:

    $ ./elastichosts-upload.sh /dev/sda

That’s it – when the script is finished running, you’ll have a complete, bootable copy of your physical server or VM in your ElasticHosts account.