How to turn entire hard disk into .vdi or .vmdk?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
idigchess
Posts: 1
Joined: 18. Oct 2008, 21:35

How to turn entire hard disk into .vdi or .vmdk?

Post by idigchess »

I currently use linux ubuntu and want to take my windows installation and virtualize it, so that I only need one partition. It will be on the same computer, so the migration shouldn't be a problem. However, I am having a problem because the mbr is messed up when I move windows into virtualbox. So now I want to make my entire disk (including linux) into a vmdk or vdi and then uninstall linux from virtualbox and fix the mbr. The only problem is that I was using Norton Ghost to make the vmdk and that won't work with an ext2 or 3 filesystem, so now I don't know how I am going to turn the whole disk into a virtual image. Thanks!
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Please see this topic: http://forums.virtualbox.org/viewtopic.php?t=9697
It is how to run it both native and in a VM, but you can skip the native part if you don't want that.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
vkov_tinsky
Volunteer
Posts: 218
Joined: 5. Apr 2008, 20:18

Post by vkov_tinsky »

So now I want to make my entire disk (including linux) into a vmdk or vdi and then uninstall linux from virtualbox and fix the mbr.
I don't think that should be necessary - using just the Windows partition should be enough. To create a working VDI of an existing installation (and assuming Windows is only on one partition) you could something like this:
  1. Under Windows change computer type to "Standard PC" (Device Manager -> Computer -> ... -> Update Driver). (Set this back at the end if you still want to use that installation natively.) Then run MergeIDE (see the Hard Disk Support section here). Finally using regedit delete all keys under HKLM\SYSTEM\MountedDevices and reboot into Linux.
  2. Create a raw vmdk for your Windows partition (see section 9.9. in the manual and this posting)
  3. Boot GParted Live in VirtualBox with your raw vmdk attached as well as a new VDI (at least the size of the Windows partition). Copy the Windows partition to the new disk and also set the boot flag for it.
  4. Boot your WinXP CD with the VDI attached (in IDE mode, OS type obviously now set to "Windows XP", I/O ACPI left off) and choose the repair option. Run fixboot c:. If your Windows partition originally wasn't the first one on the disk now do bootcfg /rebuild (enter /execture /fastdetect as boot parameters). If your boot timeout is zero also run bootcfg /default.
    Now you also need to disable a couple of drivers so you can boot. Run disable agp440 and also disable intelppm. If when you try to boot Windows in the next step you still get a BSOD mentioning a specific driver you can also disable it using this method.
  5. To stop Windows asking for reactivation set the MAC address in VirtualBox to that of your real NIC. Seconly if you're using an OEM version of WinXP set the bios information correctly (see here).
  6. Boot from the VDI. If all goes fine and you can get to the Windows desktop uninstall any unused drivers: In a terminal run set devmgr_show_nonpresent_devices=1 && devmgmt.msc and then choose View->"Show Hidden Devices" to uninstall any non-present devices (the ones with a semi-transparent icon). Also change the computer type (see step 1) to "Advanced Configuration and Power Interface (ACPI) PC".
Regards,
VT
Post Reply