Tuesday, December 4, 2012

P2V - Physical to Virtual Server converting

Now that you have built the hypervisor server, now you want to get that old physical server onto your hypervisor as a VM.  But how, Microsoft's converter is from a VMware VM to a hyper-v VM and so is the 5Nine product V2V (which i love and it works great)?  Never fear there is a app for that. Sysinternals (wholely owned by MS now) has a tool called disk2vhd. Now it works great but there are draw backs. such as you need to have some diskspace available on the server or an external USB drive with space available. Not a huge deal but still a deal, so make sure you have some disk space available or a drive handy. Download the app and run it on the server in question, mine was a Dell R710 with RAID 5 and Windows 2008. I ran it, followed the prompts and it went to town while the server cranked away. It will tell you the space required to get a dynamic VHD file created of your server, sorry those are your only choices. I then mapped a drive to my vhost, created a folder where I wanted my server to reside and copied the VHD file into it.
Once that was complete, I unplugged the NIC from the pysical Server and created a new VM with the specs I wanted for the vCPUs and RAM etc, and attached the VHD to it for my new/old server. Now I started it up, logged into it, uninstalled any physical server software junk, like Dell Open Manage, Broadcomm NIC manager and MATROX video stuff and rebooted. You might have to setup the static IP address again but since mine was DHCP there was no such fooliness.

Now I have a new/old server on the network ready to roll and once some testing is done to make sure everything is fine, I can power off the old box and re-cycle or reuse it.

Hold on, I just checked the spec's on my new/old server and it a setup to be a dynamic disk and the size is 136GB and only 25 is used. How do I make it a fixed /static disk and 70GB which is my standard.

Ok here are your steps:
1. Power the VM Server off (hence forth to be called VM)
2. From the server console, open the powershell window, type (substitute C:\temp\ for your path)
PS C:\> Convert-VHD –Path c:\test\test.vhd –DestinationPath c:\test\test.vhdx -VHDType Fixed
This will convert your VHD file to a VHDX file and make it Fixed or Static. The -VHDType options are Fixed, Dynamic and Differencing. According the technet you cannot shrink a VHD file but you can expand a VHD file. If you want to shrink it, it must be in VHDX format.
3. Edit VM setting with your hyper-v manager and point to the new VHDX file you just created.
4. Powerthe VM up and log into it as Administrator
5. Right-click on the volume in Disk Management and select Shrink Volume. (was 136GB)

6. Enter the amount of space to shrink and press the Shrink button. (shrink by 66GB)
7. Power the VM off
8. To shrink a VHDX file size, from the server console open the powershell window and type

PS C:\> Resize-VHD –Path c:\test\test.vhdx –ToMinimumSize
9. Power the VM on and check to make sure you got your re-sizing right.
You are done

You might want to delete the old VHD file unless you are not done with it or like to waste disk space.

No comments:

Post a Comment