Hyper-V VM Migration using Sysinternals Disk2VHD
Disk2VHD by Sysinternals is an awesome tool not only for doing Hyper-V VM migrations, but for testing and timing your migration window as well. Let me explain:
You can capture a VHD image of a running server with Disk2VHD with minimal to moderate performance impact (there will be additional load on your hard disks and network if you are capturing over the network). This will produce an image that, when you start it up, will assume that the server had been reset while running live. Naturally this is not what you want to do with the actual migration. When migrating you need to quiesce the data - all important services like SQL Server should be stopped in order to capture an accurate image of the latest data to export to your VM.
But why test a VM migration?
2. To run functionality and performance tests on the VM, ensuring you have allocated sufficient resources to support it
3. To time the migration, allowing users to know in advance how long their services will be offline
4. To develop and test your scripts. Yes, you should prepare some scripts to smooth over the migration
To get an idea of what scripts should be run, there are generally 3 scripts all in different locations:
Script 1 runs on the live server. When run in a test migration, it will only extract the disk data to a VHD. When run for the actual migration, it should stop the necessary services before doing the extraction, then shut down the server when the extraction is completed.
Script 2 runs on the Hyper-V host. You should mount the VHD on the host, then run the script
Its job is to rename the files and folders of the services you don't want to run upon first startup and the apps you want to uninstall, and set up the third script to run upon windows login (by putting a batch file in %allusersprofile%\start menu\startup. I would prevent SQL server from starting, as well as antivirus and hardware monitoring tools. This will speed up the first boot of the VM until Hyper-V integration tools are installed and I get back control of my mouse.
Script 3 should run upon first boot into windows in the VM, as set up in script 2. It renames back all the files and folders that were renamed in script 2, installs hyper-v extensions from the mounted CD (integration tools), uninstalls all apps that will be unnecessary in the virtual environment, reconfigures networking so as to plug back into the live environment as a direct replacement of the physical server.
With such a mass of scripts to run, you will probably miss 1 or 2 steps without doing the test migration. So test away!