One of the most important features of Hyper-V 2012 is the replication feature. It allows you to make a workable copy of a virtual machine (replica) on another server within a few minutes. Unlike the “classic” disaster recovery scenarios, the replica can be used to migrate a virtual machine (VM) to a new infrastructure or to another domain.
But what if the old server runs on Windows Server 2008 R2? How can I move the VM to the new Hyper-V 2012 R2? If you do not want to pay, you can use the standard “export / import” procedure, but such an operation may require several minutes for each VM, depending on the speed of the disks where the data is exported.
Another way is to use Veeam Backup & Replication, which allows you to create a job for replicating a VM (Replica Job) even if the OS versions of the source and remote hosts are different.
The first step is to install a driver on each host that includes the Change Block Tracking (CBT) mechanism. After that, you can start creating a task for VM replication.
Next, you need to create a name for the task, select the VM that you want to copy from the source host.
Then you need to select the destination server where replication is performed and the location of the VM files.
Next, select the suffix for the name of the replica and the number of recovery points, the recovery point (the point may not be the latest, since our goal is to migrate the VM, and not restore the latest working version).
After this step, you need to choose whether to use the Volume Shadow Copy (VSS) service. The service is needed to ensure data consistency and is critical when working with VMs, which use applications that conduct database transactions (SQL, Exchange, AD, etc.)
Then select a work schedule and activate the task. The VM will be available in a few minutes on a new host (depending on its size and the performance of the hosts). That's all! You can shut down the VM on the old server, deactivate the task for replication and turn on the VM on the new host.
It is clear that the classic replica is not good enough, since such an operation cannot be performed during the working day, so it is very important to follow the correct strategy. My recommendation here is to use 2 tasks for replication: one is early in the morning and the second is late at night. This will reduce the replication “window”. It is important to remember that such an operation should be done outside working hours, possibly over the weekend, when there is more time to solve unexpected problems.
Why is replica better than backup? Just because the replica creates an ideal copy of the VM on the new host, and it can be great if you plan to change the basic infrastructure (server and storage). The replica also makes it possible to reduce the time it takes to complete the operation, since it only needs to add newly modified data blocks when the backup job takes time to restore the VM to the new host.
Another "trick" in Veeam Backup & Replication is the ability to use Windows PowerShell snap-in, which allows you to automate various processes without using a UI. The tool will have to be especially in place when there are many customized tasks at hand or repeated actions are performed.
I remind you that Windows PowerShell snap-in is a separate component that requires installation, so if it is not there, just run the installer and reinstall the necessary component.
With PowerShell, you can create a script to automate the described operations.
“Turn off VM”, “start replica tasks”, “start VM on new server”, “deactivate replica tasks” - all this is possible without using the main console. However, it should be remembered that in order for the PowerShell scripts to work correctly, the modules must be installed on the same server as Veeam Backup & Replication. It also requires the use of the same OS versions for Veeam and Hyper-V hosts (for example, Windows Server 2012 for Veeam and Windows Server 2012 R2 for the new host).
It is also important to enable PowerShell on Hyper-V 2008 R2 and import the PowerShell library management module for Hyper-V, which can be found on the CodePlex website: pshyperv.codeplex.com .
Observe the following requirements:
Copy the HyperV folder (from the archive downloaded from CodePlex) to C: \ windows \ system32 \ windowsPowerShell \ v1.0 \ modules
The script is made to perform routine operations automatically, as well as use cmdlets, which are disabled by default. Remember, to work with Windows Server 2012 R2, you must use the version of Veeam Backup & Replication not lower than v7 R2!
Thus, we got an interesting solution for automation. When the standard functionality of Veeam Backup & Replication v7 may not be enough, the PowerShell snap-in provides an opportunity for expansion. If you are interested in Veeam Backup & Replication, then download the trial version .
Source: https://habr.com/ru/post/211793/
All Articles