UPDATE: I am not able to help troubleshoot this anymore, as I have switched over to VMWare Player (post coming soon!); However, if you happen to discover anything about making it work, please post in the comments below and I will update the post text with your findings and credit you.
Last week, a friend of mine needed me to do an audio file conversion, but the app that I use is installed on my windows partition. I really don’t ever boot into Windows unless I have a good reason for it — I’m much happier tooling around in Linux — there’s just something satisfying and comfortable about being able to pop open a shell at any time.
Anyways – it got me thinking: I’ve booted into a Windows XP image, why can’t I use VirtualBox to boot from a whole partition? Surely that is possible…
Tonight I finally got to play with it. And as you can see from the image here, I got success.
It’s a little challenging, but it’s doable. I had to spend some time to iron out the kinks, but you can reap the benefits!
UPDATE: Sandeep has submitted screenshots with instructions on getting this to work with Windows 7, see below, at the very end.
UPDATE: If you are getting the error message: Offset must be a number: rce
I have found the fix for it. See the instructions below.
UPDATE: Bogdan (see comments) was able to get Windows Vista working under Virtualbox OSE, using the method below. See his comments for specifics on Windows Vista.
UPDATE: Dan has found some tricks for getting this to work with Win7 if you are getting a BSOD on bootup.
Install Virtual Box
Ok, for starters, you need the CLOSED SOURCE version of VirtualBox. As in — do not install the one from the Ubuntu Software Center. Go directly to Sun’s website and download the appropriate version for your OS.
If you’re clever, you can load their PPA into your software sources list (System->Admin->Software Sources), load the key, and that way you’ll get updates automatically! (plus you can apt-get install it
)
Either way — install the most recent version of the personal edition (NOT “OSE”, which is the open-source version.) As of this post, the current version for Karmic (64-bit) is VirtualBox 3.1.2.
Install “mbr”
In order to successfully trick Windows into booting into a confined space, you need to fake your mbr (no grub). Fortunately this is WAY easier than it sounds:
sudo apt-get install mbr
install-mbr –f ~/.VirtualBox/FAKE.mbr
That’s it! We’ll use that later.
Your system will NOT be affected by this — all it does is copy the MBR from your computer, dump it into a file and that’s it.
NOTE: Originally, I had used the full name flag (–force) which uses two dashes. Due to the way my stylesheet renders italicized fonts, it looked like it was a single dash, understandably confusing some people. If you are getting the error message:
install-mbr: Offset must be a number: rce
Then either use just -f instead, or ensure that you are using two -’s before “force”.
UPDATE: Ken D has debugged an issue he had with install-mbr by using the -e1 option.
install-mbr -e1 –force ~/.VirtualBox/FAKE.mbr
His windows partition is /dev/sda1, so if yours is not, you need to use -eN where “N” is the number of the partition where windows is installed. Or not. (More info)
Create a VDMK file
This is actually the trickiest part. A VDMK, which I am not sure what that is an acronym for, is essentially a micro-image that contains instructions to tell MBR where it’s booting from. If your computer is modern, your hard drives are likely SATA drives (and thus represented as /dev/sda). If you’re unsure, just go into a shell and type “fdisk -l” (no quotes, and that last part is a “dash lowercase-L” not “dash one”). What you want is the device name for your harddrive… mine is /dev/sda — depending on how many hard drives you have and what type they are, it might be /dev/hda/ or /dev/sdb/ etc.
It’s worth noting that if you are currently mounting your windows partition in Linux (I do) so that you can access your Windows filesystem while in Linux, you will need to unmount (eg. sudo umount /windows) it first.
You’ll want to determine which partition contains Windows, so we can restrict Windows to ONLY using its own partition — this is actually a Linux-exclusive ability (the Windows version of Vbox can’t do this, because Windows is a wuss). So to do this, first you need to know what partition(s) Windows is on. This command will tell you:
VBoxManage internalcommands listpartitions -rawdisk /dev/sda
For the boldfaced part, use whatever you determined from above. It’s PROBABLY /dev/sda for you too, that’s pretty common.
The command will produce output that looks something like this:
VirtualBox Command Line Management Interface Version 3.1.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0×83 0 /1 /1 1023/254/63 53348 63
2 0×82 1023/254/63 1023/254/63 4000 109258065
3 0×83 1023/254/63 1023/254/63 155998 117451215
4 0×07 1023/0 /1 1023/254/63 91895 436935870
I have to admit, I feel a little naked showing the whole Internet my partition table…
The last line is the one you want to look for, although yours may not be your last line. Whichever one(s) have 0×07 as their “Type” are the one(s) you want. Jot down the number(s) for those. (In this case, my number is just “4″).
Now there’s one last thing we have to do that may make you a little uncomfortable, if you’re a paranoid person. We need to change the permissions on the hard drive device nodes. If you don’t know what that means, then you are probably not paranoid about that.
Fortunately, we only need to change the permissions slightly, and only on the Windows partitions. So it’s not THAT big of a deal.
In a terminal, type:
sudo chmod 666 /dev/sda
sudo chmod 660 /dev/sda4
That second line should reflect whichever hard drives you are using (remember that fdisk -l we did?) You’ll need to repeat the command for each hard drive that you want Windows to be able to access.
For those of you that are paranoid: You should be able to change the permissions back to 600 after we’ve created the VDMK file — VirtualBox needs access to your partition table so it can do its job.
There’s one last thing we need to do, and that’s adding you to the “disk” group, so you can access the partitions you just opened up. You’ll need to logout and log back in after doing this, so that your permissions are reset. (Previously forgot to include the username — thanks Ken!)
sudo usermod -a -G disk yourusername
Ok, now you’re ready to actually create the VDMK file. Get ready because this is a handful.
VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/winxp.vmdk -rawdisk /dev/sda -partitions 4 -mbr ~/.VirtualBox/FAKE.mbr -relative -register
First off — the “sda” is whatever you determined you’re using, from earlier. It’s probably “sda”, like I mentioned earlier.
The number next to the partitions is the numbers you jotted down from the previous “listpartitions” command (the one where I said I felt naked). If you are using more than one partition, you will need to list them as comma-separated values. So if you wanted partitions 1 and 2 for Windows, you would replace the “4″ I wrote there with “1,2″. Partitions 2, 3 and 4 would be “2,3,4″ and so on.
The “partitions” parameter is what tells VirtualBox “only give Windows access to these partitions, and no where else!”
UPDATE: In the comments below, Heix writes:
Got a Win7 64bit Home Professional, with an ACER Recovery Partition as partition 1, the “boot loader”(?) partition as 2, and the actual win7 partition as 3, so i did a “-partitions 1,2,3″. Had to use the .iso of the win7 recovery disc afterwards.
Just to break down what’s going on here:
VBoxManage internalcommands createrawvmdk – this portion runs the program to “Create Raw VMDK”. Self-explanatory. DO NOT USE SUDO HERE (h/t to Javier, below!)
-filename ~/.VirtualBox/winxp.vmdk – this is the output file that actually holds the micro-image. You can call it whatever you like, and you can put it whereever you like. If you have multiple Virtual Machines, you may like to file them away in a separate folder. Whatever you like.
-rawdisk /dev/sda -partitions 4 -This tells it that the raw Windows installation is located on device /dev/sda and that you only want to use partition 4 (yours may be different, as noted above)
-mbr ~/.VirtualBox/FAKE.mbr -relative – the -mbr parameter tells it to use that Fake MBR we created earlier. It won’t work without this. -relative is a parameter that works in conjunction with the -partitions parameter, to allow you to explicitly specify which partition you want to use.
-register – This tells VirtualBox to register it in its database of available images. Not absolutely necessary, but it’s a nice shortcut. Do not use this with version 4 of VBox. (Thanks, Ken D!)
That’s it. Chances are, if you are going to get errors anywhere, it’s likely to be here.
Possible causes, based on my experience and what I’ve read about on the Internet, is that you didn’t set permissions correctly, didn’t unmount your device, are using the Open-source edition (which doesn’t have createrawvdmk) instead of the closed-source personal edition. If you get an error, you can post it in a comment and I’ll see if I can help you, but google around — there are a LOT of resources online for this. Below, I’ll include links to the places I looked.
Load your new VDMK into Virtual Box
Load up Virtualbox, if you installed it through the automated installation (rather than compiling it manually), you should see it in Applications -> System Tools -> Sun Virtual Box. If you don’t see it there, try logging out and logging back in.
In VirtualBox, click on “New”, and follow the instructions for the first couple of screens. Name it whatever you like and select your OS (these instructions have all applied to Windows XP so far — caveat operor on any other versions / OSs). Once you get to the “Virtual Hard Disk” screen (pictured here) select “Use existing hard disk” and you should see the VDMK file we just created. If you don’t, click the little folder icon next to the drop down list. It will allow you to “add” your vdmk file that you created.
Once that’s done, you’ll be back at the main screen.
Click once on your new Virtual Machine, and click the “Settings” icon at the top. You need to do a few more things first.
Configuring your Virtual Machine
In the “System” area, be sure to check “Enable IO APIC” in the “Motherboard” tab. In “Processor”, specify how many CPUs you want to use (ie. I have a Core 2 Duo, so I can choose more than one). You really only need 1 — if you’re doing stuff that requires more, you should probably boot into Windows natively.
In the Acceleration tab — some CPUs have the native instructions built for virtualization — modern Intel CPUs do. If you paid a little extra for your CPU and you bought it in the past year or two, you might have these. I forget the specific models that have it, but it’s something that’s easy to overlook.
Under “Display” area, adjust the slider to specify how much Video RAM you want to give your VM. I picked “64MB” for mine… very modest. You can also check “Enable 2d Acceleration” and “Enable 3d acceleration” simply because it won’t hurt to do so… but again, if you’re doing things that require hardware acceleration, a VM probably isn’t the best way to do it.
That’s it — the rest of the stuff is just icing. You can tinker with it if you want, but you’re good to go.
Click on “OK” to get out of there, then click “Start” (green arrow at the top). The first time you boot up, it may take a little while longer than usual.
This is the other point that is prone to errors. The first time I did this, I had errors because I didn’t do the -partitions parameter in my VDMK creation, which gave me “disk read” errors. You might get a blue screen of death or some other nonsense. If you get any errors — google it. Like I said earlier, there’s lots of support for it.
UPDATE (Additional Notes for Windows 7 Users)
To anyone struggling to get this running with Windows 7, I might be able to save you some time:
If Windows bombs straight to a blue screen of death on boot, in your VM go to settings->storage. If your .vmdk file is listed under SATA, then remove the attachment, then add a new hard disk under IDE, selecting your vmdk file. Next – and this is the crucial bit, in the storage settings again, select the IDE controller, then change its type to ICH6.
Save your settings, and your Windows 7 partition should boot – given you’ve followed all the previous instructions (particularly the windows 7 disc repair option part, which will get you past the ‘MBR 1FA’ problem.)
Thanks to Dan (@lazydan) for the feedback!
Once You’re In Windows
Some of the sites I’ve read have suggested creating an alternate hardware profile for when you boot into Vbox. This is a good idea if you plan on booting into it normally once in a while (for games or whatnot). To create a new Hardware Profile, right click on “My Computer” and click “Properties”. Select “Hardware” then at the bottom, select “Hardware Profiles”. Create a new one and name it “Raw Boot”, and rename the current one to “VBox Boot”.
Windows will go through some growing pains this first boot sequence, as it maps all the hardware drivers to the VirtualBox extensions provided — You will likely need to restart. No guarantees on all the hardware working as it does in a native boot. You should be able to use things like Word, browse the web, use Photoshop (if you allocated enough RAM…you can always change that later), etc. Anything relatively lightweight should be fine.
Working with Windows 7 (Update!)
One of the commenters below, Sandeep (“Sandy”), has figured out how to get a Windows 7 partition to work with this method. There are a couple small steps that need to be done, and he was cool enough to take screen shots for this blog:
- Before you begin, be sure your VDMK is configured, per the instructions above [screenshot]. You will also need to have the Windows 7 Rescue ISO loaded, which can be done within the VirtualBox configuration (before starting a VM instance)
- Once that’s ready, boot up the Windows 7 VM [screenshot] Sandeep is using a newer version of VirtualBox, apparently, but AFAIK, it should still work even if yours says “Sun” instead of “Oracle”
- When prompted, boot to the rescue CD by pressing the appropriate key. [screenshot]
- At the menu, select “Repair Installation” [screenshot]
- Select “Repair & Restart” [screenshot]
I have not personally done this, but based on the comments below, this seems to work for most users. I gather that the problem is an issue of Windows 7 not liking being second banana in the MBR.
I am pretty sure that if you alternately boot raw and boot virtual, you will have to do this rescue disk procedure each time. Be careful with doing a repair on a raw boot, though, if you use Grub. Currently, I do not know of any way to use the partition for both Windows 7 raw and virtual boots without using the rescue disc fix.
Congratulations!
That’s it! Tinkering and optimizing aside, you’re done.
Further Reading
I would not have been able to do this without help from many other bloggers and hackers out there. Here are some of the resources I used to get this working:
- Trouble running VirtualBox with “real” partition (UbuntuForums)
- The VirtualBox user manual (search for “vdmk”)
- VirtualBox: How to boot from an existing Windows XP partition in Ubuntu
- How to Run Virtual Box using a Physical Partition in Feisty Fawn (an older distro, but the methods haven’t changed THAT much)
- Accessing RAW Partitions with VDMK (VirtualBox forums)

Hello
I tried this tutorial but once I have finished everything and I try to launch my windows 7 into VirtualBox, I only see :
MBR 1FA:
What’s wrong ?
Thanks
Pim — Please see the previous comments by both Martin and Sandy — I think those will provide you with the info you need to solve it.
oops!!!
Thanx to aaron, i hv been using windows 7 in the virtual box…
One of the problem with this technique is dat u hv to keep on repairing..
By repair I mean :suppose if u r using windows 7 in VB and den u plan to use the *actual* windows installed(by rebooting and selecting windows 7 from d grub),
den ur windows will automatically repair it once u boot it.
Now one more scenario is dat u r using d *actual* windows and u plan to use win 7 in VB den u hv to manually repair it.This is done by creating an WINDOWS INSTALLER ISO file and boot it in VB and boot windows in VB using dat ISO file and finally repair it.
queries are welcome…
can also post screenshot if required…
@pim: just create an iso file of windows installer and boot it in your VB and repair it.This will fix the error…
ur emal-id…
I tried this with windows 7 and got it working. Only had to repair once.
Also have successfully created an image from it and can use it as a regular vm image with everything in it. Thanks a lot for this post.
very nice tutorial! Thanks!
just a small correction: missing user-name from usermod
sudo usermod -a -G disk
then perfect!
Thanks for the feedback, I’ve fixed it and credited you for the spot!
First of all this is a great tutorial, the most informative in the web regarding how to boot an already installed windows partition while at the same time being able to boot it in the normal way when you want. I am also trying to implement this,however i get the following
# VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/winxp.vmdk -rawdisk /dev/sda -partitions 1 -mbr ~/.VirtualBox/FAKE.mbr -relative -register
Oracle VM VirtualBox Command Line Management Interface Version 3.2.8
(C) 2005-2010 Oracle Corporation
All rights reserved.
ERROR: VMDK: could not open raw partition file ‘/dev/sda1′
Error code VERR_DEV_IO_ERROR at /home/vbox/vbox-3.2.8/src/VBox/Devices/Storage/VmdkHDDCore.cpp(3649) in function int vmdkCreateRawImage(VMDKIMAGE*, VBOXHDDRAW*, uint64_t)
Error while creating the raw disk VMDK: VERR_DEV_IO_ERROR
The raw disk vmdk file was not created
I am running Red Hat Enterprise 5.5, and i am trying to boot my native windows xp partition. (my hard drive is RAID with another hdd in a mirror configuration). Windows are indeed in partition sda1 while i have fixed the permission according to the instructions provided here, however i get the message above. Any ideas?
thanks a lot
Dim, Thanks for stopping by!
The first thing I would check is to see whether or not you have that partition already mounted. I forget if that makes a difference or not, but it’s worth trying.
The second thing I would check is to (a) ensure that you have added yourself to the “disk” users group (or the equivalent for RH), and (b) that the “disk” users group (or its RH equivalent) has full access to that particular partition.
It’s been a few years since I’ve used RH / FC, so the idiosyncratic differences between Deb/RH systems aren’t so fresh in my mind now. Check those things first then come on back.
To poster #9 ‘dim’
I had the same error, and it was because I forgot to log out then log back in to reset my permissions. After that everything was good.
WinXP is asking me to activate it again. Do I need to do this, or is there a way to make it see the activation I’ve been using for my physical boot?
Are you using the OEM version? I think some other people were having similar versions.
You can try activating again, I don’t know firsthand what the consequence will be, however.
Aaron thanks a lot for this article.
Everything went fine, including Windowns 7 32bit Rescue CD iso image.
But when it goes to starting the Win7 itself, the startup crashes after the initial logo, gives a super fast green screen saing something about the display (wasn’t able to take the screenshot despite tried several times). I’ve tried changing display settings both on VB and Win7, no success
The strange thing is the rescue CD flows just fine in X mode
Using Ubuntu 10.10, VB 3.2.10, Windows 7 Enterprise
Any idea?
Cheers!
Hi!
Thanks for this awesome and very easily readable guide. I have the same problem as pim with the text MBR 1FA, I have no ideal how to create a windows installer .iso or a windows system rescue CD, any help?
Karlabob,
Most CD Burning applications (Nero, Brasero, etc) should allow you to “create a disc image” of an existing CD. This is only really necessary if you are using Windows 7 (or, based on some comments I’ve read, Windows Vista). A Windows XP installation *shouldn’t* need it, but it’s a good idea to have one around just in case anyways.
Can you be more specific about the error you’re getting?
Your guide was very easy to follow and I received no errors until I tried to load the vmdk file in VirtualBox. I am new to this, so I may have miss something.
I keep getting the following:
Failed to open the hard disk
/home/xxxxxx/.VirtualBox/HardDisks/winxp.vmdk.
Could not open the medium
‘/home/xxxxxx/.VirtualBox/HardDisks/winxp.vmdk’.
VD: error VERR_ACCESS_DENIED opening image file
‘/home/xxxxxx/.VirtualBox/HardDisks/winxp.vmdk’
(VERR_ACCESS_DENIED).
I believe my problem is that it appears to be two Virtual directories on my system. (not sure, but that is how it looks to me) if I issue a ~/.VirtualBox it takes me to a directory where the files I created are there. There appears to be a hidden directory under my home/xxxx/.VirtualBox/HardDisks it does not contain the files I created. I then went back to ~/.VirtualBox and under that directory there is not HardDisks directory like the one VirtualBox sees when adding hard drives.
Am I missing something from you guide? If I do have two different directories, what is the best way to correct?
Randy let me take a look at my configuration and ill get back to you here.
WOW. It worked!
Professional Windows 7, 64 bit, existing installation running on Ubuntu Linux 10.04, 64 bit.
To Aaron and Sandeep: *major MAJOR* props.
Hi guys,
amazing tutorial!! Got Win7 Home 32bit running within Ubuntu 10.10 ALMOST flawlessly.
Almost? Here’s why…
As I’m pretty new to Win7 I didn’t know that it creates it’s boot record on a partition seperate from the actual Windows partition. So what you actually have to do for creating a raw VMDK for a Win7 system is to integrate this pretty small boot partition to the vmdk file as well.
For me for example the boot record was located on /dev/sda1, the Windows partition on /dev/sda2. When creating a vmdk only for /dev/sda2 I could actually start the virtual machine and everythin with it, but when trying to repair the windows partition, the rescue CD said it wasn’t able to repair.
Creating a VMDK for both /dev/sda1 and /dev/sda2 everything went fine, I could repair my Windows partition and run my Win7 virtual box.
Now the only thing I have to do is see what happens if I reboot the whole system… Hopefully the Windows repair didn’t mess things up and destroy my GRUB or something…
I’ll get back to you as soon as I tried this. Wish me luck and thanks again for the great tutorial!
You created two vmdk as two commands or one command?
On by Netbook partition 1 is the small patition and then partition 2 is the main win7 partition
I have tried using -partitions 1,2 parameter but no dice. Either I get failure with terminal showing MBR:
Or I get Win7 repair disk message. Since the netbook does not have internal DVD/CDROM and external USB one is not getting recognised as a boot device I am stuck.
On positive side Win7 continues to dual boot from grub.
IIRC, the -partitions 1,2 flag doesn’t create two VMDKs, it just specifies which partitions the VMDK should have access to. All partitions accessed must NOT be mounted at the time the VMDK is launched.
Can you paste specifically what your error message was?
Thanks!
Here’s what I did for Win 7 Home Premium (64-bit running on a Lucid 32-bit PAE host) for VirtualBox 4.0.8 from Oracle (on an Asus UL30A, if that matters)
Follow all steps above, except Instead of creating one VMDK, you create two for Win 7: One with an MBR, one without an MBR.
For example, if your Win 7 partition is /dev/sda2, you would issue the following commands:
VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/HardDisks/Win7x64-mbr.vmdk -rawdisk /dev/sda -partitions 2 -mbr ~/.VirtualBox/FAKE.mbr -relative
AND
VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/HardDisks/Win7x64-nombr.vmdk -rawdisk /dev/sda -partitions 2 -relative
Then, you attach the Win7x64-mbr.vmdk as a primary IDE device, and Win7x64-nombr.vmdk as a primary SATA device (assuming you have a SATA controller, that is).
Here’s how (potentially) to avoid the issue of needing to reactivate your Windows installation: http://forums.virtualbox.org/viewtopic.php?t=9697
Follow the DMI decoding steps, then apply the DMI info to your virtual machine using the shell script there. It looked like it worked at first, but now I’m being told that my copy of windows is not genuine
It seems that 4.0.8 is painfully slow compared to vbox-ose 3.2.8 using a raw disk partition. It took about 5 minutes for explorer.exe to launch after finally booting. (Then again, what should I expect from running a 64-bit VM on a 32-bit host with a measly SU7300 processor?)
Of course, if anyone sees problems with using the same partition on two different controllers, please reply – I’m pretty sure that the IDE with an MBR just acts as a stepping stone to get the non-MBR SATA one working.
So, GRUB still there and switching between VirtualBox and DualBoot is fine.
However there seems to be a problem with booting WIn7 directly from the scratch (=no virtualbox) when the VirtualBox Guest additions are installed. WIndows boots fine, however the mouse seems to stick to the lower left corner and after a minute or so Windows shuts down with a bluescreen of death.
)
After booting from VirtualBox and uninstalling the guest additions however I could start Win7 from the scratch as if nothing happened… (apart from repairing of course
Did anyone else try to use the guest additions for such a dual boot configuration and run into similar problems? Not being able to use them seems like a pretty big deal breaker to me, but maybe there’s a way to circumvent this problem… Maybe it is possible to temporarily disable the additions before booting from the scratch or something?
Doing this for Win7
Okay I get to boot but then Win asks for boot repair disk.
Problem: I have a netbook as only way I can connect DVD drive is by USB cable. This is not recognised as boot device in BIOS.
Does anybody has windows 7 ultimate recovery iso file?(pls upload the file and post the link)
I dont want to use my 2.3GB windows installation iso file…
Provided it’s not a copyright/license violation to post that ISO online, I would be happy to host it here and put the link in the main blog post.
Anyone that has it should comment here with an email (put it in the email field) where they can be contacted and we can work out the logistics.
I did all the steps and set up the machine without any hiccups, until I tried running the machine. I am getting a terrible blue screen error on boot within VirtualBox. It’s issuing a stop command, which looks like this: STOP: 0x0000007B (0xF78A6524, 0xC0000034, 0×00000000, 0×00000000)
I did a google search but couldn’t find anything concrete pertaining to virtualbox.
Hi Michael!
Can you give us some more information about your setup? What’s the host OS (the one that’s running Virtualbox) and which Windows OS are you running as a guest OS? also — Are you using VirtualBox open source edition, or closed-source, and which version? Do you have anything funky with your partition table?
Excellent tutorial!
I’m trying to configure VB to run windows from ubuntu 10.4
Initially I had windows installed, then I partitioned my hard drive to run ubuntu.
I need to run windows software from ubuntu using VB.
I went through the setup smoothly until I got to the repair phase. Everytime I click repair I get an error telling that my current iso image is not compatible with my windows installation. But I’m using my installation CD!
Any help will be greatly appreciated
I print my list of partitions:
Oracle VM VirtualBox Command Line Management Interface Version 3.2.12
(C) 2005-2010 Oracle Corporation
All rights reserved.
Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0×07 0 /32 /33 12 /223/19 100 2048
2 0×07 12 /223/20 1023/254/63 152485 206848
What version of Windows are you using? This will matter greatly. Windows XP seems to be, in my experience, far easier (or at least far more cooperative) with this method than Windows 7 has been.
Great post!!! But I tryed everything and the best I acchieved was a Starting Windows screen running forever.. :S
Any tip? I’m running dualboot with Windows 7 Pro 32bits and Ubuntu 10.04 32bits, with VirtualBox 4.0.4.
Before you ask me to change the VB version I advice you that I’ve already it done… I tryed 3.12, 3.10 and 3.8 build releases, and OSEs too.
Thanks,
Tony
——————
Here are some extra informations:
$ fdisk -l /dev/sda
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0×08000000
Device Boot Start End Blocks Id System
/dev/sda1 1 14 112423+ de Dell Utility
/dev/sda2 * 15 1292 10258432 7 HPFS/NTFS
/dev/sda3 1292 12118 86961668+ 7 HPFS/NTFS
/dev/sda4 12118 60802 391053313 5 Extended
/dev/sda5 12118 59676 382009344 83 Linux
/dev/sda6 59676 60802 9042944 82 Linux swap / Solaris
$ VBoxManage internalcommands listpartitions -rawdisk /dev/sda
Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0xde 0 /1 /1 13 /254/63 109 63
2 0×07 14 /5 /56 1023/254/63 10018 225280
3 0×07 1023/254/63 1023/254/63 84923 20742144
5 0×83 1023/254/63 1023/254/63 373056 194666496
6 0×82 1023/254/63 1023/254/63 8831 958687232
About partitions:
sda2 –> Windows 7 Pro 32bits (RecoveryImage)
sda3 –> Windows 7 Pro 32bits
sda5 –> Ubuntu 10.04 LTS 32bits
Hi Tony!
I really can’t make any warranty about this method working with Windows 7, unfortunately. I was able to get it successfully working with Windows XP, and it seems that some others have had luck with getting a Win7/Ubuntu hybrid going, but it’s rather inconsistent. Windows 7 is a bit more greedy w/r/t how it deals with booting virtually/normally.
Have you tried Sandeep’s fix with the recovery disk?
Hi, I followed up all the instructions and everything looks OK. but right after the Boot window ( the one with the blue bar) I got a black screen and nothing happens.
I’m using VB 4.0.4 on Ubuntu 10.10 and Windows XP as guest
Any ideas?
How long did you wait? Sometimes it would take me as much as 5 or 10 minutes to boot into Win XP (either normally *OR* vbox). Was there any feedback at all aside from the screen being black?
I leave it booting for a couple of hours.
Checking the logs I found this
aRC=E_ACCESSDENIED
aComponent={Console} aText={The virtual machine is being powered down}
More information I’ve got from logs
VBox.log
00:18:10.223 Changing the VM state from ‘DESTROYING’ to ‘TERMINATED’.
00:18:10.408 ERROR [COM]: aRC=E_ACCESSDENIED (0×80070005) aIID={515e8e8d-f932-4d8e-9f32-79a52aead882} aComponent={Console} aText={The virtual machine is not powered up}, preserve=false
VBox.log.1
00:00:10.047 Guest Log: BIOS: Booting from Hard Disk…
00:00:16.709 RTC: period=0×200 (512) 64 Hz
00:00:16.888 Display::handleDisplayResize(): uScreenId = 0, pvVRAM=ae7e2000 w=640 h=480 bpp=0 cbLine=0×140, flags=0×1
00:00:24.733 PIIX3 ATA: LUN#0: IDLE IMMEDIATE, CmdIf=0xef (-1 usec ago)
00:00:24.733 PIIX3 ATA: LUN#0: aborting current command
00:00:29.421 OHCI: Software reset
00:00:29.421 OHCI: USB Reset
00:00:29.421 OHCI: USB Operational
00:00:31.304 OHCI: USB Suspended
VBox.log.2
01:52:36.581 Changing the VM state from ‘DESTROYING’ to ‘TERMINATED’.
THANKS! for the great instructions.
I just installed virtual box 4.0.4 from the Oracle website.
Make sure your type 7 partitions are not mounted and that the correcponding /dev/sd.. devices have the permissions as specified in the instructions.
I ran into problem when creating a vmmk file. My C and D drive were partitions 2 and 5, so I thought that I could get away with “-partitions 2,5″. When I got all done I got a “MBR 25FA” that I was not able to get it to boot from. But I also had a restore partition, partition 1, that was also type 7. So I created my vmdk again using “-partitions 1,2,5″ and this worked great. So I would suggest using all of your type 7 partitions in the “-partitions” option or at least including the windows restore/diagnostic/whatever_it_is partition usually in partition 1.
One thing you will notice is that there is no longer a “-register” option to VBoxMange. Just use the command in the instructions and leave this option off. I called my vmdk file “~/.VirtualBox/winxp.vmdk” and noticed that it created this file along with another file “~/.VirtualBox/winxp-pt.vmdk”
When you get to the “Load your new VDMK” step you will need to use the browse option and select the “winxp.vmdk” file, not the “winxp-pt.wmdk”.
This resulted in windows booting right into vVrtualBox.
While booting I got a couple of “installing new hardware” messages and complaints about the video not being 32 bit. I would suggest ignoring all these and install the guest addtitions instead. Selecting “devices->Install guest additions” from the VirtualBox menu. This will install drivers for your video (and something else I don’t remember) and thus clean up your device manager yellow “?” that result from the driver changes that running in VirtualBox requries will cause. It will set your resolution to 800×600, but in windows just right click on the background, choose properties and then settings and set the resolution to what you want it to be.
If you need a “ctrl-alt-del” to login to windows, use the “Machine->Insert Ctrl-Alt-Del” from the VirtualBox menu.
I had previously run windows natively before I started the process and set up a second hardware profile for VirutalBox which I selected during boot. You do this by running “sysdm.cpl” from the run menu, selecting “hardware” and then “hardware profiles”. Use the “copy” button and copy your current profile and name the new one “virtualbox” or whatever you want. Then when windows boots in virtualbox, you will get a boot menu where you can chose the old one (which you use when you boot natively) or the “virtualbox” profile when you boot from VirtualBox. This keeps windows from wanting to switch your drivers back and forth. You can order your profiles using the up and down arrows on the “hardware profiles” pop-up and select the “select the first profile listed if I don’t select a profile” if you rarely use one of the profiles. It is safest to chose “Wait until I select a hardware profile” so that you won’t miss the menu and end up booting into the wrong profile and have windows mess with your drivers.
Hi there!
First of all: great tutorial!
But then: I followed your steps exactly, including the steps recommended for Windows 7 (as this is what I want to use in my VirtualBox, hosted by Ubuntu 10.10 64 bit), and finally got to boot the system. But right after the “Repair & Restart” part, I got a BSOD (which causes the system to reboot immediately) that won’t disappear (well, it re-appears every time I boot).
I then tried to boot the system for real (I read somewhere that the MergeIDE-fix offered by VB could help), but the system seems to be broken beyond repair (the recovery won’t do anything).
Can you please help me with that? Do you need any more info?
Keep up the great work!
Great tutorial! Worked like a charm.
Got a Win7 64bit Home Professional, with an ACER Recovery Partition as partition 1, the “boot loader”(?) partition as 2, and the actual win7 partition as 3, so i did a “-partitions 1,2,3″. Had to use the .iso of the win7 recovery disc afterwards.
Btw: On Kubuntu 10.10 64bit it seems to work with Virtualbox-OSE 3.2.8, no need to use the “non-OSE” .deb from virtualbox.org. Also, I didn’t do the chmod on the device nodes, only added myself to “disk”.
Thanks, Heix! I’ve added your comments to the guide, above!
when I try to boot appears black window saying: Windows failed to start. A recent hardware or software change might be the cause. To fix the problem: ….
My system uses 3 partitions, I assume 1 and 3 belongs to the HP recovery system. So I guess I may use the win7 .iso recovery disc as you said. How should I do that?
Thanks.
Thanks for the tutorial
My system have 3 windows partitions, two of them I guess should be the HP recovery system.
I did not reach to boot, Windows said:
“Windows fialed to starts…
1. INsert your windows installation disc and restart
2. Choose your language settings
3. Click “repair your computer”
If you do not have this disc, contact your system adminstrator or computer manufacturer for assistance.
File: \windwos\system32\boot\winload.exe
Status: 0xc000035a
Info: Attempting to load a 64-bit application, however this CPU is not compatible with 64-bit mode.”
Thanks in advance.
To do the ISO method, you’ll need an ISO file of the Recovery disc, then specify to Vbox that you want to “load it” in the settings for your virtual machine (before starting the session).
The “Info:” error at the bottom is puzzling, I’m not sure what that means, exactly, other than that Win7 is 64-bit and for some reason it thinks the virtualmachine is not.
Bear in mind that when you boot into native Win7 (ie. not in a virtual machine) you will need to do the recovery disc thing again; it seems to require it anytime you switch the means which you boot into win7 with.
i had the same problem… i just restar and the problme it’s solved. Take a look again to your windows partition… and if they are mounted automatically, then unmount it.
DP: Sorry my english isn’t vey good.
It’s no problem, thanks for stopping by.
Hi, I have installed suse 11.4 and vbox 4.0.6 r71344, as i didnt have install-mbr, I did the mbr file with
sudo dd if=/dev/sda of=/home/myuser/VirtualBox.mbr bs=512 count=1
sudo chmod 666 /home/myuser/VirtualBox.mbr
sudo chown myuser:users /home/myuser/VirtualBox.mbr
then i used it for the vmdk file and everything else, but when i start the winxp in virtualbox i just have black screen with
Error No operating system
FATAL: INT18: BOOT FAILURE
any idea pls?????
Hola Jose,
I’m really not sure how to fix this problem; I haven’t used Suse in a LONG time and haven’t experimented with methods outside of those listed in the original article. Perhaps another commenter will be able to pick that up, though?
@jose – Were you able to resolve the mbr issue under SUSE?
Awesome tutorial, Aaron. When would you pick Wine vs Virtual box approach?
Am assuming the VMDK-based OS can’t see the Ubuntu file systems.
Wine is preferable, because it doesn’t block out system resources like VM’ing does, but it’s not always an option for certain software apps that require libraries that aren’t well-implemented yet.
VM’ing Windoze as a guest OS works well when you have (a) an abundance of resources (ie 2 or more CPU cores, although Ideally you want at least 4) and (b) applications that can only natively run in Windows. You can configure most VM programs to make the host OS (Linux, in this case) expose one or more directories to the guest OS, often as “mapped drives” (allowing internal copying, which is much faster) — if you configure the network access for the guest OS to be bridged, the guest appears as its own entity on your network, and can also access any network shares on the guest OS, although it will do that via the router first.
I’m also working on a tutorial for VMWare Express, which I’ve found to be a *little* better performing than VBox.
Whenever I try to add the vmdk to a new machine I get this
Result Code: NS_ERROR_FAILURE (0×80004005)
Component: Medium
Interface: IMedium {9edda847-1279-4b0a-9af7-9d66251ccc18}
Callee: IVirtualBox {d2de270c-1d4b-4c9e-843f-bbb9b47269ff}
I have no idea what it means. I’m using virtualbox on 11.04 and trying to get a Win 7 x64 image working. I’ve already tried making the image again.
I am also getting this error, attempting to load a 64-bit version of windows 7 on 11.04.
EDIT: I figured it out. Re-do the whole process from the “chmod 660, 600″ step. but make sure you’re not the root user at any point.
Howard, can you clarify what you mean by that? I will incorporate it into the original post. Do you mean that you did not use sudo? Or something else?
It seems that the device (e.g. /dev/sdaX) that contains the Windows partition must have permission 660, and make sure your user is actually in the group “disks”.
You can do “ls /dev/sd* -als” to make sure of this.
I too get this same error. Anyone figured out a solution? Using Arch 64bit as host and XP 32bit as guest. VirtualBox is verson 4.1.8*
It says “Invalid parameter ‘-register’”.
It also says (when I enter the create vmdk command without -register, forcing me to create a new disk) that “The medium ‘/home/username/.VirtualBox,winxp-pt.vmdk’ can’t be used as the requested device type.” I also get this message for the other vmdk file.
Did you use a “,” in the filename? That might be why. Also please paste the full command you typed so i can help
No, that was just a typo in the comment. The whole command I used (to create the VMDK file) was
VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/winxp.vmdk -rawdisk /dev/sda -partitions 1,2,3 -mbr ~/.VirtualBox/FAKE.mbr -relative
Neither of the two vmdk files created are accepted by vb.
hmm…. that’s really weird.
Are you using a very recent version of VBox? Since Oracle bought out Sun, it’s possibly they’ve changed things around, although that would be really strange.
You can certainly leave off the -register flag and just register the VMDK with the VBox gui manually — though it looks like you’re still having problems even without that.
One thing I find strange is that the error message is saying:
‘/home/username/.VirtualBox,winxp-pt.vmdk’
when your command was:
~/.VirtualBox/winxp.vmdk
In the former, there is a “,” between “Box” and “winxp”, and also a “-pt” appended to “winxp”. Was that a typo or was that the actual output?
Same problem here
thanks a lot for the post.
I’m using a 64-bit 10.04 Ubuntu host and attempted for two days the process described above for a 32-bit Vista guest, but all I get is a black screen of failure in starting the virtual machine in VirtualBox. Is it possible to virtualize a Vista OS?
Im also gettin the FATAL: INT18: BOOT FAILURE error using debian and win7 ult x64
On Ubuntu 11.10 I get:
$ install-mbr –-force ~/.VirtualBox/FAKE.mbr
Usage: install-mbr [options]
Try ‘install-mbr –help’ for more information.
$ install-mbr –-force /tmp/FAKE.mbr
Usage: install-mbr [options]
Try ‘install-mbr –help’ for more information.
Be sure that you are using the correct number of dashes for the option flags. If you use the full name “force”, you need 2 dashes. If you use just “f”, you only use one dash.
Hi, tutorial goes well up until i try to create the VMDK, at which point I use the command:
VBoxManage internalcommands createrawvmdk -filename /home/gamedrift/.VirtualBox/winxp.vmdk -rawdisk /dev/sda1 -partitions 5 -mbr /home/gamedrift/.VirtualBox/FAKE.mbr -relative
and get the following result:
VBoxManage: error: VMDK: incorrect partition data area ordering set up by the caller in ‘/home/gamedrift/.VirtualBox/winxp.vmdk’
VBoxManage: error: Error code VERR_INVALID_PARAMETER at /home/vbox/vbox-4.1.8/src/VBox/Storage/VMDK.cpp(3656) in function int vmdkCreateRawImage(VMDKIMAGE*, VBOXHDDRAW*, uint64_t)
VBoxManage: error: Cannot create the raw disk VMDK: VERR_INVALID_PARAMETER
VBoxManage: error: The raw disk vmdk file was not created
My box is Gamedrift running Ubuntu 10.10
Closed source version in use.
i look forward to your comments
Rob,
I haven’t really been keeping up with VBox (see the top of the OP) so I’m not sure how to debug your problem. IIRC, though, you will want to make sure that the numeric argument for -partitions flag is the number of the partition where you have windows installed (ie. “5″ corresponds to “/dev/sda5″). I forget whether -rawdisk wants /dev/sda or /dev/sda1 — you may want to try both.
To anyone struggling to get this running with Windows 7, I might be able to save you some time:
If Windows bombs straight to a blue screen of death on boot, in your VM go to settings->storage. If your .vmdk file is listed under SATA, then remove the attachment, then add a new hard disk under IDE, selecting your vmdk file. Next – and this is the crucial bit, in the storage settings again, select the IDE controller, then change its type to ICH6.
Save your settings, and your Windows 7 partition should boot – given you’ve followed all the previous instructions (particularly the windows 7 disc repair option part, which will get you past the ‘MBR 1FA’ problem.)
Many thanks for this article and to everyone who has also contributed – all this plus a bit of fiddling finally got me there!
Thanks for the contribution, dan
ill add this above to the OP!
jesus fucking christ. everyone posts instructions for LINUX even though I searched WINDOWS. I want to mount a physical drive in virtual box running on windows in windows but there is no such thing as /dev/drive bullshit in windows. GOD DAMNIT
Hi there!
Figure it out, piece together the instructions, and write your own how-to guide for windows users. Before this post, there really wasn’t any comprehensive instructions detailing all aspects of the process. I have no idea what is required to get it to work in windows, but I will assume that the process is roughly similar. I would probably start by looking through the VirtualBox application for something that lets you create a VMDK — you may need to do this at the command line, which surely has documentation somewhere.
Good luck! If you do end up writing a post, please send me the link and I will link to you from this post. Thanks!
Very important issue:
If you’re receiving this error message in boot:
MBR
A disk read error occurred
Press Ctrl+Alt+Del to restart
You should edit your generated file in step “Create a VDMK file” and change line:
ddb.geometry.biosHeads=”255″ to ddb.geometry.biosHeads=”240″
Regards !
im hitting this error..
The boot selection failed because required device is inaccesible
I followed the steps mentioned above
let me know if there is any workaround for this problem
can someone help me with this error..
thanks in advance
Ravi, is the booting error occuring during VBox bootup or machine bootup?
You da man! This worked for me. I’m now running a WinXP VM (booted from an existing NTFS partition) in VBox on Linux. I have read and tried many other methods posted in Ubuntu and VBox forums, but this is by far the simplest.
I did have to uninstall Symantec Endpoint Protection (SEP) to allow XP to boot in Normal mode. With SEP, it would boot in Safe mode, but would fail in Normal mode with exceptions in services.exe and lsass.exe. (Now to find Windows AV that is compatible with VBox!)
My setup:
Toshiba Tecra M3 2Ghz single-core processor & 2 GB RAM
VMDK created with 2 NTFS partitions: C: & D:
Ubuntu Lucid Lynx 10.04 LTS
VirtualBox 4.1.8 r75467
Guest settings: 768 MB RAM, 64 MB video memory
– Motherboard Chipset: PIIX3, IO APIC enabled
– IDE Controller Type: PIIX3, Use host I/O cache
Guest OS: Windows XP Pro SP3
Rick
Thanks for stopping by! Glad it was helpful for you — apologies for not keeping it current, but thankfully there are other VBox enthusiasts who are gracious enough to post their progress and hacks on here.
If you had to overcome any difficulties or situations with any clever hacks or discoveries, please feel free to post here and I will add it (with attribution) to the OP above if I can fit it in.
cheers!
Aaron: A million thanks to you and to everyone who contributed to these instructions as I finally got my VM up and running! These were the first instructions I found that were clear and didn’t leave pertinent details out.
Gratefully,
Greg
Glad to hear it’s still working for people
If you run into any other problems or difficulties, please feel free to post here and I will incorporate the changes into the document.
[...] [...]
Excellent tutorial! Thank you Aaron. I found this late, and it clarified some of the finer points I was missing from another explanatiion.
Excellent! Glad you found it useful. If you discover anything I overlooked, please comment here and I will integrate it into the article.
I created the VMDK but when I goto create the virtual disk and point virtualbox to the VMDK, I get the following error:
Failed to open the hard disk /home/myusername/.VirtualBox/win7.vmdk
Permission problem accessing the file for the medium ‘/home/myusername/.VirtualBox/win7.vmdk’ (VERR_ACCESS_DENIED)
You should update this so that, after adding the ‘disk’ group to the user, that they should log out and back in so that this change takes effect.
thanks! reloging solved this, you should put it into the tutorial
thanks for the work Aaron
Can you be more specific about the problem you encountered and what you did to resolve it? I’m happy to include it, thanks!
[...] Someone else has already done a great job of documenting this process, so I'll just link you to it. I also found this resource helpful.Tagged with: linux, tricksCategorised as: Linux Hackery Leave a [...]