January 9, 2006

How to convert a physcial computer to a virtual machine

Filed under: HowTo, Virtualization, Systems Engineering | Lindsay @ 10:04 pm

I recently got a new replacement laptop for work. I had a lot of stuff on the old laptop after 2+ years of use and so I didn’t want to have to rush myself in remembering everything in one or two passes before formatting it to send back to the office. There are always things I forget when I’m mostly focused on moving data files over: files in “hidden” places like IM logs and non-file based data such as product keys, configuration info, settings for programs and other stuff. So I decided the best thing to do was make it into a VM and take my time about reinstalling and configuring the new laptop to match.

After some Googling I found a forum conversation on ArsTechnica about how some people did it. I had been planning to use Symantech Ghost but the version my company supplied was old and I didn’t want to shell out another $70 of my own. Someone mentioned in the post that you could use NTBackup, a free, already-there backup application on Windows XP. He said it was actually a preferred method because NTBackup is actually there to provide recovery services from backups made on different hardware. There would be no tweaking of drivers necessary on the new VM.

So I tried the P2V using NTBackup and it worked well. My last attempt (out of 3) was relatively painless. The first two failed because of miscalculations on my part. Since I had trouble finding information on how to do it and I generally need more detailed steps than the hardware gurus give me, I thought I’d document the process here in case anyone else has the same challenges I did.

Disclaimer: Use these steps at your own risk. Theoretically the worst that could happen is you could waste some time and/or end up with a VM that doesn’t work correctly so you can just scrap it and try something else!

What you will need to get started

  • Your two laptops (obviously)
  • VMWare Workstation (version 5.5 recommended, what I used) - You may download and use a free 30-day trial of Workstation. After the trial ends, if you don’t want to purchase a license, get the free VMWare Player which allows you to use existing VMs but not create new ones.
  • An external drive or a networked drive that has enough room for your backup file that both laptops can access (I used a 100GB USB external harddrive)
  • Microsoft Windows installation discs or ISOs
  • Enough space on your new laptop to host a VM of the old one, or just use the external drive to host the VM
  • Some thing else to work on during the hours and hours it takes to do the backup and restore after you get them running

Make a backup of your old laptop (Windows XP)

  1. Go to Start->Run and type NTBackup.exe and click OK
  2. Choose to run the Wizard and select Backup Files and Settings , click Next>
  3. Choose All information on this computer, click Next>
    Update: A friend of mine did this and it attempted to back up the external harddrive that he was using to write the backup to (which caused it to run out of space and fail). If you’re using an external drive you may want to choose Let me choose what to back up instead and drill down to My Computer. If you do this remember to check System State as something to back up!
  4. Browse to or type the path to where you want your backup file created: somewhere you can get to from your new laptop. I used my external harddrive to store the image on for easy transfer.
  5. Type a name for your backup file. I chose something with the date in it just to make it easier to remember
  6. It says you need a floppy disk. If you have a floppy drive for both of your laptops, then you can use them and it will save you a step later. If you don’t, don’t sweat it. Click Next>
  7. Click Finish and find something else to do for the next 5-10 hours or so. Mine took about 9 hours to fully back up (it is a 40GB drive). At the end, if you don’t have a floppy drive, it will complain about it, but just click ok, all is well.

Create the Windows Virtual Machine on your new laptop

(These instructions are for VMWare 5.5, if you have another verison they may vary)

  1. Open VMWare and choose File->New->Virtual Machine…
  2. Choose Typical, click Next>
  3. Choose Microsoft Windows and your Version
  4. Give your VM a name and location, click Next>
  5. Choose Use bridged networking, click Next>
  6. Be careful when choosing your disk size. I screwed this up twice. Just go ahead and make it at least as big as the physical drive on your old laptop (this is where it helps to have an external drive to store these things on, like my 100GB one). Leave the box to allocate space now unchecked, and it will only take up as much room as it needs. Click Finish
  7. Start your new VM.
  8. Choose VM->Removable Devices->CD ROM (IDE:0)->Edit… and point it to where ever you have your Windows install disc (I had an ISO file)
  9. Choose VM->Settings, click the Options tab and then Shared Folders and set up a shared folder to the path where your backup file can be found.
  10. Stop your VM (it will be hung anyway) and restart it to get it to notice the installer cd.
  11. If you have the recovery floppy and you pay attention at the very beginning of the install, you can press F2 and have Windows create the install directly from your backup file. I haven’t done this so I can’t guide your steps, but you shouldn’t need to do the next steps if you can do that.
  12. Otherwise, follow the Windows install. Make sure that you set up your partitions to match your old laptop (this was another place I miscalculated and had to start over with).
  13. Choose as many of the defaults as possible when installing Windows. It won’t matter since all the settings will be overwritten when you restore your backup.
  14. After you’ve installed Windows, install the VMWare tools (VM->Install VMWare Tools…) on the virtual machine (this needs to be done before you restore). Select defaults in the install wizard and Windows will require a restart after the install.
  15. Update: If you created more than one partition during your install, make sure that you format the partitions other than C: before you perform your restore! Go to Start->Run, type compmgmt.msc, click on Disk Managment, right-click your drive and choose Format.

Restore your backup of the old laptop into the new VM

  1. After it’s restarted, in the VM, map a drive to the shared folder you set up. It should be under VMWare Shared Folders when you browse for it. The mapped drive path will start with something like \\.host
  2. Click Start->Run, type NTBackup.exe and click OK.
  3. Follow the wizard steps to restore your backup. There shouldn’t be any “gotchas” there. Find your backup file on the share you mapped to and it will load in the treeview under “File”. Check all the pieces you want to restore, which in my case was everything. Don’t forget to check the System State (probably the last thing in the list) as something you want to restore!
  4. Click Finish. You will be prompted about restoring system state; just click OK.
  5. Wait for a couple or 3 hours for the restore to finish!

And now you should have your old laptop on your new one. All your data files, installed software, security settings and even application state information (I was suprised to find that the ISO file I had loaded into Daemonware was still loaded!) right there and usable.

There could be other uses for P2V as well, of course… You could take your whole computer on the road in just an external harddrive (of course you’d need a PC with VMWare installed at your destination to use it). But for travel from office to office, that might be a good alternative to lugging a laptop around the airport!

Update: After restoring, the drive map I had set up was no longer there (to be expected). I noticed that I no longer could see the VMWare Shared Folders when browsing the network connections to re-establish the map. To fix this problem, reinstall the VMWare tools.

Update 2: For those of you who are into (or getting into) Virtualization, I’d appreciate any feedback you can give me on the issues I have found trying to go the virtual route. Please feel free to leave your advice comments on my second virtualization post!! I’d love to hear what other people are doing.

» » » » » » » » » » » » »
, , , , , , , , , , , ,

