How to Replicate or Move a VM to Another Host Efficiently
Replicating a virtual machine to another host is creating a copy of primary host to another host which contributes to quick disaster recovery and data migration.
The need to replicate or move a VM to another host
Copying, or replicating a VM to another host is an efficient solution for virtual machine protection that benefits in fast disaster recovery or data migration. More specifically, you may need to migrate VM from one ESXi host to another in the following situations:
✤ Replicate all VMs and transfers changed data to another host almost simultaneously.
✤ Copy one or several VMs to another host for testing, impending failure, or unexpected disaster recovery.
✤ For data management purposes, you want to move the VM to another server for subsequent work...
This is not the full range of possibilities, but a few common scenarios. When looking for a viable solution, you may also need to consider some practical factors, such as whether you have enough budget, whether you can utilize vCenter, etc. In the following article, I will explain this in detail.
Depending on the situations mentioned above, you may have a number of different methods to choose from.
☛ Relicate all VMs from ESXi host to another host
If you want a hypervisor-based replication solution for all virtual machines in your environment for rapid disaster recovery, you may consider vSphere Replication in VMware, which is an equivalent of Hyper-V replica for Microsoft.
VMware vSphere Replication was introduced in VMware vSphere 5.1 Essentials Plus Kit to replicate VMs within the same site or remote sites. It allows you to configure Recovery Point Objects (RPOs) between 5 minutes and 24 hours for replication intervals.
However, as an enterprise failover solution, vSphere Replication can be rather expensive. If you only need to migrate individual virtual machines or have low business continuity requirements, then this approach may be a bit too much.
☛ Copy one or several VMs to another host
If you intend to replicate few VMs while keeping an copy in the current host, then what you are looking for may be VM cloning or migration. To do this, you can either use the Clone feature in vCenter, or use export & import as workaround. In addition to this, you can hot backup a VM and perform out-of-place recovery to achieve VM migration, which may be a more flexible way.
☛ Move VMs from one host to another
If you want to move certain virtual machines to another ESXi host, without keeping an copy in the original location, then you can use vMotion (requires vCenter) to do the job.
Now let's take a look at these situations and methods one by one.
Before replicating VM to another host via vSphere replication, make sure you have installed it. Please refer to the following steps to install vSphere replication first, and follow the guide to configure it.
Prerequisite: Install vSphere Replication on both sites
1. Download the vSphere Replication ISO image from VMware Portal and mount the ISO to your local machine.
2. Log in vSphere client and navigate to vCenter on the primary site, right click the host your want and select Deploy OVF Template.
3. In the opening wizard, select Local file >> UPLOAD FILES, find the location of the mounted ISO, select all .ovf and .vmdk files you need, then click Open.
4. Follow the wizard to name the vSphere Replication VM and select a destination folder -> Select a host for the replication resource, and validate it -> Confirm the setting information -> Scan the items, and select I accept all license agreements.
5. Select a deployment configuration, choose 2 vCPU or 4v CPU according to your need.
6. Select virtual disk format and datastore for the vSphere replication, and click Next.
7. Select a destination network for vSphere replication appliance, and specify the IP setting, then click Next.
8. Customize the deployment properties and check the information you fill in -> Choose the provider of vServices to which the deployed OVF templates should bind -> Then check all the settings, and click Finish to complete the deployment.
9. Log out vSphere client and log into https://IP-Address:5480. Navigate to Configuration, and enter the LookupService Address and passwords. Click Save and Restart Service.
After installing vSphere replication appliance service on both sites, you can go to copy a VM to another host. This part introduces the procedures of replicating a VM to another host.
Step 1: Pair new site in vSphere client
1. Log in vSphere client, click Menu >> Site Recovery >> OPEN Site Recovery >> NEW SITE PAIR.
2. Select the local vCenter you want to pair and enter the required information, then click Next. If a security certificate warning appears, click CONNECT.
3. Select the vCenter server and vSphere replication, then click Next.
4. Review the settings are correct, then click Finish.
Step 2. Configure VM Replication step by step
1. Go back to vCenter, and right click a VM you want to replicate to another host. Click All Site Recovery actions >> Configure Replication to open a wizard.
2. Target site: select the target site to store VM replication, and choose Auto-assign vSphere Replication Server.
3. VM validation: verify if the VM could be replicated to another host. Click Next.
4. Target datastore: choose the sort of storage and datastore for replication. Click Next.
5. Replication settings: specify recovery point objective (RPO) from 5 minutes to 24 hours. Click Next.
6. Ready to complete: Review the configuration information, click Finish to close the wizard.
Refresh the page, and you can notice the configured replication presented on the Outgoing page.
As mentioned earlier, you do not actually need to use vSphere Replication if you only want to copy individual VMs to another ESXi host. Instead, you have several easier options.
Way 1: Backup VMs and restore to another host flexibly (without vCenter)
If your requirements for business continuity are not as high as site replication, or you want a more long-term secure data protection solution, then you can consider the much easier backup and restore way for VM migration. Here I will use a professional VMware backup and migration software to copy VMs to another host easily.
AOMEI Cyber Backup is a centralized VMware & Hyper-V backup solution that can copy multiple virtual machines automatically and restore any backup version of any VM to another host with a few clicks.
Specifically, you can enjoy the following benefits:
✦ Agentless Backup: create complete and independent image-level backup for both paid and free versions of VMware ESXi and Hyper-V VMs.
✦ Multiple VM Backup: batch backup large numbers of VMs managed by vCenter Server, or multiple VMs on a standalone ESXi host.
✦ Hot Backup: back up all the virtual machines while running, no need to power them off beforehand.
✦ Restore to New Location: instantly restore full VM to another host or datastore from any selected restore point.
✦ Automated Backup: schedule virtual machine backup and create a policy to automate old backups cleanup.
✦ Easy-to-use: use click-based and intuitive GUI to complete backup and recovery task easily and centrally.
Click the download button to start a 30-day free trial and experience all the features:
*You can choose to install this VM backup software on either Windows or Linux system.
Backup and Restore VMs to another host easily:
1. Launch the software. Click + Add VMware Device to Add vCenter or Standalone ESXi as the source device, and click Backup Task >> Create New Task.
2. In the opened window, name the backup task, select VMs to back up and location to store the backup files.
- In Schedule section, configure the backup methods and the frequency to run the task automatically. Click OK.
- In Backup Cleanup, specify retention policy for each backup that will delete the unwanted backup files automatically.
Click Start Backup to execute the task. When it's complete, you can then copy a VM from any backup.
3. Restore VM to another host. After backing up the VMs, you can click Restore to recover any VM from any backup version, and select Restore to new location.
This option will create an identical VM from the backup to the same or another host/datastore (optional), without reinstalling or configuration the new VM and applications.
The whole process to another host is based on several clicks. The reliable tool offers a comprehensive backup of multiple virtual machines, and simplifies the procedures of recovery to another host. Even if the original virtual machine is corrupted, you can still create a new virtual machine as the same as the previous one by restoring VM to another host.
Way 2: Replicate VM to another host via clone feature (with vCenter)
If you can utilize vCenter Server, then this may be the easiest way to go:
1. Access vCenter Client, right-click on the VM name and select Clone > Clone to Virtual Machine.
2. Provide a Name and select a destination datastore folder location for the new VM. Then select a destination host for the new VM as well.
3. Configure the virtual disk format and VM Storage Policy as you need, and select a datastore location to store the VM files. Click Next to continue.
4. You can also customize the operating system, VM’s hardware, and whether to power on the VM after creation. Review all the settings and click Finish to start. You can see the progress in Recent Tasks.
✎Tips: Copy VM to another host via PowerCLI
If you are familiar with command line, you can also clone ESXi VM with command line. For example:
SSH into your ESXi host and create a directory to hold your new clone:
Clone your Host1 VM to Host2:
Register the virtual machine in ESXi host:
Use these commands correctly and then you can do the job more flexibly.
Way 3: Migrate VM to another host via export and import (without vCenter)
If you cannot utilize vCenter, then you can also use this way as a workaround to replicate a VM to another host. That is, export VM from ESXi management console, and then import it to another host.
How to export VM from ESXi host:
1. Log in ESXi and right-click the VM to select Export. Note when exporting a VM, it cannot export snapshot in VMware. So if you want to export snapshot from virtual machine, you can copy the VM files to register a new VM.
2. In the open wizard, select the related files such as .ovf, .vmdk and .mf -> Specify a destination to store the files -> Check the local path and exported files.
After finishing exporting a virtual machine from ESXi, you can register a new virtual machine and therefore clone a VM, or migrate a VM from a host to another.
How to import virtual machine to another host:
1. Click Create/Register VM in the target host.
2. On the Select creation type page, choose Deploy a virtual machine from an OVF or OVA template. Click Next.
3. Type a name for the virtual machine, and then select the exported .ovf and .vmdk files. Click Next.
This way, you can copy VM to another host without vCenter. For more details, please read export and import VM.
vSphere vMotion enables zero-downtime, live migration of workloads from one server to another so your users can continue to access the systems they need to stay productive.
If you want to move a VM to another host for data migration without downtime, please refer to this part.
Step by step to move VM to another host:
1. Log in vSphere web client, and right-click a VM and select Migrate.
2. On Select the migration type page: select Change compute resource only which means only to migrate the virtual machines to another host or cluster and do not change the storage. Then click Next.
3. On Select a compute resource page: see all available hosts on the box, and select a target host that you want to migrate to, then verify the compatibility. Click Next.
4. On Select networks page: select a new destination network for the virtual machine migration. You can keep the VM network as default, and click Next.
5. On Select vMotion priority page: select Schedule vMotion with high priority. Click Next.
6. On Ready to complete page: view all settings, if you are satisfied with them, click Finish to complete the migration to another host. Then you can go to the target host to check if the migration is successful.
If you are finding the solution to migrate a VM to another host in Hyper-V, please refer to this article: Move-VM.
vSphere replication offers an efficient way to replicate VM to another host. But when you only want to copy or move few virtual machines, or have a higher tolerance for downtime, then you may try other methods stated in this article for VM migration, such as clone, export & import, or the effective VM backup software AOMEI Cyber Backup.
In addition to vSphere Replication, some users may want to know more about VM Failover system based on their different virtual environments, which offers a high-available VM strategy.