Sunday, October 25, 2009

start installed Windows Vista from Linux using VirtualBox

As a majority of users, I bought a laptop with vista already on it. First things first, I installed linux fedora without even booting into windows and follow its installation process.
Then I thought I could use windows and start it from virtualbox (version 3 - open source edition for me) without having to leave linux!
Here is how I did become superuser by "su" amd follow the following steps:
  1. Install virtualbox package: “yum install virtualbox-ose
  2. Login into windows to finish the installation process (if windows is already set up, then skip this step)
    note: I installed windows with a full reboot on windows (and not from within virtualbox) simply because I could not make the installation process work within virtualbox
  3. Login back into linux and locate your windows partition:  ”sudo fdisk Disk /dev/sda: 320.0 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x8663708e

       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1       18997   152590231+   7  HPFS/NTFS
    /dev/sda2           18997       34896   127711228    7  HPFS/NTFS
    /dev/sda3           34897       37444    20466810    5  Extended
    /dev/sda4           37445       38913    11791360    7  HPFS/NTFS
    /dev/sda5   *       34897       36680    14322688   83  Linux
    /dev/sda6           36680       37444     6143999+  83  Linux

  4. In  my case, windows partition is ‘dev/sda1′ (the one with NTFS filesystem format)
  5. We need to create a fake .vmdk file (file format used by virtualbox to emulate hard-disk) and make it point to our real disk. Run:   

    " Vboxmanage -convertSettings internalcommands createrawvmdk -filename 
    ~/.VirtualBox/vista_physical_partition.vmdk -rawdisk /dev/sda"


  6. change ownership of generated .vmdk file to your own user (so that you won’t need to run virtualbox as root to use this partition): chown ~/.VirtualBox/vista_physical_partition.vmdk
  7. At this point, If u try to start the virtual machine and load vista it will fail! A delicious blue-screen will appear , a solution that i found, on virtualbox website, it consists of modifying some windows registry entries so that windows won’t check HDD structure upon start-up and won’t fail if it changed.
  8. go to http://www.virtualbox.org/wiki/Migrate_Windows
  9. download  MergeIDE utility (in Hard Disk Support section) & save it in a usb key on into windows partition
  10. restart your computer, loading windows, log into it, unzip MergeIDE and execute “MergeIDE.reg” to modify your registry
  11. restart into linux
  12. Now start virtualbox: “svirtualbox” and create your virtual machine:

    1. click on New / Next / enter your virtualmachine name (ex: vista) & choose windows vista as OS type & click on Next
    2. For windows vista, you must allocate at least 512MB of ram (1.5Gb recommended), click on Next
    3. For hard-disk, click on “existing” / “add” and go to ~/.VirtualBox/vista_physical_partition-sda.vmdk / click on “select” / “next” / “Finish”
    4. Now we must further configure this virtualmachine, click on “Machine” / “Settings”
    5. Under “general” section, allocate at least 50Mb of ram for video (in “basic” tab), then click on “advanced” tab and ensure “Enable IO APIC” is checked and click on OK (you can look for more options such as enabling sound in corresponding sections)


  13. AT THIS POINT, I MUST GIVE AN IMPORTANT WARNING: our vmdk file points to entire disk, ie. when we will start our virtual machine, it will be like booting the entire computer => if you have dual boot, you will load grub: DO NOT RUN LINUX within itself! This could screw up your entire linux installation!!!!
    You would start the linux you’re currently running virtualbox on, therefore messing all your linux installation. => MAKE SURE TO LOAD WINDOWS ONLY
  14. start virtualbox, start your virtual machine and load Vista.
    If you’re lucky enough, Vista should start by now
  15. Log in into Vista using virtualbox.

1 comment:

  1. Nice work, and nice blog too. Hope to learn a lot of things from you in the near future.

    ReplyDelete