44 Responses to “How to convert a physcial computer to a virtual machine”

  1. Martin Mueller Says:

    Thx for sharing - just what i needed!

    Regards
    Martin Mueller
    Denmark

  2. Lindsay Says:

    Glad it is useful, Martin! Good luck with your virtualization.

  3. paintballer Says:

    Perfect!
    MUCH better than using other tools, it’s already included after all…

  4. Orhan Karsligil Says:

    If you have the software an easier process is:
    1.) Create an image of your laptop using Symantec Livestate.
    2.) Using VMPlayer convert this image to a Virtual Machine and you are all set.

    This way your hardware configuration is maintained in the Virtual Machine as well. I am not sure if NTBackup can bring over your installed software. It can copy the data and Windows/Office settings and some other Windows Application settings but other software is not coppied over (the files might be there but the most probably will not work) The livestate->VMPlayer definetely solves this problem. Taking a livestate image of a laptop should not take more than 2 hours (USB 2.0 harddrive or a 100MB Network connection), VMPlayer image conversion takes also around 2hr on a good machine. But then again nothing beats “free”. Of course licensing is not free. The laptop OSes normally are OEMs and can only be run on the laptop. Virtualization of that license is not normally allowed….

  5. John Bokma Says:

    “the free VMWare Player which allows you to use existing VMs but not create new ones.”

    But as
    http://johnbokma.com/mexit/2005/10/26/vmware-player-windows-xp.html
    explains one can create virtual machines with freeware. No need to download and install the trial of Workstation.

  6. John Bokma Says:

    Just a small note: nofollow links suck. Moderate your comments, but don’t punish genuine comments with using nofollow by default.

  7. Lindsay Says:

    Orhan -

    All the software I had installed on my old laptop is still installed in the backup as well… the System State restore takes care of it. Like I said, not only was the software still installed and usable, even the things that were loaded (like the ISO image on Daemonware) were still running! I am even doing .Net development on it until I get my new environments set up and everything works fine.

    The only problem I’ve encountered is that I lost one of my databases in SQL Server… it is now “suspect” and I can’t open it. I would make sure if you run SQL Server that you stop the service before you do your backup. I think I left mine running.

    So if you don’t have the Symantec Livestate tool, NTBackup is still a good option!

    As for the OEM licensing issue, I didn’t have that problem… I wiped and reinstalled my laptop when I first got it so the original OS installation was no longer there. But that might be a problem for others, yeah… Unfortunately I don’t know how to resolve that problem.

    John -
    Thanks for the link.. That’s pretty cool. I already bought a copy of VMWare because I need to be able to create VMs easily for my job, and can’t afford the time of hacking scripts for it, but that’s good information to know!

  8. Lindsay Says:

    John -

    I am still relatively new to Wordpress (I think it will be a month in a couple of days), and didn’t even know what nofollow was until I just Googled it from your comment. Certainly it isn’t my intention to punish anyone for commenting. I will look into it and find out my options are. Thanks for making me aware of it.

  9. Fabian Says:

    Typically SQL server will mark a db suspect as soon as it can’t open one of its files at startup. Once it is marked suspect, you can’t do anything. I believe there is a stores proc to reset the status (I’m on my mac now, so no access to help books online)

    I wonder if you could achive the same thing by brute force: copying your partitions straight to a file (or files) and use some free free tools like QEMU for virtualization (I like QEMU better because it is really free, opensource, and does not require any install on the host)

    I would create the image by using a simple live linux and using the command dd …

    Just a thought :)

  10. Antimail Says:

    Using NTBackup to achieve P2V

    I always thought about writing a post about physical-to-virtual migration strategies in combination…

  11. Mike G Says:

    Great article, I’ll be trying this out soon. It should work the same for a Server Edition install, yes?

  12. John Bokma Says:

    Lindsay - There is no scripting involved, just running a command line tool. On the other hand, as soon as I notice that I use the player more then casual I am going to buy Workstation :-)

    And thanks for looking into the nofollow issue.

  13. Dave D Says:

    Nothing wrong with Nofollow for comments…it’s not punishment. If Lindsay or another blog owner want to reward you for a good self-link they can and should do an update/edit or a new post including the link so it gets its search engine props.

  14. John Bokma Says:

    Dave -
    If you don’t moderate you get comment spam anyway
    If you do moderate, there is (IMNSHO) no reason for nofollow. If someone just posts to get a good link, the blog owner can reject the comment. That’s what I do.

  15. Federico Says:

    Did anyone get this error message when attempting this?

    —————————————
    Windows could not start because of a computer disk hardware configuration problem.

    Could not read from the selected boot disk. Check boot path and disk hardware.

    Please check the Windows documentation about hardware disk configuration and your hardware reference manuals for additional information.
    ————————————–

    I followed all the steps mentioned above, and this popped out at when I rebooted after restoring. I’m somewhat desperate to get my data back, and I’ve read a lot about chaning the boot.ini file to fix this problem, but I haven’t figured out how as I am running Ubuntu 5.1 as the host, and as a VM I can’t figure out how to get the “recovery console” (see http://support.microsoft.com/?kbid=314477#kb1). Any help would be wonderful. Thanks!

  16. Phil Schaffner Says:

    Have been getting similar errors when trying to follow the ArsTechnica Ghost procedure Lindsay referenced at the top. Failure to get multiple approaches to fixes for that to work for my backup/restore VMs led me here. (Have yet to get time to restore my Win2K NTBACKUP image to a VM). The Ghost-restored-image boot process always fails before one could get to the “F8″ options to boot to a console. Booting from a windows installation CD should give a recovery option, but this didn’t help for my Ghost image problems.

    The “captive” NTFS driver in older Knoppix distros was said to allow NTFS write access, but that was discontinued due to filesystem corruption problems in later releases.

    Another way to get write access to boot.ini would be to follow the procedures outlined at ArsTechnica to mount the “bad” VM disk as the second drive on a fresh installed Windows VM. Uet another would be to use a bootable Windows CD per the BartPE approach at http://www.nu2.nu/pebuilder/

  17. Bill W Says:

    Phil,

    Using Bart PE and REG.exe, you may be able to “fix” your ghost image within the vmsession. You will need to know the vm’s hardware types and storage type… most likely these are APCI/EPIC with IDE storage devices. I don’t have the exact reg keys, but you should be able to boot the vmsession with bart and use the reg.exe command to inject the correct vmhardware info into the reg of your restored ghost image. Oh… you may (probably) need the correct hal.dll, ntoskrnl.exe, and ntkrnlpa.exe files for a vm windows seesion as well. Since you have a ghost image you can safely experiment with this. Good luck.

  18. matthew k Says:

    I have been using vmware for years now for support, so I can walk folks through issues on different OS’s, but you hit on a really cool idea. I will have to try it. The use goes way beyond laptops.

  19. Frank Says:

    I have a question, is that feasible the other way around? i.e. Virtual machine -> Physical PC. Should be done without problem, right?

    Thanks

  20. Lindsay Says:

    I would think this should be possible, though I haven’t tried it. If I did, I’d use NTBackup on my VM and then go through the restore process on the physical machine. Since NTBackup is designed to deal with hardware changes between backup and restore it theoretically shouldn’t be a problem.

  21. Matte Says:

    I’ve attempted the ntbackup approach, with the free VMware server…

    All seems to go well, the image is read, and restored, however, after the restore is done, on boot I get past the Windows XP boot screen, and I then get an LSASS error :(

    Could this be because I used an XP SP1a cd to load, rather than XP SP2 (which is what I was restoring)???

  22. Lindsay Says:

    Hi Matte,
    Sorry for taking so long to respond. I haven’t experienced the problem you’ve mentioned but if I was troubleshooting it, yeah, I would make sure that I was upgraded to XP SP2 before trying to restore an XP SP2 backup. If you only have the SP1 disk, you should be able to do the Windows Updates to get you to SP2 before attempting the backup. Hope that works!

  23. Robin Says:

    Has any body tried to do V2P? IE can we do NTBackup in the VM and then do the restore on another machine?

  24. teryk Says:

    Just a quick note to anybody attempting this. Make sure that the drive you are backing up to is NTFS (as opposed to win32), otherwise the backup process will bail when the file size reaches 4GB.

  25. teryk Says:

    Another note:

    I believe that the initial OS you install into the vmware image to do the backup has to match the version of the OS you are restoring, including the service pack. I couldn’t get it to work until I installed SP2 before restoring the backup (which had SP2 installed)..

  26. Lindsay Says:

    I believe you’re right, teryk. I had WinXP SP2 on my old laptop and that was also the version I installed in the VM before restoring the backup. I didn’t bother with the security updates, however, until after the backup was restored (since my laptop was already up-to-date anyway).

  27. esoos Says:

    What’s the performance like? I sometimes use Microsoft Virtual PC for Mac OS X, and it’s pretty slow. Can’t imagine doing much serious development work on it.

  28. Lindsay Says:

    I basically do all my development on Virtual Machines now and I haven’t had a problem with performance. That may have to do with the fact that I have 2GB of RAM on this laptop and I allocate at least 1GB as available to the VM and I usually only run one VM at a time. I also run them on an external USB harddrive which is supposed to help performance (by removing contention if you were running them on the same drive as your OS). The only problem is occassionally if I get a lot of things going at once on the VM it will make the CPU work pretty hard, but I have to really be pushing it (like having 4 instances of Visual Studio running with several instances of Internet Explorer, SQL Server Enterprise Mananger, Query Analyzer, a command window and a few folders…). Most of the time if I notice something pegging the CPU it’s because I wasn’t paying attention to how much stuff I opened that I didn’t really need open at the same time.

  29. 4sysops Says:

    P2V for VMware: migrate physical to virtual - tools, expierences, articles

    Some weeks ago I wrote about P2V migration for VMware, discussing six different ways to do the job. The growing number of referrals to this post show that this topic is troubling many IT professionals at the moment. Even VMware linked to my sit…

  30. Student Organizations Says:

    This is great for web application developers running Windows who need to test in Safari. Kind of overkill for just that but I haven’t found another way to emulate that browser.

  31. FKoehlerIV Says:

    Dumb question — during the restore, (in advanced options in NTBackup) do you select ‘overwrite existing files’ or not? The default appears to be _not_ to overwrite existing files…

  32. Lindsay Says:

    That’s actually an interesting question. I would imagine that your backup that you are restoring probably has Windows updates installed that your fresh install of Windows wouldn’t have. Therefore, to save yourself the trouble of installing 101 updates again, I would overwrite the files.

    Since it’s a fresh install of Windows and you want it to be the new incarnation of your backup anyway, it would make sense regardless of the updates to just have it overwrite, come to think of it!

    HTH!

  33. FKoehlerIV Says:

    I’ve been trying to migrate an older (crufty) windows 2000 PC to VMWare 5.5, but earlier attempts using bartpe method failed with the system hanging at ‘Starting Windows…’ with the progress bar about half way across. Used the NTBackup method described above (with the defaults of not overwriting) and it worked great.

    After that, found another article in four parts describing steps to fix this hanging problem during boot by expanding the hal.dl_ file in system32 on the problematic system… but why bother fixing? The NTBackup method worked great.

    Did have one strange thing after the NTBackup restore, however. Had to fix desktop icon weirdness by deleting the ‘isshortcut’ key in HKCR\lnkfile. Had some sort of windows icons painted overtop of the program’s shortcut icon. Changing icons didn’t fix it.

  34. Aaron Says:

    This is great. I’ve been looking for an easy way to do this. Everything seems to work great. Now I can upgrade the system and take my time moving data and applications.

    One thing I did different, and I didn’t see any mention of this, was instead of going through mapping the drive and restoring over the network in VMWare, I was able to speed things up by mounting my external HD as a second physical SCSI hard drive in VMWare. (Create New Hard Drive -> Use Physical Disk) I was about to restore almost 30GB of data in less then 2 hours. The other methods would have taken several more hours.

  35. Joe Says:

    You can use any commercial (or non-commercial– g4l works too) backup solution and then just rebuild the HAL after restoring the image onto the VM. I use Acronis since it works very fast for me. But really anything works. The image will probably not boot, so you rebuild the HAL. Just boot the windows CD, pretend like you’re installing windows from scratch. At the screen where you choose where to install it, choose repair. If you don’t have an up to date install CD, then you also need to get the latest updates. This method works for Windows 2000 identically. And it’s not limited to VM installation– you can use this method to move an environment to any other real or virtual machine.

  36. jaywilson Says:

    I’ve be trying for days to get this to work. I have no idea what I am doing wrong. After the restore my VM goes into an end reboot loop. It shows the Windows XP splash screen and attempts to load the OS but then blue screens with the error message bad_pool_data and reboots. I can boot into safe mode but that’s it. I am out of ideas. I even trying doing a repair install but this didn’t help either. Any ideas?

  37. Pozycjonowanie Says:

    Using Bart PE and REG.exe, you may be able to “fix” your ghost image within the vmsession. You will need to know the vm’s hardware types and storage type… most likely these are APCI/EPIC with IDE storage devices. I don’t have the exact reg keys, but you should be able to boot the vmsession with bart and use the reg.exe command to inject the correct vmhardware info into the reg of your restored ghost image. Oh… you may (probably) need the correct hal.dll, ntoskrnl.exe, and ntkrnlpa.exe files for a vm windows seesion as well. Since you have a ghost image you can safely experiment with this. Keep up the good work. Greetings

  38. Bourse Goldman Says:

    I always plan to make a backup of my machine with Symantech Ghost but never do so. Well, now I face a situation similar to yours (I got a new PC and have to transfer all the information). So now with your detailed information how to do that, it seems that I’ll use NTBackup. Thanks for sharing this, it will be very useful for me now!

  39. Mark Says:

    Excellent article and just what I was looking for. Now I just need to convert the VM image to Virtual Server and I’ll be happy. :)

  40. iddaa Says:

    Did have one strange thing after the NTBackup restore, however. Had to fix desktop icon weirdness by deleting the ‘isshortcut’ key in HKCR\lnkfile. Had some sort of windows icons painted overtop of the program’s shortcut icon. Changing icons didn’t fix it.

  41. Mallorca Index Says:

    What a pitty that this article is so massively abused for spam postings..

    @ Lindsay
    Maybe the nofollow concept is not as bad as it seemed after the posting of “John Bokma”?

  42. resimler Says:

    Great article, I’ll be trying this out soon. It should work the same for a Server Edition install, yes?

  43. Wong Seoul Says:

    I will try to use this info on one of my old machine. I need a virtual machine… Thanks for sharing the info ..

  44. www.r10.net küresel ısınmaya hayır seo yarışması Says:

    Did have one strange thing after the NTBackup restore, however. Had to fix desktop icon weirdness by deleting the ‘isshortcut’ key in HKCR\lnkfile. Had some sort of windows icons painted overtop of the program’s shortcut icon. Changing icons didn’t fix it.