Friday, November 18, 2011

Converting a VMWare Virtual Machine to Physical Machine using sysprep
(Windows OS)

VMWare Converter cannot do V2P (it allows only P2V or V2V conversions)
Other Software exists for this but it does cost money, the following procedure is free:

1. On the virtual machine (Windows), open an Administrative Command Prompt & type
C:\Windows\System32\sysprep\sysprep.exe /generalize /shutdown /oobe
The main purpose of this command is to "generalize" the hardware, shutdown the VM, and run the microsoft Out-of-Box-Experience (oobe) on the New Physical Machine afterwards. OOBE is NOT optional and WILL re-prompt you for the computer name, locale, and a few other pieces of info.

2. Create an Image of the VM with a program of your choice (Acronis, Clonezilla, Ghost etc...)
To load the cloning program off a .ISO or CD/DVD and load it up as a CD Drive in the VMWare settings: Edit the VM settings to specify the CD-Drive source as the cloning program. Turn on the VM, immediately hitting the ESC key to bring up the Boot Menu & Choose the CD-Drive that you just virtualized so that the cloning program boots off the virtual CD-Drive before the VM loads itself.

3. Restore the Image to the Physical Machine's Hard Drive.
Boot off the same CD or burn the ISO to CD so that you can restore the disk image you just created above to the physical machine's desired hard drive.

4. If the VM OS was using dynamic disks, the resulting physical hard drive MIGHT need to be converted to a basic disk if you run into a 0x000007B STOP error:
Use a disk hex editor from your favorite cloning/disk suite or download one such as (note - does NOT run on WinPE/Recovery.wim)
Dynamic Disks should read 42 at sector 0 location 00000001C2. Change it to 07(ntfs)
The following 3 lines should also be changed as done above from 42 to 07 if they exist.
Click the save icon at the top to save back to the drive. Now Reboot.
chkdsk drive: /F afterwards to clean up any errors induced from cloning.
Thats it, it's now a Basic Disk. ( )

No additional precautions are needed to restore the image to a machine with multiple hard drives or multi-OS (multi-boot) but if you are using a boot loader, you will need to reconfigure that afterwards OR change the HDD Priority in the BIOS or manually select the new HDD from the bios boot menu.

Steps 2 and 3 should be done with the same program, with ANY Program that supports images, or more advanced programs can be used with client/server, network support, or direct disk-to-disk over the network capabilities. (Clonezilla is a very advanced linux program)

Step 4 is not necessary under most conditions but can also be done with any partition utility (ie: Partition Magic, GParted) that allows you to change the "Type" from 42 to 07 (the standard type codes 42 being dynamic, 07 being NTFS).

No comments: