Howto: Windows XP in both VM and native - DISCUSSION

Discussions about using Windows guests in VirtualBox.

Howto: Windows XP in both VM and native - DISCUSSION

Postby vkov_tinsky » 17. Sep 2008, 02:08

Please post any suggestions regarding Howto: Windows XP in both VM and native in this thread.

Thanks,
VT
Last edited by vkov_tinsky on 24. Oct 2008, 15:59, edited 1 time in total.
vkov_tinsky
Volunteer
 
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 17. Sep 2008, 02:12

shenhanc wrote:1. does this mean you can install windows xp via VBOX under some host(linux host) onto the first raw partition of the first harddisk and enable SATA? Boot it either in the VBOX or boot it using the native machine while keeping just a single windows xp installation?

Yes you can. Edit: Windows activation works if one follows the steps in the howto (i.e. does not ask for re-activation when you swap booting natively/in vm).

shenhanc wrote:2. virtualbox 2.0.x said it has a major performance gain if your system is SATA by the NCQ(native command queue) in VBOX 2.0.x, did you feel the performance boost?

Please see the note right at the top: SATA + raw disk access doesn't work in v2.* at the moment (unless I'm mistaken). Edit: This will be fixed in 2.0.4.
I wouldn't worry about disk performance too much - it's already very quick (I mean, SATA in v1.6.6 seems to be quite a bit faster than IDE).

shenhanc wrote:will there be a conflict between the virtualbox addons and the native hardware driver used while booted via native machine?

No there won't, since you'll have two hardware profiles (if you do it correcltly, that is).

shenhanc wrote:is this dual-boot solution stable enough so that I can play video game on the windows xp natively?

Definitely, that's what I use it for. (Games which only require DirectDraw you can then also run on both sides of course.)

Regards,
VT
Last edited by vkov_tinsky on 20. Sep 2008, 01:38, edited 1 time in total.
vkov_tinsky
Volunteer
 
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby TerryE » 17. Sep 2008, 02:46

Thanks VT, the easiest way to write a tutorial is to get someone else to do it. So I just wanted to give you my thanks for this effort, and to say that you have my full support in this exercise.

And shenhanc, sorry for trashing your post in the tutorial, but you beat me to it. phpBB2 doesn't allow you to move posts from one topic to another. I would have quoted it but VT had already done that with the material content.

First thing is format (Edit: Content moved to BBCode style conventions for Posting and Tutotials). I'll do my content comments separately.
Last edited by TerryE on 17. Sep 2008, 06:14, edited 3 times in total.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
TerryE
Volunteer
 
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS

Re:

Postby shenhanc » 17. Sep 2008, 03:42

Hi, VT and Terry, I am a new comer so sorry for posting at the wrong place.

From the ticket 2182 - "Raw vmdk does not work with SATA -> fixed in 2.0.4", seems I have to wait until 2.0.4 for a SATA enabled VBOX. And then I will definitely give a try on this great method and come back here post my feedback.
shenhanc
 
Posts: 12
Joined: 17. Sep 2008, 01:31

Postby TerryE » 17. Sep 2008, 04:11

shenhanc, welcome to forum and no apologies are needed as you weren't to know. We just didn't get the split warning in before you posted your feedback.

VT, I am not sure how best to do this. I certainly don't want you to do a point by point response. Just take what I say as general input; comment on anything specific that you feel necessary; and where appropriate just change the wording in your tutorial. Any BTW you might want to include a changelog as your last post plus another reminder there to use the discussion.
  1. My first comment is that you need to emphasise that what you are doing is a clean dual boot install rather than a migration of an existing dual boot into a triple boot config, because I suspect that that is the direction that people will be coming from. You might just want to refer to this post is you don't want to bloat the inline discussion. However, having done this both ways, I strongly recommend using the approach that you've adopted here and start in VBox first.
  2. Configuration. APIC does need to be turned on, but I/O APIC not. The reason for the APIC is that without it your native boot is going to be too lobotomised, and it is only a minor performance hit in the VM.
  3. Partitioning. The whole issue of partitioning is complex and merits its own post. I have Partition 1 as my Ubuntu root and Partition 2 as my C root for XP, but there is no harm in the order that you suggest, but it is not as you imply mandatory. My personal preference is to keep both root partitions small. I use 10Gb for both my root partitions. On my C drive. I have \Windows, core \Program Files and \Documents and Settings for Administrator, Default User, LocalService and NetworkService. I use a separate D drive for all user files including user D&S.
  4. Checkpoints. Throughout the process I regular snap the C partition just in case I do something disasterous. I have learnt to my cost not to trust the ntfsclone utility. I defrag the partition, use the SysInternals SDelete[b/]tool then do a [b]dd if=/dev/sda2 | gzip -c > yourImagefile. OK p7zip is about 30% smaller but its also a lot slower. These backups are ~1Gb so well worth taking during the process. Unlike System Restore, they work!
  5. Running the VMDK. As I do mount my NTFS partitions using ntfs3g, I do recommend moving the sudo ... VirtualBox command into a script which also checks if the NTFS partitions are mounted and if so then unmounts them before starting VBox. That way you have a proper interlock to prevent you trashing your NTFS partitions.
  6. Installation. I would strongly recommend disabling System Restore and using the backup trick above every few hours work to create a decent rollback point. For the avoidance of doubt, I would rename the first VM BareMetal and the second VBoxVM. At this point in your discussions you are running in the BareMetal profile but in the VM. What you then is to "disable in this profile" all of the VBox-specific H/W rather than uninstall it.
  7. Optional Startup. I think that the general philosophy of making sure that the correct profiles boot with the correct start up is the right thing to do. Also on a specific point, there is no need to download grep as the standard find utility also sets the error status. However, I think that the best thing to do here (and I haven't done this yet) is to run a wsh VBscript from to do all this stuff and the interlocks. This could also check things like your booting in the correct profile and boot option, and force a shutdown if not as well as conditionally start up various utilities.
As far as windows activation goes I think that we both have quite a lot more research to do.

PS. I think that we need to split the dialogue on formatting into a separate topic, which I do now.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
TerryE
Volunteer
 
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS

Postby vkov_tinsky » 17. Sep 2008, 15:46

TerryE wrote:My first comment is that you need to emphasise that what you are doing is a clean dual boot install rather than a migration of an existing dual boot into a triple boot config

I've highlighted the relevant comment regarding this at the top of the article. If you feel it isn't clear enough still you're welcome to modify it.

TerryE wrote:Configuration. APIC does need to be turned on, but I/O APIC not.

I did of course only mean I/O APIC and not ACPI (I added a note just so it's clear.)

TerryE wrote:Partitioning. The whole issue of partitioning is complex and merits its own post. I have Partition 1 as my Ubuntu root and Partition 2 as my C root for XP, but there is no harm in the order that you suggest, but it is not as you imply mandatory. My personal preference is to keep both root partitions small. I use 10Gb for both my root partitions. On my C drive. I have \Windows, core \Program Files and \Documents and Settings for Administrator, Default User, LocalService and NetworkService. I use a separate D drive for all user files including user D&S.

The reason for this section was only to illustrate how to deal with the Windows installer. Creating additional partitions is trivial and of course up to the user. (I've added a comment to hopefully clarify this.) Personally I move "Program Files" and D&S to another partition (and rename them to remove the spaces - don't ask why, I just don't like it :)) .

TerryE wrote:Checkpoints. Throughout the process I regular snap the C partition just in case I do something disasterous.

Since you have some very good ideas about how to go about this maybe you wish to add this as an additional section at the end?

TerryE wrote:Optional Startup [...] Also on a specific point, there is no need to download grep as the standard find utility also sets the error status. However, I think that the best thing to do here (and I haven't done this yet) is to run a wsh VBscript from to do all this stuff and the interlocks.

Ok, done. I'm too used to *nix utilities that I frequently forget to check whether Windows has a viable equivalent. Regarding VBscript: I have to admit that the first thing I do when I install Windows is disable the scripting host. :) But I'm sure it would me a more elegant solution. Or in other words: Feel free to modify a section / add to it / link etc.

TerryE wrote:For the avoidance of doubt, I would rename the first VM BareMetal and the second VBoxVM.

Sorry, are you talking about names for backups for hardware profiles?

TerryE wrote:I do recommend moving the sudo ... VirtualBox command into a script which also checks if the NTFS partitions are mounted and if so then unmounts them before starting VBox.

Since you already have such a script maybe you wish to add it? I've never had the need to write to my ntfs partitions so I've mounted them all as read-only (but of course there will be plenty of users who like rw acccess like yourself).

TerryE wrote:What you then is to "disable in this profile" all of the VBox-specific H/W rather than uninstall it.

And why not uninstall? (Makes more sense since the hardware won't be present). I do realise that chosing uninstall removes the drivers for all profiles but it does of course get re-install when you boot up with the other profile.

Just to be clear: Maybe the how-to seems a bit simplified but this wasn't supposed to be a "every step in-depth" document. I tried to keep it fairly short addressing what I though were the most important points so the reader has enough information to get up and running. So maybe a better title would have been "Getting started: WinXP in VM and natively".

I do fully agree with you that a section on backup would definitely be good as well as a more elegant approach to dealing with startup applictations ( you could of course do the same with services). But all this additional information also applies to people using existing WinXP installations.. so maybe I should remove all the information that is not specific to settings up a new installation? (And all of that should go in a new article maybe, what do you think?)

You know what: I think you're in an ideal position to write a HowTo v1.0 (this being the v0.1 prototype ;)): You see what you don't like / should change and you've got plenty more useful things to add. Or as they say: If you'd like to drive I'll get out of the driving seat :D

Meanwhile I'll try the activation side of things.

Regards,
VT
vkov_tinsky
Volunteer
 
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby TerryE » 17. Sep 2008, 20:54

Sorry, are you talking about names for backups for hardware profiles?
That's what I call my two windows profiles.
maybe you wish to add this as an additional section at the end?
As a moderator I can edit your posts but not v.v. so it's a lot better that you add the place-holder post and I edit that. That way we can both work on it.
Since you already have such a script maybe you wish to add it?
No, I said that I've still to do this, but I haven't got around to it just yet.
And why not uninstall?
Ah, that because you don't install a driver in a profile. Drivers are installed in all profiles, and removing them removes them from all profiles. It's just that by default they are only enabled in the profile that they are installed in. So you will always end up loading conflicting drivers, but theses conflicts are avoided by complimentary enabling/disabling.
all of that should go in a new article maybe
I find it hard to get the level right in these tutorials. It's a case of one man's meat is another man's poison. Some people just seem incapable of taking in detail in too big chunks. Maybe you are right and we do need to introduce some hierarchy.
I think you're in an ideal position to write a HowTo v1.0
Oops, my idea was to find fellow "volunteers" to share the work not to take over from them :lol: But I'll send you a copy of one section reworked to see what you think.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
TerryE
Volunteer
 
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS

Postby TerryE » 19. Sep 2008, 04:27

V, I've made some tweaks to the tutorial: mainly removing blank spaces, but some tweaks around backup etc. Have a browse. And change anything that you don't like.

I've been thinking about this activation issue, and I need to have a play but in essence the only default way you can start the VM is through the vbdisk account. So if we go to the next step and have a nice command such as startxp in $HOME/bin (if you path this in like I do) which can start up the XP VM, then we can put a lot in it, e.g.
  • doing and existence check on /media/sysC/boot.ini and if not them mounting /media/sysD (I am assuming that youl'll have a noauto ntfs-3g entry in your /etc/fstab
  • copy the contents of /media/sysC/windows/system/VMBoot (the activation files) back over the ones in /windows/system to ensure that we are active
  • cping boot.ini_VM over boot.ini. If you have two versions this will load the correct HAL and Kernel
  • cping localStartup.cmd_VM over localStartup.cmd
  • force the umount of /media/sysC
  • do an existence check on /media/dataD/pagefile.sys and if so force a umount /media/dataD. We now guarantee that the XP partitions are not mounted before you start the VM. (we could be clever and to a non-forced with some double check just in case you've got an edit on the go or whatever). We might want to set flags to remember if C and D where mounted.
  • doing a sudo u=vbdisk X.. VBOX ... VBoxManage startvm ... to power up the XP system.
  • (We stall here until the VM is shut down)
  • Check to make sure that a SAV file does not exist. If so then do a VBoxManage discardstate to make sure that we don't trash the partitions.
  • remount C and switch the localStartup.cmd, boot.ini and activation files.
    If it wasn't mounted before then umount it.
  • if D wasn't umounted before then umount it.
This way when you exit you've left the system partition in a state ready to boot native. OK we could be clever and move some of this processing into the site-local init 3 / 01,6 init level processing, but ...

Now we have two versions of localStartup.cmd -- one for native and one for VM boot which can be run from a registry HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run entry. (You can use group policies on XPHome.)

Thoughts?
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
TerryE
Volunteer
 
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS

Postby vkov_tinsky » 19. Sep 2008, 16:58

Thanks for the edits, it's looking more and more civilised now :D

TerryE wrote:copy the contents of /media/sysC/windows/system/VMBoot (the activation files)
I'm pretty sure that won't be necessary (since by having the same MAC for virtual & real NICs it does not trigger re-activation)

TerryE wrote:cping boot.ini_VM over boot.ini. If you have two versions this will load the correct HAL and Kernel
cping localStartup.cmd_VM over localStartup.cmd
The boot.ini choice would save the user from having to make one selection.. but they will still have to select the hardware profile so maybe this is overkill? At what point is it supposed to put back the "native" versions of these? Ah sorry, didn't notice that's at the end.

(We stall here until the VM is shut down)
Check to make sure that a SAV file does not exist. If so then do a VBoxManage discardstate to make sure that we don't trash the partitions.
Personally I would prefer a script which ends with the starting of VirtualBox (or directly starting of the VM). If one leaves out the boot.ini change (since they'll have to choose the h/w profile anyway also), the wpa.dbl swap (which isn't required anymore) and if the startup selection is done with a .vbs or .cmd (either on startup or login by checking e.g. network adapter name) then there are no steps needed after VM shutdown (and also no copying of files necessary before startup). (ok...apart from the discardsate check which would be useful of course)

Terry wrote:do an existence check on /media/dataD/pagefile.sys [...]
In my opinion one mount check example (i.e. for C) would be enough to show how to do this since everyone will have a different approach to partitioning. (For example I personally I leave %windir% and the swapfile on C, keeping docs&sets and programs on another partition.)

TerryE wrote:doing a sudo u=vbdisk X.. VB
I'll add the final bit about that to the relevant section today. (Mine's no starting without password as "rawvb" user.)

TerryE wrote:Now we have two versions of localStartup.cmd -- one for native and one for VM boot which can be run from a registry HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run entry.
Oh no, I don't want to disagree again.. but I will, sorry :) If all the startup commands are put in a separate files then obviously they won't be visible as such in CurrentVersion\Run. I would have thought it to be much easier to prefix to "mycommand" e.g. "vm_only.vbs mycommand" (keeping all entries in the registry). This way you can instantly see in the registry what gets started when (like so).


Since we disagree on some points I propose to hand over the howto to you (I don't like arguing :)). Please let me first make a couple of last changes (only minor, don't worry) and then you can flesh it out / edit as you see fit.

Regards,
VT
vkov_tinsky
Volunteer
 
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 19. Sep 2008, 18:13

vkov_tinsky wrote:Please let me first make a couple of last changes
Ok, I'm done.

I still stand by my opinion that some of your suggetions are over the top (like replacing boot.ini) and the wpa.dbl swap is definitely not necessary (why have two "registrations" when a single one works). And things like how to partition Windows are leaning towards being Windows and not VirtualBox relevant. However that of course is only my own view. (For example you'd have to write about how all references to c:\program files, c:\progra~1, %systemdrive%\program files, %systemdrive%\progra~1 c?\program files and c?\progra~1 have to be replaced in the registry when moving %PROGRAMFILES%. This shows how terrible the registry model is anyway because even if you move programs somewhere else .. when your Windows installation goes BANG all the program related infomation is stored in the registry so you lose loads of settings. Yes ok, so maybe you have a backup of the partition.... oops that was all off topic, sorry)

The last thing I want to say is that (yes ok, so maybe I'm the only one :D) I think it's best to keep the article as accessible as possible for "relative" beginners i.e. by keeping the "nice to have" and more advanced "tweaks" in a separate section. I wrote this initially to highlight the most important points about how to do it, not as the definitive reference with all bells and whistles.

Having said all that (phew): Edit away, I've got nothing more to add :D (Is there some sort of official handing over ceremony? ;)).

Regards,
VT

PS: Don't worry, I'm not trying to invade the forums. I just thought I'd "pay back" (for all the knowledge I've gained and simply because I think VirtualBox is great) by helping with the replies in the forums a little and by writing this howto.
vkov_tinsky
Volunteer
 
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby TerryE » 20. Sep 2008, 01:23

V, You're not invading this forum. I don't own this forum any more than you do. If anyone does, it's the Sun guys. We are just part of the active community that supports it. I am really not into this power kick. I want to broaden the base and involvement of contributors. This is your tutorial. I'll write my own on different topics. What I will do is post to this discussion what my variant is when I get around to it and we can discuss it here.

Thanks for a great tutorial.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
TerryE
Volunteer
 
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS

Ask for help

Postby shenhanc » 22. Oct 2008, 04:28

Hi, all.

I am installing win xp step by step, it is ok while I boot using VBOX, but while booting into native os, I encounted the following error:

Windows could not start because the following file is missing or corrupt:
<Windows root>\System32\hal.dll
Please reinstall a copy of the above file.

I did all what the forum said, but with optional steps not performed. (for example, I did not do this: "[Optional] Enable multi-core/processor support")

I am using VBox 2.0.2 (not the OSE version).

My raw partition is a 3rd primary partition with boot flags enabled.

So could you give me any hint on how to solve this?

Thank you very much!
shenhanc
 
Posts: 12
Joined: 17. Sep 2008, 01:31

Postby vkov_tinsky » 22. Oct 2008, 17:14

shenhanc wrote:Windows could not start because the following file is missing or corrupt:
<Windows root>\System32\hal.dll
Please reinstall a copy of the above file.

The most likely cause is it's trying to boot from the wrong partition. (I got the same message when I modified my boot.ini.) What partition is it pointing to in your boot.ini? If it's the 3rd partition it should be something like multi(0)disk(0)rdisk(0)partition(3).
Secondly: Is this your second hard disk? If that's the case and grub is installed on the other hard disk (not containing windows) you might have to also "swap" round the disks before chainloading (see here). For example:
Code: Select all   Expand viewCollapse view
title      Windows XP
root      (hd1,2)
chainloader   +1
Would change to:
Code: Select all   Expand viewCollapse view
title      Windows XP
map       (hd0, hd1)
map       (hd1, hd0)
root      (hd0,2)
chainloader   +1

(Since when you installed Windows via VirtualBox it only knew of the one hard disk which of course it thinks is the first.)

If it's still causing trouble please post your exact disk/partition/grub/boot.ini setup.

Regards,
VT
vkov_tinsky
Volunteer
 
Posts: 218
Joined: 5. Apr 2008, 20:18

Re:

Postby shenhanc » 23. Oct 2008, 10:13

Hi, VT, thanks a lot!(for your hints and quick response).

With this information I finally booted up my windows natively.

The problem with my disk is that my sda1 resides physically at the end of sda, while sda2 and sda3 resides physically on the beginning, the physical order of these primary partitions is sda2, sda3, sda1. I don't know how my disk turned to be like this, but it is this according to both fdisk and gparted!

So quite interesting, for the vm to startup properly, I have to use this: "multi(0)disk(0)rdisk(0)partition(1)" in boot.ini to refer to sda1. But while booting natively, I have to use "multi(0)disk(0)rdisk(0)partition(3)" to let windows find the partition. It's tricky!


********************************************************************************
Now I booted successfully my native windows, however there is another big problem:

My computer cannot recognize any of my usb devices, mouse or keyboard, so I lost control to my computer totally. After watching the windows booting up and showing a dialog "Found new hardware, install" and a "next" button, I just cannot click it, so actually I cannot install any hardware driver in the native xp. And my computer even do not have any PS/2 for keyboard or mouse, so what can I do? Any suggestions?

(I also tried to remote connect to this windows however, in this time the network card is not even enabled, so still no way out...)
shenhanc
 
Posts: 12
Joined: 17. Sep 2008, 01:31

Postby vkov_tinsky » 23. Oct 2008, 16:47

shenhanc wrote:After watching the windows booting up and showing a dialog "Found new hardware, install" and a "next" button, I just cannot click it, so actually I cannot install any hardware driver in the native xp.

I assume you've got it set to automatically log on and it shows the hardware dialog once it's logged in?

The problem is (as far as I know) that Windows will display the "Found new hardware" dialog forever (i.e. won't continue trying to intall other devices in the mean time) so if it's enumerated a device first which it doesn't have a driver for you're stuck.
If you turn automatic logging-in off for now it should install the drivers it can without prompting (and skip the rest) at the log-in screen. Then you should be able to log in hopefully.

When this is all sorted I'll add some additional notes to the howto based on your findings.

Regards,
VT
vkov_tinsky
Volunteer
 
Posts: 218
Joined: 5. Apr 2008, 20:18

Next

Return to Windows Guests

Who is online

Users browsing this forum: No registered users and 21 guests