Virtualization : Booting a OS inside another

Most important thing for me that i am back to My Blog ๐Ÿ™‚

As a majority of users still use windows and Linux on same machine but the main problem is we have to restart our machine again to use other OS, like if we are using LINUX(UBUNTU my preference) ,then to boot Windows(Vista) only option available is restart

But now by using Virtual Box , i can boot my installed Vista from UBUNTU.
Here is how I did:

  1. Install virtualbox package: โ€œsudo apt-get install virtualbox-oseโ€œ

  2. Locate your windows partition: โ€sudo fdisk -lโ€

* This is on my system:*
Device Boot Start End Blocks Id System
/dev/sda1 * 1 6445 51769431 7 HPFS/NTFS
/dev/sda2 6446 10270 30720000 7 HPFS/NTFS
/dev/sda3 10271 13491 25872682+ 5 Extended
/dev/sda4 18415 19457 8370176 7 HPFS/NTFS
/dev/sda5 10271 13309 24410736 83 Linux
/dev/sda6 13310 13491 1461883+ 82 Linux swap / Solaris

So here windows partition is โ€˜dev/sda1โ€ฒ (the one with NTFS filesystem format and active marked as *)

  1. Now need to create a .vmdk file (file format used by virtualbox to emulate hard-disk) and make it point to our real disk sda in our case .
    * sudo vboxmanage -convertSettings internalcommands createrawvmdk -filename ~/.VirtualBox/vista_physical_partition-sda.vmdk -rawdisk /dev/sda

  2. change permissions of .vmdk file to your own user
    sudo chown ~/.VirtualBox/vistaphysicalpartition-sda.vmdk

  3. Now start virtualbox as root and create a new virtual machine.

    New โ€“> Next โ€“> enter your virtualmachine name & choose windows vista as OS type โ€“> Next
    Allocate at least 512MB of ram (1Gb will be good, but LINUX also require atleast 500MB so be careful while allocating RAM), โ€“> Next
    Hard-disk, click EXISTING โ€“> โ€œaddโ€ and go to ~/.VirtualBox/vistaphysicalpartition-sda.vmdk โ€“> Select โ€“> Next โ€“> Finish

Further configuration :
Machine โ€“> Settings
Under General section, allocate at least 50Mb of ram for video
Under Advanced tab ensure โ€œEnable IO APICโ€ is checked and click on OK (check other options also like enabling sound in corresponding sections)

ALL DONE !! Start your machine and enjoy!!!

Comments welcome !!
*IMPORTANT : While creating this machine i had used whole disk so when you start this machine it will boot as your normal system.With GRUB and other options. Please dont boot LINUX from LINUX or WIndows from inside Windows, else you will face serious problems.