.ultrageek. Computers, Music, and Thoughts

19Aug/1415

Converting Physical Drives or Partitions to Vmware vmdk (P2V)

Note: This assumes you are trying to virtualize a Windows OS.

What if you had a perfectly good working hard drive but the machine that was running it was dead, DOA, not working, or had been upgraded with a new hard drive and OS? Connecting that to a machine and getting the files is easy enough but what about if you wanted to boot the OS back up? The Virtual Option is going to be your best bet but how? Sure there are plenty of options like Ghost that will keep your machine backed up with a VMDK option but how to accomplish this without spending money? Now that is a challenge...challenge accepted!

The process is generally referred to as Physical To Virtual or P2v for short. In doing some research on how to do this I've worked out a process that as long as you don't mind forking over a working email address (man these sites are so clever!) you can download a couple tools to make this possible.

To accomplish this task you will need to complete the following steps:

  1. Create the virtual drive image (vmdk) file to use with VM Ware Workstation 10.x or VM Player 6.0
  2. Create the VMX File used by the converter
  3. Tranform the image with the appropriate drivers to boot (HAL, HD, etc.)

Depending on what machines you have at your disposal here is one method.

Step One - Download Tools

  1. Disk2VHD
    1. Use this to pull the image off the drive in to one VHD file
    2. Download Link: http://technet.microsoft.com/en-us/sysinternals/ee656415.aspx
  2. StarWind V2V Image Converter
    1. Used to convert the VHD to VMDK
    2. You will have to give them a working email address after which they will email you the link to the download...so sneaky
    3. Download Link: http://www.starwindsoftware.com/converter
  3. VM Ware Converter
    1. Used to load the appropriate drivers and make the VMDK ready for use, otherwise you will get blue screens or boot device errors
    2. You will have to have a free vmware account to access this download...even more sneaky!
    3. Download Link: http://www.vmware.com/products/converter

Step Two - Clean up your source!

Do yourself a favor and delete the following files:

  1. Hibernate and Pagefile files. Turn on show hidden, find these large guys, and delete them.
  2. Use "Tree Size" free edition and determine where else you can trim unneeded files: http://www.jam-software.com/treesize_free/

Step Three - Create your image

  1. Fire up Disk2VHD
    1. Uncheck "Use Vhdx", Starwind will complain that it is not a valid image
    2. Check "Prepare for use in Vitual PC" if you are running on XP or Windows Server 2003. This will save you the "VMware Converter" step.
    3. Check the partition you wish to backup
    4. If Windows Server 2008, Windows 7, or higher also backup the hidden system partition that starts with "\\?\Volume{12393df90-...". You will need this.
    5. Save to a location that has twice the space as DIsk2VHD recommends as you will need space for the VMDK in the next step.
    6. If you get Shadow Copy errors, just uncheck that box. It is a convenience, not a deal breaker. It's used more (I believe) for copying hard drives on machines that are still running AKA your boot drive.
    7. Create!
  2. Fire Up StarWind V2V Image Converter
    1. Run this as administrator
    2. Select the VHD
    3. I recommend "VMWare growable image" so that it doesn't take up space for empty drive space. You can always use the vmware tools to change this.
    4. Pick IDE
    5. Select the Save Spot
    6. Next starts the process...now do something else as unless your drive is small or your machine is insanely fast it is going to take a bit to crunch
  3. Fire up VM Player
    1. We need to create the VMX file so that the Converter can process the VMDK file. If you are handy with creating these by hand then skip this step but with the latest version of VM Player, it will create new VM's from scratch which is something the earlier Pre-5.0 versions would not.
    2. Go ahead and create the directory for where you want the vmx and vmdk output. Vmware images work much better silo'd and segmented from other files.
    3. Note: If you have VM Workstation you can use the custom set up of the new VM to select an existing VMDK
    4. Click "Create a New Virtual Machine"
    5. Select "I will install the operating system later"
    6. Pick the appropriate OS
    7. Use the default location. We are going to move the VMX to the directory you created on step 3.2
    8. Pick the Size Disk and Single/Multi File, does not really matter. We are just trying to get the VMX created
    9. The hardware for CPU, RAM, etc. doesn't matter as much, you will edit these on VM Player once you have converted the image.
    10. Edit the VMX File
    11. Make sure somewhere in the file is the following lines:
      1. ide1:0.present = "TRUE"
      2. ide1:0.fileName = "C:\VM\Old Machine\OLD-PC.vmdk"
    12. Where filename equals the path to your VMDK
    13. Save this file to the directory you created in step 3.2
    14. This should work...
  4. Fire Up Vmware Converter
    1. You do not have to run this as administrator though it does not hurt
    2. Go ahead and create ANOTHER directory for where you want the FINAL vmx and vmdk output. This is a different directory from step 3.2.
    3. Click the 'Convert Machine'
    4. From the "Select Source Type:" drop down select
    5. Select your vmx file
    6. Click Next. If Converter has issues with the VMX this is where it will puke and stop.
    7. Select the product you're going to use the VMDK on, Player or Workstation and the directory. This will need to be the directory you created for step 4.2 and not the directory you created in step 3.2
    8. Review the final details and Next
    9. Finish to start the process
  5. Errors with Server 2008, Windows 7, or newer OS (Unable to Find the System Volume, reconfiguration is not possible)
    1. First, you need to make sure you got the 'System Reserved' partition in the image that you made from the source disk. This is the boot loader partition and without it things are pretty hopeless though I'm sure someone has figured out a workaround.
    2. Second, you will need either the original or similar in system version ISO of the OS you are trying to recover as you will need it to boot up and run several commands.
    3. Third, you will need to use VM Player or workstation to boot up the source VMDK. You will need to add the ISO referenced in step 5.2 and you will probably need to boot in to the VM bios in order to make the CD ISO bootable. There is a handy option now to boot straight in to the bios, saving you the effort of having to bang the keyboard before the post finishes and boots in to the OS.
    4. Once you have booted in to the recovery/setup, you will need to follow these steps outlines in this webpage: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1037507
      1. If you do a "bcdedit' and the partition says 'unknown' use this
      2. If your OS is on 'D:' use step 10 and not 8, this is what I had to do for my Server 2008 R2 image
      3. I did not have to do the regedit, just the bcdedit commands. This fixed the 'unknown' issues

If this seems like a lot of steps, it is but I tried to skip obvious steps/defaults. The challenge was mostly getting the right tools, understanding the order of operation, and then the new boot loader Microsoft uses for its latest OS's. If someone actually uses this and needs help, finds a missing step, dead link,  or just a general question please leave a comment and I'll do my best, thanks for the read and hope this has been helpful.

Here are the pages that I used to help kick start this:

 

Comments (15) Trackbacks (0)
  1. Great presentation
    I had to change the ide ref. from 0 to 1 because it defaulted a CDROM drive at 0.
    Then instead of being invalid it all worked. Thanks for the step by step. I’m now able to work on a 2003 Server error issue in the box.
    ide1:1.present = “TRUE”
    ide1:1.fileName = “C:\VM\Old Machine\OLD-PC.vmdk”

  2. Thank you so much!

  3. Got a task dropped in my lap, ’cause you know computers.’
    Haven’t done virtual machines before, and until I found your post, was pretty sure this was going to be somewhere between ugly and impossible.
    Friend brought the drive from his old XP in Spain (in Spanish) and wants it as a virtual machine on his brand new Lenovo Win8.1Home desktop here.
    Read a lot about VirtualBox, HyperV (which would require a $142upgrade to Win8.1Pro, apparently) and VMware.
    Think I’m going VMware.
    I’ll let you know how it turns out.

  4. OK, did this as best I could. Just ran the VMWare Player, and the boot failed. So a couple comments on the process, then the fail message.
    1) Everything’s very clear until your step 4.

    Step 4.4 says “From the “Select Source Type:” drop down select”
    Select what? I chose “VMware Workstation or other VMware Virtual Machine”

    And in 4.7, “Select the product you’re going to use the VMDK on, Player or Workstation”, a failure on VMware’s part is that none of the items in the dropdown are what I downloaded. I downloaded VMware Workstation 12 Player for 64-bit” (Trial), but only Workstations (up to 11.0) or Players (6.0 and 7.0.x) were listed. So I chose Player 7.0.x, the latest listed.

    Other than that, it all ran OK. When it came to editing the vmx(?) file, I changed the overall file size from 913G to 400G (it’s only got 130 G of data on the original drive) and bumped the RAM from 512M to 1G.

    Your instructions are for conversion, granted, but I’m a first-timer at this whole VM thing, so a little hand-off to what software to run after the conversion would be nice. I’m assuming I just run the Player and choose the VM I want, listed in the column on the left side of its pane. So that’s what I did. And here’s the result:

    Network boot from AMD Am79C970A
    Copyright (c) 2003-2014 VMware, Inc.
    Copyright (c) 1997-2000 Intel Corporation

    CLIENT MAC ADDR ## ## ## ## ## ## GIUD: ~~~~~~~~~~~~~~~~~~~
    PXE-E53: No Boot filename received

    PXE-M0F: Exiting Intel PXE ROM.
    Operating System not found.

    When I ran it, before it ran, it asked me about setting the keystrokes settings (a warning about losing keystrokes under stress) and that it would require a restart of the VM afterwards. But the thing failed to start, as the error above showed.
    When I got this, the VMware Player’s gui had a three buttons at the bottom, including “Restart VM” so I clicked that. It also had the text :
    “Windows XP Professional is not installed on this virtual machine. Insert the installer disc and click “Restart VM””
    Still ended up at this error.
    Note that it takes a minute or so to fail. After the line CLIENT MAC ADDR: ~~~~ (I left the actual values out, but it lists them) It says, I believe, ‘Booting’ and puts one of those old DOS spinners in place as it walks a few periods (3 or 4) across, like a progress bar.)
    Then it fails and this is the result.
    Now, the Player’s gui only shows two buttons, “I Finished Installing” and “Help”, and shows the text as follows:
    “Install Windows XP as you would on a physical machine. When you are done and the operating system boots up click “I finished Installing”.

    It all worked, except in the end it didn’t work. Which is not unusual for the first time on anything, but he needs his VM, and I’m gone for a week. So I will recommend a service company to my friend. I’ve talked to them, and they plan to upgrade his Win8.1 from Home to Pro ($142 as opposed to $149 for the VMware Workstation 12 Player, big wup) and then what ever service charge on top of that. I’ll give them the files I created here too.

    PS: He has the Win Pro XP book that came with his PC that has the license sticker on it. So its an activate-able copy of XP Pro.

  5. Btw, a warning on time. The first conversion took and hour, the second a little over two, and the VMWare converter took 3 hours.
    The first two were across a pc, but from/to different USB3.0 drives
    The Converter was from/to on the same inboard drive, so speed may have been affected by the r/w ‘thrash’, as the Converter was using 33% of “disc activity”, according to TaskManager, and R/W speed was arouns 70Mb/s, which sounds awfully slow. (Doing those metrics from memory, not notes.)

    If you’d like to see it, I can post the vmx file. I remembered I had the same issue the other guy had, the CD/DVD player was ide 0, so I followed his tweak.

    • Speeds depend on how fast your drives are, i did my first step on a server with SAS drives and it took 25 minutes for 460gb. Secon step was about same, but the 3rd step i was writing to a seagate momentus and it took about 1.5 hours.

  6. Ran it again from start of VMPlayer
    1) The GUI lists the VM as having 512M of memory. Am I not getting the right vmx? The name of the VM is listed correctly.
    2) A pop-up wants me to download new updates to be able to use some Enhanced stuff. I figure it’s not the basic functioanlity of running, so I skipped it for now.
    3) The spinner I mentioned is for ‘DHCP’ so I guess it’s looking for an IP address assignment.
    Then it shows the failure.

  7. Doing any VM is tricky and time intensive. And you would think this would be an easier task and it is if the machine still boots but if the machine is not operational then your options are limited, specially if you are trying to do it on the cheap. I had a machine that died after 11 years (and three power supplies) that I will be converting soon so I’ll review these steps again and post any updates I find in terms of tools and methods. Email me directly if you have questions or need more timely responses. 🙂

  8. If you’re like me and don’t have a non-public email readily available, the download link for Starwind Converter is https://www.starwindsoftware.com/tmplink/StarWindConverter.exe

  9. Thank you all. Great documentation. Thanks for the download link “Lumaterian” 🙂

  10. Hi, Thanks for a great tutorial and I have done until step 2, and can’t understand properly in step 3. There is confusion between vmdk and vmx files.

    Could you please elaborate the step 3 in detail to make understand properly. FYI, I have dead lap top hard drive with latest windows 10 and host also with Windows 10 and installed VMware work station 10 and VMware player 12. So far I have done as per step 1 to create VHD file and step 2 to create .vmdk file and struck at step and can any one help me out?

    Thanks in advance

  11. Hi 🙂

    I don’t know if this is still alive, but after following this procedure, i was stuck on the CHKDSK Process (deleting corrupted files) it says.

    Do someone encountered the same?

    • I would probably mount the disk on a separate host to do the chkdsk. If the problem still persists it might be pointing to a larger disk issue at which point I would pull what files you can and let it go.

  12. What of these steps are necessary if the computer you’re trying to do P2V conversion on is working? I tried the most straightforward way to do it, which was just doing VMWare converter on my friend’s Windows 8.1 laptop. The resulting VM would boot but several devices (Keyboard! and others) would not work and it was horribly slow, even on a very recent Windows 10 host, and it would crash, either randomly or when trying to load the VMware tools.

  13. Thanks ,
    It worked ..
    Managed to convert old windows xp machine to VM and boot in workstation 15..
    Cheers!


Leave a comment

No trackbacks yet.