Howto: Windows XP in both VM and native - DISCUSSION

Discussions about using Windows guests in VirtualBox.
miniroot
Posts: 19
Joined: 22. Oct 2008, 16:29

XP Guest Backup Optimization

Post by miniroot »

XP has some built-in "backup" mechanisms that might not be necessary when a VM uses snapshots for backup already. Use at own risk, though.
  • disable \windows\system32\dllcache

    Code: Select all

    sfc /cachesize=0
    sfc /purgecache
  • disable System Restore (this is the same as My Computer -> (right click) Properties -> System Restore -> [x] Turn off System Restore on all drives as mentioned in the Installation section already)

    Code: Select all

    echo wscript.quit getobject("winmgmts:root\default:systemrestore").disable("") >sr.vbs
    cscript //nologo sr.vbs
    del sr.vbs
  • compress \windows\$hf_mig$

    Code: Select all

    compact /c /q /s:%systemroot%\$hf_mig$
shenhanc
Posts: 12
Joined: 17. Sep 2008, 01:31

Post by shenhanc »

Hi, VT! Thanks for the good suggestion!

Right, I was using auto-login. I will turn the auto login off and have another try! And will come back here posting the result 3 days later. (vacations from office)
vkov_tinsky
Volunteer
Posts: 218
Joined: 5. Apr 2008, 20:18

Post by vkov_tinsky »

Thanks for your suggestions miniroot. Some comments:
miniroot wrote:XP has some built-in "backup" mechanisms that might not be necessary when a VM uses snapshots for backup already

This howto is about using a real partition as opposed to virtual disks so surely snapshots do not apply.
  1. Windows file protection - Setting the cache size to zero does not disable it completely. (For example certain folders under %PROGRAMFILES% are still protected, i.e. cannot be deleted.) To completely disable WFP on XP (SP2 & SP3) a change to sfc_os.dll needs to be made.
  2. System Restore - No need for a script, this is enough: sc config srservice start= disabled
  3. $hf_mig$ - To save space a much bigger gain comes from removing dllcache and by removing individual components as detailed in this guide.
Regards,
VT
shenhanc
Posts: 12
Joined: 17. Sep 2008, 01:31

Post by shenhanc »

Hi, VT! Finally, I have booted into my windows with usb enabled! I did exactly what you suggested - disable auto log in and wait silently until windows installs the USB driver(took about 1 or 2 minutes). One caveat, please put your windows installation disk into your cdrom, otherwise it will fail to find the drivers!

And here is another note I would like to put it down here for others reference is that once I created a primary partition using some linux tool, installed windows on it and booted it natively, the windows complained "autochk program not found. skipping autocheck." and restarted. I fixed it by changing the partition type from 0x17(Hidden HPFS/NTFS) or anything else to 0x07(NPFS/NTFS), it is strange that some linux tools(for me I used gparted) will create an ntfs with type 0x17 not 0x07 which will cause windows to reboot everytime. You can change it easily using something like "sudo fdisk /dev/sda" and type "t" to change a partition's system id without damage your partition data(only changes the partition table).

Now I will start to install hardware drivers and system update, and I am ready for more challenge problems!
miniroot
Posts: 19
Joined: 22. Oct 2008, 16:29

Post by miniroot »

vkov_tinsky wrote:This howto is about using a real partition as opposed to virtual disks so surely snapshots do not apply.
I misread the topic subject, sorry. Please remove the post. Thanks for the batch tips.
vkov_tinsky
Volunteer
Posts: 218
Joined: 5. Apr 2008, 20:18

Post by vkov_tinsky »

miniroot wrote:
vkov_tinsky wrote:This howto is about using a real partition as opposed to virtual disks so surely snapshots do not apply.
I misread the topic subject, sorry. Please remove the post.
No need to apologise - your points were more than valid. (This is after all a discussion.) :)

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

Post by vkov_tinsky »

shenhanc wrote:One caveat, please put your windows installation disk into your cdrom, otherwise it will fail to find the drivers!
Strange, that didn't happen to me. I've added a note about that.
shenhanc wrote:Now I will start to install hardware drivers and system update
I would definitely suggest you also enable SATA (if you haven't already, of course upgrading to VirtualBox v2.0.4 first).

Regards,
VT
shenhanc
Posts: 12
Joined: 17. Sep 2008, 01:31

Post by shenhanc »

Oh, finally, there comes the 2.0.4, I am eager to trying the SATA!
vkov_tinsky
Volunteer
Posts: 218
Joined: 5. Apr 2008, 20:18

Post by vkov_tinsky »

Oops, I spoke too soon. I now get a segmentation fault when Windows boots (with SATA turned on). I'll do some more testing on that.

Edit: Doesn't work for me with either Ubuntu or Windows hosts (see here).
heiko
Posts: 7
Joined: 16. Oct 2008, 02:32

Help on getting XP Pro run as guest in VB

Post by heiko »

First of all thanks to vkov_tinsky and also TerryE for the detailled instructions and suggestions - so far the best I found on the net.

Unfortunately I belong to the user type who's referred to another thread right at the beginning: I have a dual-boot installation and the last thing I want to do is (re)installing Windows and all the software etc. I have on my native Windows XP Pro installation (this will definitely take much longer than any reading and tweaking I need to do to get VB running).

The link HOWTO: manage VDIs and import native installations does not answer my needs.

So my question: is there an equally (or almost equally) detailled guide to set up raw access to a Windows drive and boot Win XP Pro as guest in Vbox?

Here some details on my setup:
  • Ubuntu Hardy 8.04 host
    Vbox 2.0.4 (yes, I too hoped to have SATA support)
    Win XP Pro OEM SP2 (didn't bother to install SP3)
    4 HDD
    Core Duo processor, 2 Gig memory, nVidia 8600, USB mouse, etc.
Where did I get stuck:
  • I'm able to boot native Windows.
  • Vbox runs, WindowsXP.vmdk for sda1 with -MBR option created and running
  • Vbox USB problem solved (enabled /pci/usbfs ...)
  • Two windows h/w profiles and boot.ini with boot singlecore and multicore options and kernels created
  • Windows starts booting, I can select the single or multicore, then a list of SAFE, NORMAL BOOT etc. and then the VirtualBox/Native dialog. It then boots until the line /windows/.../jgogo.sys and gets stuck. (Just searched the net and found it's the JMicron SATA driver.)
Thanks in advance for your help.
vkov_tinsky
Volunteer
Posts: 218
Joined: 5. Apr 2008, 20:18

Post by vkov_tinsky »

heiko wrote:It then boots until the line /windows/.../jgogo.sys and gets stuck.
That's the main reason I did it from scratch myself: Any one of the hardware drivers (even mouse & keyboard) can potentially cause problems in the VM.

If you're patient you can try to disable them one by one. The problem is that it's not completely straight forward to only load a driver in one hardware profile once it's already installed (which is why the from-scratch is much more likely to work well from the beginning). For example let's say you want to disable agp440.sys:

HKLM\SYSTEM\CurrentControlSet\Services\agp440 contains the Start key but that's of course no good (as it would completely disable it). Instead you need to check the location specified in the ENUM subkey (which in this case is Root\LEGACY_AGP440\0000). Then create a subkey with the location specified under HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\000X\System\CurrentControlSet (where 000X corrersponds to your VM hardware profile). Inside the created 0000 folder you then need to set the a new DWORD: CSConfigFlags=0. Note: I haven't tested this myself so it might not even work.

The other procedure which might work is:
  1. Boot the VM profile natively
  2. From the command line start the device manager (set devmgr_show_nonpresent_devices=1 && devmgmt.msc) and turn "Show hidden devices" on.
  3. Uninstall all hardware specific drivers & run MergeIDE
  4. Boot with the VM profile in VirtualBox
  5. On next boot natively (with the native profile) the drivers you uninstalled should be re-instated (since they still should be in system32 and system32\drivers)
If you or anyone else has a less painful suggestion we'd love to hear it!

Regards,
VT
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
Contact:

Post by TerryE »

heiko, I have a successful triple boot config which is a variant of VTs. I got fed up with all the boot options etc. so a I wrote a wrapper script around the VM start which first mounts then tweaks the C drive for VM boot then remounts and undoes these after the VM has closed. However, the basic approach was a clean install VM first.

I did hack another system in a fairly crude manner which did work. The trick I used is one that I've used in the past when I replaced the motherboard on a system. That was to go into device manager and basically delete the entire H/W configuration then set up a second profile and shut the machine down. I then booted in the VM in the VM profile and allowed it to discover the VM devices and debugged that boot. Again going into the H/W profile I made sure that the devices where available only in this profile. This basically used the GUI interface to set the parameters that VT was discussing.

Once I did this, then I rebooted the bare metal in the bare metal profile and rediscovered / reloaded all the true H/W devices, again making sure that they were enabled only in that profile.

I hadn't worked out the activation trick at the time and this was only an experiment whilst I was waiting for my new test system. The PC that I was using was my wife's. I stopped at this point since continuing 30 years of happy marriage seemed a better alternative than having the extra sand pit :lol:

However, as long as you've done a full off-system backed up of your primary partition (which I would strongly recommend) then you could always try this approach instead.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
vkov_tinsky
Volunteer
Posts: 218
Joined: 5. Apr 2008, 20:18

Post by vkov_tinsky »

TerryE wrote:That was to go into device manager and basically delete the entire H/W configuration then set up a second profile and shut the machine down.
Hmm, I thought that's exactly what I said :?
TerryE wrote: I got fed up with all the boot options etc. so a I wrote a wrapper script around the VM start
There are only two, right? boot.ini & h/w profile choice. (Of course only need to worry about the h/w profile if you put the boot files on a separate virtual disk which results in separate boot.ini for native & vm.) I don't see what there is to get fed up about :) (Ok, so you can automatically set the h/w profile registry key before boot to make it zero boot options but that's surely it.)

Edit: Bah! You replied before I could add a bit more to my reply - I'm just too slow :D

Regards,
VT
Last edited by vkov_tinsky on 25. Oct 2008, 15:55, edited 3 times in total.
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
Contact:

Post by TerryE »

vkov_tinsky wrote:Uninstall all hardware specific drivers
Oops :roll: :lol:

Sorry, been reading and replying to too many posts. Well it just goes to show: great minds think alike. TeHe.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
vkov_tinsky
Volunteer
Posts: 218
Joined: 5. Apr 2008, 20:18

Post by vkov_tinsky »

TerryE wrote:I got fed up with all the boot options etc. so a I wrote a wrapper script around the VM start
Added a couple of notes about this in the Booting natively section.

Regards,
VT
Post Reply