Last thing you'll ever read…again
Posts tagged virtualbox
Tutorial: Boot Ubuntu 9.10 Partition using Virtualbox inside Windows (deprecated)
Nov 22nd
This article is now deprecated as 10.04 has been released. Comments will be disabled. Check back for an updated version.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So Ubuntu 9.10 got released several weeks ago and people have been asking about how to get my old tutorial working for 9.10.
The problem is that Ubuntu 9.10 uses the new grub 2 boot loader which changes LOTS of things. In this tutorial I will be showing you how to get Ubuntu 9.10 (or any other linux OS with grub2) working under your Windows installation.
Before we begin, you should have a dual boot setup. I will NOT be showing you how to setup a dual boot, if you need help plenty of other guides out there.
Step 1: Creating a grub 2 boot iso
The grub iso file will allow you to specify which partition to boot into.
- Boot into Ubuntu
- (OPTIONAL) Configure your /boot/grub/grub.cfg This is so that you don’t accidentally boot into your Windows partition from inside Windows! Bad things will happen if you do!!!
$ gksudo gedit /boot/grub/grub.cfg
Comment out your Windows Menu, should be towards the bottom - Create the bootable iso
$ grub-mkrescue –overlay=/boot/grub GRUB2CD.iso - (DO THIS STEP ONLY IF YOU PERFORMED STEP 2)
$ gksudo gedit /boot/grub/grub.cfg
Uncomment out your Windows Menu, so you still can boot into windows after the reboot! - Move the iso into a location that is accessible by windows
Step 2: Creating the .vmdk file
This creates a file which tells Virtualbox what partition to actually load as the harddrive. Unfortunately, unlike VMWare Workstation, Virtualbox does not support a GUI interface for selecting RAW hard disks as the “virtual hard drive”.
- Boot into Windows
- cd into the directory you installed virtualbox
- Find out which drive contains Ubuntu (if you don’t know already)
Run the command: VBoxManage.exe internalcommands listpartitions -rawdisk \\.\PhysicalDrive1
(where 1 is the number of the hard drive ubuntu is installed on. E.g. Master should be 0, you’re second hard-drive should be 1 etc…The output should be something like:Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0×07 0 /32 /33 1023/254/63 902023 2048
5 0×83 1023/254/63 1023/254/63 49677 1847346543
6 0×82 1023/254/63 1023/254/63 2164 1949086188In this example, my Ubuntu partition is number 5 and the swap is number 6. So my Ubuntu partition lies in PhysicalDrive1
- We now create the VMDK file with the given information
Run the command: VBoxManage.exe internalcommands createrawvmdk -filename C:\ubuntu.vmdk -rawdisk \\.\PhysicalDrive1 -register
Step 3: Setup Virtualbox
Now everything should be ready to setup Virtualbox. Create a new virtual machine. Select the .vmdk file we just created as the hard drive and mount the grub.iso file we created at Step 1.
Step 4: Running the VM
Due to the way grub 2 works, whenever you put into it you now have to load the appropriate grub config file.
Just type the above into terminal and grub should load and boot into your Ubuntu 9.10 installation.
If this has helped you in any way, please take the time to drop a comment (or a donation)! If you have any problems, just post a comment or send me an email through the “Contact me” page.
ISSUES:
- For some reasons Grub does not recognise the partition if you specify the EXACT partition entry of Ubuntu. You have to specify the entire drive for it to be recognised.
- It doesn’t seem to like nvidia drivers in this release so you might have to reset your x.org for it to work inside a VM. Just have to live with the lack of acceleration!
References:
Tutorial: Boot existing Ubuntu Partition using Virtualbox inside Windows (deprecated)
Apr 28th
Edit 22/11/09
Ubuntu 9.10 uses the new grub 2 as its boot-loader thus this article would not work for 9.10. I am currently in the progress of getting 9.10 to work under Virtualbox.
This tutorial would no longer be supported. Any comments regarding support will be ignored.
If you want to get 9.10 working please READ THIS ARTICLE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I recently got Windows 7 and Ubuntu running in a dualboot. However, since I’m using more of Windows now I figured I should probably find a way to run Ubuntu inside my Windows. VM’s are great, but it’d be better if I can actually boot into my existing Ubuntu partition. So I searched the web and kept on finding tutorials on how to boot existing XP partitions inside Windows. So I decided to extrapolate from those tutorials and work my way through it. I’ll be writing how I did it here.
Before we begin, you should have a dual boot setup. I will NOT be showing you how to setup a dual boot, if you need help plenty of other guides out there.
Step 1: Creating a grub boot iso
The grub iso file will allow you to specify which partition to boot into.
- Boot into Ubuntu
- We create the folders and copy the necessary files to setup an iso
Run the command: cd ; mkdir -p iso/boot/grub ; cp /usr/lib/grub/*-pc/stage2_eltorito /boot/grub/menu.lst iso/boot/grub - Configure your ~/iso/boot/grub menu.lst file to boot your target OS (in this case Ubuntu). Remove the “savedefault” option from your target entry if it exists.
- We now create the bootable iso file
Run the command: cd ; mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso - Move the iso to a location that’ll be accessable by your Windows partition
Step 2: Creating the .vmdk file
This creates a file which tells Virtualbox what partition to actually load as the harddrive. Unfortunately, unlike VMWare Workstation, Virtualbox does not support a GUI interface for selecting RAW hard disks as the “virtual hard drive”.
- Boot into Windows
- cd into the directory you installed virtualbox
- We find the partition number that needs to be mounted
Run the command: VBoxManage.exe internalcommands listpartitions -rawdisk \\.\PhysicalDrive1
(where 1 is the number of the hard drive ubuntu is installed on. E.g. Master should be 0, you’re second hard-drive should be 1 etc…The output should be something like:Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0×07 0 /32 /33 1023/254/63 902023 2048
5 0×83 1023/254/63 1023/254/63 49677 1847346543
6 0×82 1023/254/63 1023/254/63 2164 1949086188In this example, my Ubuntu partition is number 5 and the swap is number 6
- We now create the VMDK file with the given information
Run the command: VBoxManage.exe internalcommands createrawvmdk -filename C:\path\ubuntu.vmdk -rawdisk \\.\PhysicalDrive1 -partitions 5,6 -register
Step 3: Setup Virtualbox
Now everything should be ready to setup Virtualbox. Create a new virtual machine. Select the .vmdk file we just created as the hard drive and mount the grub.iso file we created at Step 1. If everything was successful Ubuntu should boot up nicely.
DONE!
If this has helped you in any way, please take the time to drop a comment! If you have any problems, just post a comment or send me an email through the “Contact me” page.
References:
