Virtualbox is a way to run another operating system within an already running operating system. Originally written by Sun Microsystems, and now owned by Oracle when they bought Sun in 2010, it is one of a dozen Virtual Machine software offerings.
One way I use it is to run Windows and Linux on the same PC at the same time with near-native speed. I call it ‘simultaneous boot’. Here is how I did it.
Start with a multi-core GB memory machine. I suggest at least 4 64-bit cores that support VM in the BIOS (i5-Intel) and 8 GB of RAM. Be sure you have a large disk, such as Seagate’s 1TB $59.00 Barracuda special. You will NEED 64-bit processor and motherboard support for more than 3GB of memory.
Partition and install Windows (XP, 7, etc…) 64-bit on a hard drive first. Windows assumes it owns everything so it is best to let it think that way.
Next partition and install Linux (Ubuntu, Fedora, etc…) 64-bit on the same drive, being careful to skip the existing windows partitions. It will install a boot loader (GRUB, etc…) that allows you to select which operating system you want to run.
http://pagead2.googlesyndication.com/pagead/show_ads.js
Test it out and boot several times between Windows and Linux.
Enable the VM extensions on the motherboard’s BIOS. This will allow one VM to have exclusive rights to whatever number of CPUs you have assigned it.
Download VirtualBox 64-bit from Oracle’s web site, as it has the VRDP, and USB extensions, but mostly because it can handle raw virtual disks. This is where the magic comes in. Normal VMs create files under the host operating system that the guest thinks are real disk drive partitions. In raw VM disks the filesystem for the guest are native to the guest, thereby making it as fast as greased lighting.
If your first drive on the machine is what you want, use ‘PhysicalDrive0’. For me, it’s the second one, so I use ‘PhysicalDrive1’. Be sure to Right Click cmd.exe in the Windows menu and select ‘Run as Administrator’ to enable access to raw disk.
Here is the disk we want to use, Partitions:
1 = Windows 7 ‘System Space’ (type 07)
2 = Windows ‘C:’ (type 07)
5 = Ubuntu ‘swap’ (type 82)
6 = Ubuntu ‘/’ filesystem (type 83
–> they show up as SATA drive 1 <–
cd C:Program FilesOracleVirtualBox
VBoxManage.exe internalcommands listpartitions -rawdisk \.PhysicalDrive1
Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0x07 0 /32 /33 12 /223/19 100 2048
2 0x07 12 /223/20 1023/254/63 499899 206848
5 0x82 1023/254/63 1023/254/63 7720 1024002048
6 0x83 1023/254/63 1023/254/63 446147 1039814656
We need to register the Ubuntu partitions with VB using ‘internalcommands createrawvmdk…’. I want partitions 5 and 6 from the list above.
VBoxManage.exe internalcommands createrawvmdk -filename D:VirtualBoxubuntu.vmdk -rawdisk \.PhysicalDrive1 -partitions 5,6
Now create a new VM in VirtualBox, and choose the existing disk you created above (D:VirtualBoxubuntu.vmdk). Also choose ‘Use Host Disk Cache’ for the SATA controller, and PXII System extensions. Allocate two (half) the CPUs you have, and half (4GB) of memory.
When you boot Ubuntu in VirtualBox it will display the Grub menu:
===> Choose the Linux partition ONLY!!! booting back into a running Windows system will corrupt the disk!!! <====
When I booted into Linux from VirtualBox the window manager did not start, leaving me looking at a black screen with the Login: prompt. To fix this I booted the machine into Linux and removed the proprietary Nvidia video driver, restarted the machine again and selected a lower screen resolution from the default video driver. Now boot back to Windows, run VirtualBox and select Linux from the GRUB menu. The GUI window manager video worked for me!
Now is a good time to install the VirtualBox Host Add-ons from the Device menu. This gets you better video, mouse, USB and file sharing.
References:
http://chaits.accosted.net/?p=54
http://www.neowin.net/forum/topic/784138-howto-boot-existing-ubuntu-partition-using-virtualbox-inside-windows/
http://www.virtualbox.org/manual/ch09.html#rawdisk
Remote Desktop Windows Protocol
To access the box remotely set the VM Display tab ‘Remote Access’ check box on, and change the port to something other than 3389, such as 5000. Leave the Authentication to NULL and time out 5000. Make sure the 3D and 2D video acceleration are turned off.
Start the VM, but leave it at the Login window. Start a Windows Remote Desktop program (RDP, not VNC) and enter the IP address of the Host PC, NOT the VM’s IP, with the trailing port number. For example:
1.2.3.4:5000
If all goes well you will see some warning about non-authentication connection, then click OK and your Linux Login GUI should display. You are in! One funny aspect of this is that using RDP on the local machine has a better display than VirtualBox, due to lowered screen resolution and it has better control over the full-screen view. I need to experiment more with the display settings.
References:
Mac OS X
Windows XP
Windows 7
Linux
Remote Desktop VNC Protocol
To set up VNC to Ubuntu running under Windows 7 Virtualbox you can use the NAT Advanced port forwarding settings and Ubuntu’s tightvncserver (sudo apt-get install tightvncserver). On Windows you can get a VNC client from TightVNC.
- Under Virtualbox setting for Ubuntu, select Network
- Change NAT adapter (the default) port forward:
host port: 5902 – guest port: 5902
- Start Ubuntu, run:
tightvncserver :2
- Test- Windows 7-> Connect to ‘localhost:2’
- Test- Other host -> Connect to ‘<ip address of Windows 7 PC>:2’
References:
Mac OS X
Windows and Linux
The speed of Windows and VM-Ubuntu are exceptionally fast, as if they are both running natively. I have half the CPU and memory allocated to the VM. The other nice advantage is if VirtualBox quits working, I can still dual-boot into both operating systems.
You can also export your entire VM setup and data, then import it somewhere else. Oracle has several examples of that here where you can try out some of their complicated-to-set-up tools without all the muss-and-fuss. I’m not sure how it would export the raw disks.
Hope this helps.
You must be logged in to post a comment.