RE: [Xen-users] Importing Windows XP installation

Dustin Henning
Tue, 24 Jun 2008 13:51:43 -0000

I think there is also a fixmbr command from the recovery console.
That might be necessary in your virtual machine as well.  However, I think
your problem may be that there is no partitioning on the virtual disk you
are trying to boot Windows from.  In that case, "CHKDSK C:" will
probably
fail (does not check RAW drives or something), and fixmbr won''t do you
any
good (beyond possibly getting you a new error about cannot find ntldr).
	In PV, whatever you attach (/dev/VG_Guests/win_xp_sp3 in this case)
is passed on to Windows as a drive, so your dd command would in real life be
the equivalent of doing this: (dd if=/dev/sda1 of=/dev/sdb) and then moving
the drive identified as sdb to another computer to boot it.  I don''t
think
fixmbr and fixboot will make such a drive bootable since it isn''t
partitioned.
	What you should probably do is create /dev/sda4 and the fdisk
/dev/sda4 to create a partition table on it where there is a new partition
identical in size to sda1 (if you need to use LVM for this particular setup,
and I don''t believe you do, you would fdisk /dev/VG_Guests/win_xp_sp3,
and I
don''t know if that is directly possible or not).
	Once that is done (and this is an assumption based on several
messages I have seen from the past week), I guess you can use kpartx or
something to make the partitions on the /dev/sda4 partition show up in
/dev/mapper, then you can use your dd command to copy your windows partition
onto the partition you created on your new Windows virtual drive (dd
if=/dev/sda1 of=/dev/mapper/????).  You would then use kpartx again to
remove the partition(s) on /dev/sda4 from /dev/mapper.  Assuming you pulled
this paragraph off, you would then have Windows in an NTFS partition on your
virtual drive, but it still wouldn''t be bootable.
	At this point, fixmbr and fixboot in the virtual machine might work,
but I would skip that and try this (assuming you are NOT using LVM):
dd if=/dev/sda of=/dev/sda4 bs=446 count=1
That will copy the boot sector of your real machine to the boot sector of
your virtual drive without overwriting the partition table you created on
said virtual drive.  In this case, that probably means booting with
grub/lilo and loading the Windows boot information from wherever it is
stored on the new virtual sda1 (that is identical to your existing sda1, so
wherever installing linux moved it to on the original sda1), but regardless,
it would (hopefully) be identical to what your system is currently doing,
and I assume your system currently boots to Windows when you tell it to.
	All of this is probably an exercise in futility, though, because you
are probably still going to have to reactivate, and that is assuming that
you can even get Windows to boot and get all of the necessary drivers to
install.  You may be able to take care of the driver business with some
Physical to Virtual conversion tool (or all of the drivers may even
automatically install if the i386 folder is stored on the partition, and
since they didn''t send you a cd, it might be), and you may not be
concerned
about activation, but know you aren''t out of the water just because you
see
the WindowsXP splash screen.  Good luck to you,
	Dustin


-----Original Message-----
From: xen-users-bounces@lists.xensource.com
[mailto:xen-users-bounces@lists.xensource.com] On Behalf Of flinco@libero.it
Sent: Thursday, June 19, 2008 03:48
To: tical.net
Cc: xen-users
Subject: Re: [Xen-users] Importing Windows XP installation

I wrote "same size of sda1" for brevity but that''s not
exactly true:
sda1 37.19 GiB
sda4 40.94 GiB
I think that more than 3 GiB are enough to cover the LVM overhead.
Anyway waiting for further hints I will try to pass "CHKDSK C:" on the
Recovery Console (booting from CD).

Thanks

Lorenzo

> If /dev/sda1 and /dev/sda4 are exactly the same size, surely the overhead
of
> LVM makes the logical volume a little smaller than /dev/sda1.  Can you
> remake /dev/sda4 as something slightly bigger than /dev/sda1 and retry the
> whole operation?  Without knowing any more than I do about the underlying
> tech used to boot HVM, I''m imagining that something (windows
bootloader,
> qemu?) thinks your partition is invalid because it can''t see the
end of it
> (because the partition is truncated).
>
> -Ray
>
>
>
> On Thu, Jun 19, 2008 at 3:08 AM, flinco@libero.it <flinco@libero.it>
wrote:
>
> > Hi,
> >
> > I''m using a little workstation with the following
configuration:
> > - CPU Intel Q6600
> > - 2 GB DDR3 SDRAM
> > - 250GB SATA2 HD
> >
> > - Win XP SP3 32bit on /dev/sda1 (NTFS)
> > - Fedora 8 32bit on /dev/sda2 (ETX3)
> > - Extended /dev/sda3 with:
> >  + a shared /dev/sda5 (NTFS)
> >  + 2 GB linux swap /dev/sda6
> >
> > I would like to know if it is possible to take the pre-installed WinXP
> > installation (sda1) and to run "as it is" on a xen
paravirtual domain. I
> > would like to do this way because I cannot make a new installation of
> > Windows (I''m doing this on my office machine that runs a XP
downgraded
from
> > Vista, and there''s no XP recover/install CD).
> >
> > It''s my first time with xen and (para)virtualization.
> > I followed Xen User Manual and "How to Install Windows on Xen
3.0".
> > To be able to experiment without damaging the original XP installation
I
> > made a primary unformatted /dev/sda4 (same size of sda1) where I
created
a
> > Volume Group called VG_Guests. Then I filled VG_Guests with a Logical
Volume
> > I called win_xp_sp3.
> > I tried to copy the physical partition sda1 into the logical volume
> > win_xp_sp3 (dd if=/dev/sda1 of=/dev/VG_Guests/win_xp_sp3).
> >
> > I use the following win_xp_sp3.hvm:
> >
> > #===================================================> > import
os, re
> > arch = os.uname()[4]
> > if re.search(''64'', arch):
> >    arch_libdir = ''lib64''
> > else:
> >    arch_libdir = ''lib''
> >
> > kernel = "/usr/lib/xen/boot/hvmloader"
> > builder=''hvm''
> > memory = 768
> > name = "win_xp_sp3"
> > #vcpus=1
> > #acpi=1
> > #apic=1
> > pae=1
> > cpus = "2,3"
> > vif = [ ''type=ioemu, mac=00:1A:4D:5C:69:7B,
bridge=xenbr0'' ]
> > disk = [
> >
''phy:/dev/VG_Guests/win_xp_sp3,ioemu:hda,w'',''phy:/dev/sr0,ioemu:hdc:cdrom,r''
> > ]
> > device_model = ''/usr/'' + arch_libdir +
''/xen/bin/qemu-dm''
> > cdrom="/dev/sr0"
> > boot="dc"
> > #snapshot=1
> > #sdl=1
> > vnc=1
> > vncviewer=1
> > #vncviewer=0
> > #nographic=0
> > #serial=''pty''
> > ne2000=0
> > #usb=1
> > #usbdevice=''tablet''
> > audio=1
> > #localtime=1
> > #full-screen=1
> > #stdvga=0
> >
> > I can boot from cdrom, but I cannot boot the copied XP, because
paravirtual
> > system hangs after showing "Booting From Hard Disk".
> > Then I tried booting a "non genuine" XP CD to access the
Recovery
Console;
> > i run FIXBOOT C: but the system still doesn''t boot.
> >
> > There''s something else I can try?
> >
> > Thanks
> >
> > L.B.
> >
> >
> >
> > _______________________________________________
> > Xen-users mailing list
> > Xen-users@lists.xensource.com
> > http://lists.xensource.com/xen-users
> >