Page 1 of 32 12311 ... LastLast
Results 1 to 10 of 312

Thread: Boot an existing XP (Physical HD) install with VirtualBox

  1. #1
    Join Date
    Mar 2007
    Location
    Georgia, USA
    Beans
    304
    Distro
    Ubuntu
    ..::Updates::..

    HowTo for Vista 1,2
    VBoxForums Version


    Introduction
    I made this tutorial because I have been searching for an open source virtualization solution. I've tried VMware, but didn't like the GUI (it felt too slow) and the fact that it was closed source. Virtualbox was more appealing because it is open source and because it doesn't currently require a hack to get running in Hardy. After tons of research, I've found that the solution couldn't be simpler.
    Please read or skim the tutorial before attempting it. Note: This tutorial was tested to work with VBox 1.6 and may not work for users w/ SATA drives.



    Step 1: Create a grub boot cd
    Creating a grub cd will let you boot straight into your target Windows partition.
    Following method adapted from grub manual.

    Code:
     cd ; mkdir -p iso/boot/grub ; cp /usr/lib/grub/*-pc/stage2_eltorito /boot/grub/menu.lst iso/boot/grub
    Configure /home/you/iso/boot/grub/menu.lst to boot your target partition. Remove the "savedefault" option from your target entry if it exists. Then run the following to create the grub.iso file,
    Code:
    cd ; mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso
    Step 2: Create a virtual disk (.vmdk)
    When creating such a disk, it's preferable to only specify your Windows partition. This is a safety precaution that will prevent a data corruption problem that results from booting into the currently running OS. As a preliminary step, you must add yourself to the disk and vboxusers groups,
    Code:
    sudo usermod -G disk,vboxusers -a `whoami`
    Log out and log back in here... and edit the following command to point to your WinXP partition: (I specified my WinXP partition - /dev/sda2 - with "-partitions 2")
    Code:
    VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/WinHD.vmdk -rawdisk /dev/sda -partitions 2 -relative -register
    Step 3: Create a new hardware profile in WinXP
    • Click Start > Control Panel > System
    • On the Hardware tab, select Hardware Profiles
    • Click Copy, name the new hardware profile Physical
    • Rename the current profile to Virtual

    Step 4: Change Windows XP's IDE controller
    • On the Hardware tab, select Device Manager
    • Right-click the IDE Controller and click Update Driver
    • Click No,.. and Next
    • Click [Advanced] and Next
    • Click Don't search... and Next
    • Select Standard Dual channel PCI IDE controller
    • Click Next, Finish, then Close and Reboot into Linux

    Step 5: Run VirtualBox
    • Realize that you may have to reactivate your copy of XP
    • Create a machine that uses the created .vmdk (in the drop-down menu of the HD selection section)
    • Have this machine boot the CD-ROM first and mount the grub.iso file
    • You may have to try between the two IDE controllers types (Settings/Advanced) to see which works for you
    • Enable the IO-ACPI option and run your VM!


    Step 6: Bypass Windows Activation [Experimental]

    • Follow the directions in this post
    • Give your feedback here
      • I will remove or improve this section as a result



    *** TroubleShooting ***

    • Disk read error: 1, 2


    *** Warning! ***
    About Guest Additions!

    Note: This problem may not exist for later versions of VBox (post-1.6).
    Installing Guest Additions may cause the Windows installation in an existing partition to be unbootable (natively) - you might only be able to boot it from VirtualBox from there on out. This is a result of VirtualBox changing a significant amount of hardware in your configuration in order to have a user friendly virtual machine. If you already have installed Guest additions, you can try to remove it from within VirtualBox, and rebooting natively to XP.


    ToDo:
    1. Find fix for native booting problem DONE*
    2. Easy .vmdk creation that doesn't require installation of another large or closed source program. DONE*
    3. Creation of boot.iso for direct booting w/o system's grub DONE
    4. Port tutorial to Ubuntu community documentation and official VirtualBox page
    5. Find constant-activation fix NOPE (see update)

    Sources & Helpful Links:
    VBox-migr, squidoo-virt, mazimi-virt, mazimi-bypass, mesbalivernes-virt, Dutch Translation

    Comments and suggestions welcome!
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Sand Lee; April 13th, 2009 at 07:07 AM. Reason: Tutorial Revamp, Boot Fix, Step 6

  2. #2
    Join Date
    Jan 2005
    Beans
    87

    Re: Boot an existing XP (Physical HD) install with VirtualBox

    This is a very helpful guide. Since it warns that the result will make existing XP install unable to boot natively, it would be nice if there was a bit more detail to prevent confusion.

    It may help clarify to point to some information about "dedicated grub partitions" (e.g., here)

    More important, for the VBoxManage command, can you provide more detail about what is your directory structure?

    Is /dev/sda1 your windows partition?
    Is /dev/sda2 your dedicated grub partition?

    thanks.

  3. #3
    Join Date
    Sep 2007
    Beans
    102
    Distro
    Xubuntu 8.04 Hardy Heron

    Re: Boot an existing XP (Physical HD) install with VirtualBox

    So, by following this guide, I would be able to boot my existing Windows partition as a virtual machine in VirtualBox?

    This sounds good, but I think I'm going to wait until it's possible to boot back into Windows natively. Whats the reason stopping this atm?

    Also, what's the issue with GRUB when using this method? i.e. if you dont remove the timeout and it boots into Linux? I have my Linux and Windows installs on different partitions - would that still be an issue for me?

    Also would there be a way to add an entry to boot straight into the Virtualised XP from grub?

  4. #4
    Join Date
    Apr 2008
    Beans
    2

    Re: Boot an existing XP (Physical HD) install with VirtualBox

    I will try it this week.

    But the guide isnt good for a linux noob :/
    It would be nice if some things are explained more.

    like whats this:
    sudo usermod -G disk -a USERNAME_HERE
    sudo usermod -G vboxusers -a USERNAME_HERE
    VBoxManage internalcommands createrawvmdk -filename WindowsXP.vmdk -rawdisk /dev/sda -partitions 1,2
    Enable Passthrough in CD/DVD to watch DVDs (you'll need to install Win VLC as well)
    Enable IO-ACPI and run it!

  5. #5
    Join Date
    Mar 2007
    Location
    Georgia, USA
    Beans
    304
    Distro
    Ubuntu

    Re: Boot an existing XP (Physical HD) install with VirtualBox

    UPDATE: terminal command has been made simpler

    @ kabanta:
    I added your suggestions. Thanks for giving the link to that tutorial (It's the one I used).
    /dev/sda1 = grub
    /dev/sda2 = windows

    @ gladstone:
    As I said, Virtualbox changes a significant amount of hardware in XP. Chances are, XP will not function correctly if you boot it with your original hardware. Hopefully later versions of VBox will change this behavior.
    Removing the timeout is a safety precaution. If you were not able to specify partitions, there is a chance that you may boot into your currently running install, thus corrupting your partition. Booting straight into the virtual machine would be cool, but I do not think this is possible.

    Edit:
    It seems significant changes are made after installing Guest Additions; so yes, you should be able to boot now after following this tutorial.

    @ spawn12345:
    With the current state of VirtualBox not allowing a user to boot into their partition natively, I do not encourage "linux noobs" to attempt this tutorial. I created the tutorial expecting that the reader have basic knowledge of Virtualbox's interface. The vbox command is explained in the VBox user manual. Any other commands are easily explained in the man pages.
    If VirtualBox becomes more flexible and allows users to boot natively, I will then make this tutorial more beginner friendly.

    Edit:
    Now that I've found a solution to the native booting problem (not installing the guest additions) I will try to make this tutorial friendlier.
    Last edited by Sand Lee; June 14th, 2008 at 08:21 AM.
    Focus on how it can be rather than how it could've been.

  6. #6
    Join Date
    Mar 2007
    Location
    Georgia, USA
    Beans
    304
    Distro
    Ubuntu

    Lightbulb Updates:

    • Major: Native boot issue "solved": Users should not install guest additions* as it will dedicate the partition to virtualization - 4/30/08
    • Major: Revamped the Tutorial (Now 5 steps!) to exclude WPA bypassing methods as I assume most people have already upgraded to SP3 - 07/08/08
    • Minor: Added Guest Additions "undo" section, thanks Mr. Picklesworth! - 07/15/08
    • Minor: Added note about version # and SATA drives. Hopefully a solution will be figured out. - 09/14/08
    • Major: Added VirtualBox Forum version to the tutorial, thanks starfry! - 09/28/08
    • Major: Suceeded in running Vista with Vbox 2.0.4_OSE. Reference. - 11/12/08
    • Major: Fixed MBR problem and ToDo #3 with grub.iso method. Creation of .vmdk's now possible with Opensource VBox - "finishes" ToDo #2 - 11/22/08
    • Minor: Added Experimental Step 6 - 11/29/08

    Testing:

    • BugFix: Included the possible "disk read error" workarounds noted by ciucca and borikru. - 11/13/09


    Deprecated:

    • Minor: Partition safety issue resolved with "mbr" package* - thanks lance2010! Minor tutorial cleanups. - 05/02/08
    • Major: Fixed issue of constantly having to activate windows; activation is now only needed once - 05/04/08
    • Major: With further testing, it seems the activation bypass method outlined in the tutorial doesn't work for SP3. - 05/09/08
    • Major: Troubleshooting section added. Alternate Step 1 added. - 05/12/08
    • Minor: Attached Microsoft WPA Documentation
    • Major: Digging this tutorial (it's been baking for quite a while) - it's now or never - 08/09/08
    • BugFix: Fixed VERR_FILE_NOT_FOUND error. Reference. - 11/13/08
    Attached Files Attached Files
    Last edited by Sand Lee; April 13th, 2009 at 07:12 AM. Reason: Tutorial Revamp and Creation of Deprecated list for irrelevant items.
    Focus on how it can be rather than how it could've been.

  7. #7
    Join Date
    Mar 2007
    Location
    Villenave d'Ornon, France
    Beans
    1,016

    Re: Updates:

    Quote Originally Posted by Sand Lee View Post
    • Native boot issue "solved": Users should not install guest additions as it will dedicate the partition to virtualization - 4/30/08
    Warning:

    This is why it's important to create a SECOND HARDWARE PROFILE, to prevent massive confusion for XP. I wonder if you are able to transfer files b/w Ubuntu and XP without the Guest additions. Also, seamless virtualization of XP is not available if you don't have Guest additions enabled on your machine AFAIK.
    Last edited by the8thstar; May 1st, 2008 at 05:31 AM.
    Desktop : iMac 21.5" (2011) Core i5 Sandy Bridge - AMD Radeon HD 6750M - 8Gb RAM - OS X 10.8.3 Mountain Lion
    Laptop : EasyNote TS 44HR (2012) - Core i3 Sandy Bridge - Intel HD3000 - 4Gb RAM - elementary OS 0.2 + Windows 7 Home Premium SP1

  8. #8
    Join Date
    Aug 2006
    Beans
    121
    Distro
    Ubuntu Development Release

    Re: Boot an existing XP (Physical HD) install with VirtualBox

    Has anyone tried anything like this with Vista?

    Cheers,

    -n8

  9. #9
    Join Date
    Apr 2008
    Beans
    2

    Re: Boot an existing XP (Physical HD) install with VirtualBox

    Remove your grub's timeout option by commenting out the line (if you aren't able to specify the aforementioned partitions)
    Thanks for the tutorial. One important improvement that I gleaned from another post here that eliminates any potential catastrophic problem of booting into the host OS (and hence the need for disabling grub's timeout) is to use a generated MBR.

    1. Install the mbr package:
      Code:
      sudo apt-get install mbr
    2. Generate a dummy MBR:
      Code:
      install-mbr winxp.mbr --force
    3. Use the MBR in creating the .vmdk file. The command I use is the following; adjust accordingly for your particular configuration. Note that I have XP on the first partition.
      Code:
      VBoxManage internalcommands createrawvmdk -filename /home/me/.VirtualBox/WindowsXP.vmdk -rawdisk /dev/sda -partitions 1 -mbr winxp.mbr -relative -register

    This should allow you to boot directly into your WinXP partition without going through grub. Works for me.

  10. #10

    Re: Boot an existing XP (Physical HD) install with VirtualBox

    Will this work with VirtualBox that comes with Ubuntu and installed via apt? I don't have "VBoxManage" but I have "vboxmanage" in my /usr/bin. That one doesn't have "internalcommand" option.

    Then I found VBoxManage in /var/lib/virtualbox, but it won't start saying "cannot open shared object file".

Page 1 of 32 12311 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •