Re: using a Windows 7 disk image with KVM?

2018-09-22 Thread Chris
On Fri, 21 Sep 2018 04:05:53 -0400
Gary Dale wrote:

> BTW: before making the image, I did run MergeIDE on the physical 
> machine. It is probably required since Windows hates being moved to
> new hardware.

I've also used Merge IDE with Windows XP and 2003. It's a nice tool. Do
you happen to know if there's a version that's suitable for Windows 10?

Chris



Windows bootloader (was Re: using a Windows 7 disk image with KVM?)

2018-09-22 Thread Chris
On Fri, 21 Sep 2018 18:49:43 +0500
Alexander V. Makartsev wrote:

> I always prefer to do the job with the tools that are native to OS.

Me too. Unfortunately, I wasn't able to repair the bootloader when
moving a windows 10 partition with gparted (to resize it later).
Reinstalling Windows was faster.

Chris



Re: using a Windows 7 disk image with KVM?

2018-09-21 Thread Alexander V. Makartsev
On 21.09.2018 09:55, Chris wrote:
> On Thu, 20 Sep 2018 12:28:31 +0500
> Alexander V. Makartsev wrote:
>
>> Depending on source of your disk image I'd try to restore windows
>> bootloader (bcdboot) inside disk image and see if that helps. You can
>> do it from installation media without proceeding with repair
>> procedure. Press Shift-F10 to invoke CMD and from there you can check
>> if your disk image is ok, all partitions are intact (via
>> diskpart.exe) and restore bootloader inside mounted Windows' boot
>> partition (via bcdboot.exe).
> Another option is Mini Tool Partition Wizard [1] to repair Windows
> bootloaders. It seems the onboard tools, especially bcdboot.exe, can't
> fix it always.
>
> Chris
>
>
>
>
>
> [1] https://www.partitionwizard.com/free-partition-manager.html
>
Thanks, but I've used bcdboot for many years on thousands of computers
and it never failed me.

I always prefer to do the job with the tools that are native to OS.

-- 
With kindest regards, Alexander.

⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄ 



Re: using a Windows 7 disk image with KVM?

2018-09-21 Thread Gary Dale

On 2018-09-21 12:53 AM, Chris wrote:

On Fri, 21 Sep 2018 00:13:28 -0400
Gary Dale wrote:


I'm pleased to report that with the firmware change, the new image
booted fine first try! Now I just need to do a little tuning.

Which tool did you use to create the disk image? Was it a physical
machine before?

Did you have to "repair" the windows installation before booting in KVM?

Chris

BTW: before making the image, I did run MergeIDE on the physical 
machine. It is probably required since Windows hates being moved to new 
hardware.




Re: using a Windows 7 disk image with KVM?

2018-09-21 Thread Gary Dale

On 2018-09-21 12:53 AM, Chris wrote:

On Fri, 21 Sep 2018 00:13:28 -0400
Gary Dale wrote:


I'm pleased to report that with the firmware change, the new image
booted fine first try! Now I just need to do a little tuning.

Which tool did you use to create the disk image? Was it a physical
machine before?

Did you have to "repair" the windows installation before booting in KVM?

Chris

I used dd after booting the physical Windows machine using 
systemrescuecd. I mounted a share on the hypervisor machine then did "dd 
if=/dev/sda of=/.raw


When that finished, I ssh'd to the hypervisor and moved the raw file to 
my (unshared) folder of virtual machines.


Finally from my office workstation, I connected to the hypervisor and 
created the new VM from the existing disk image using the UEFI boot 
firmware.


And that was it, almost. I did have to do a little trickery to get it do 
switch to virtio drivers from IDE. It's a chicken & egg situation - you 
need a device that uses the virtio driver before you can install it in 
Windows, so I attached another disk image to use virtio while my 
original still used IDE. After browsing to the correct folder on the 
virtio CD image, I installed the virtio driver then shut down the VM. 
Then I set the boot drive to use virtio and disconnected the other disk 
image. This way Windows has the virtio driver it needs for the boot disk.


You might be able to do this using the repair tools as well but this 
seemed easier. Of course, there is no requirement to use virtio drivers, 
but the speed increase is noticeable.




Re: using a Windows 7 disk image with KVM?

2018-09-20 Thread Chris
On Thu, 20 Sep 2018 12:28:31 +0500
Alexander V. Makartsev wrote:

> Depending on source of your disk image I'd try to restore windows
> bootloader (bcdboot) inside disk image and see if that helps. You can
> do it from installation media without proceeding with repair
> procedure. Press Shift-F10 to invoke CMD and from there you can check
> if your disk image is ok, all partitions are intact (via
> diskpart.exe) and restore bootloader inside mounted Windows' boot
> partition (via bcdboot.exe).

Another option is Mini Tool Partition Wizard [1] to repair Windows
bootloaders. It seems the onboard tools, especially bcdboot.exe, can't
fix it always.

Chris





[1] https://www.partitionwizard.com/free-partition-manager.html



Re: using a Windows 7 disk image with KVM?

2018-09-20 Thread Chris
On Fri, 21 Sep 2018 00:13:28 -0400
Gary Dale wrote:

> I'm pleased to report that with the firmware change, the new image 
> booted fine first try! Now I just need to do a little tuning.

Which tool did you use to create the disk image? Was it a physical
machine before?

Did you have to "repair" the windows installation before booting in KVM?

Chris



Re: using a Windows 7 disk image with KVM?

2018-09-20 Thread Gary Dale

On 2018-09-20 02:11 PM, didier gaumet wrote:

Le 20/09/2018 à 19:25, Gary Dale a écrit :


Thanks. I also use the virt-manager GUI. However what it does is store
the options and creates the command line, so its rarely relevant.
Unfortunately it doesn't seem to expose the firmware option once the VM
is created.

I've installed the package but to get to the firmware option, I had to
create a new VM. When I went to remove the old one, I missed unchecking
the delete storage files box. Now I'll have to create a new disk image.
:(  It's what I get for doing this with a cold and only one cup of
coffee today.

I'll try again later since I have to shut down the source machine to
take the image and that machine is in use.

- I have done a quick and dirty try to import a Win iso: when I click
"Customize config before Install" (something like that: being french, my
Debian is in french), I can chose between BIOS and UEFI.

- It seems (I am not sure) that there is a virt-manager bug (and its
fix) that might be of significance in your case:
  https://bugzilla.redhat.com/show_bug.cgi?id=1503775
- some more info on enabling UEFI in libvirt:
  http://blog.wikichoon.com/2016/01/uefi-support-in-virt-install-and-virt.html
I'm pleased to report that with the firmware change, the new image 
booted fine first try! Now I just need to do a little tuning.


Thanks!



Re: using a Windows 7 disk image with KVM?

2018-09-20 Thread didier gaumet
Le 20/09/2018 à 19:25, Gary Dale a écrit :

> Thanks. I also use the virt-manager GUI. However what it does is store
> the options and creates the command line, so its rarely relevant.
> Unfortunately it doesn't seem to expose the firmware option once the VM
> is created.
> 
> I've installed the package but to get to the firmware option, I had to
> create a new VM. When I went to remove the old one, I missed unchecking
> the delete storage files box. Now I'll have to create a new disk image. 
> :(  It's what I get for doing this with a cold and only one cup of
> coffee today.
> 
> I'll try again later since I have to shut down the source machine to
> take the image and that machine is in use.

- I have done a quick and dirty try to import a Win iso: when I click
"Customize config before Install" (something like that: being french, my
Debian is in french), I can chose between BIOS and UEFI.

- It seems (I am not sure) that there is a virt-manager bug (and its
fix) that might be of significance in your case:
 https://bugzilla.redhat.com/show_bug.cgi?id=1503775
- some more info on enabling UEFI in libvirt:
 http://blog.wikichoon.com/2016/01/uefi-support-in-virt-install-and-virt.html



Re: using a Windows 7 disk image with KVM?

2018-09-20 Thread Gary Dale

On 2018-09-20 04:09 AM, didier gaumet wrote:

>From what you describe, I would surmise that the main problem is that
you use BIOS instead of UEFI to boot your Windows image: if it is not
already installed, install the ovmf package and invoke KVM with the
needed parameters.
There is an ovmf page in the Ubuntu wiki:
  https://wiki.ubuntu.com/UEFI/OVMF

Disclaimer: I have never imported Windows pre-existing images and I do
not use QEMU/KVM directly, only through the virt-manager GUI


Thanks. I also use the virt-manager GUI. However what it does is store 
the options and creates the command line, so its rarely relevant. 
Unfortunately it doesn't seem to expose the firmware option once the VM 
is created.


I've installed the package but to get to the firmware option, I had to 
create a new VM. When I went to remove the old one, I missed unchecking 
the delete storage files box. Now I'll have to create a new disk image.  
:(  It's what I get for doing this with a cold and only one cup of 
coffee today.


I'll try again later since I have to shut down the source machine to 
take the image and that machine is in use.




Re: using a Windows 7 disk image with KVM?

2018-09-20 Thread didier gaumet


>From what you describe, I would surmise that the main problem is that
you use BIOS instead of UEFI to boot your Windows image: if it is not
already installed, install the ovmf package and invoke KVM with the
needed parameters.
There is an ovmf page in the Ubuntu wiki:
 https://wiki.ubuntu.com/UEFI/OVMF

Disclaimer: I have never imported Windows pre-existing images and I do
not use QEMU/KVM directly, only through the virt-manager GUI



Re: using a Windows 7 disk image with KVM?

2018-09-20 Thread Alexander V. Makartsev
On 20.09.2018 10:08, Gary Dale wrote:
> Is this even possible? I can create a KVM guest from a Windows 7
> install DVD iso and it works fine. However I have a Windows 7 disk
> image that I want to virtualize that I can't get to go beyond "Booting
> from Hard Disk..."
>
> Windows 7 running in KVM also doesn't seem to like being repaired. If
> I connect to the DVD install iso, it complains about the disk being
> the wrong version of Windows. I believe this is because it wants a
> UEFI-booted DVD to repair a Windows 7 disk installation.
>
> I'm running this on Debian/Stretch AMD64.
>
> I've seen posts from people doing this with Virtual Box but I'd rather
> stick with KVM if possible.
>
> There don't seem to be a lot of online advice about doing this with
> KVM compared to VirtualBox or VMware. The advice on the other systems
> is also contradictory or old. Sometimes it says to use just the
> Windows partition while other documents say to use the whole disk (in
> my case, there is an EFI partition, another partition and then the
> actual Windows partion). losetup gives me the 3 partitions as block
> devices, so I could extract just the Windows partition if needed...
>
> Has anyone got this to work?
>
>
It looks like booting process can't get past bootloader. It doesn't even
start to boot Win7 itself.

May I ask, how did you created Win7 disk image? Is it raw byte-to-byte
copy? What software did you used to create said image?

If Win7 repair complains about DVD .iso it probably is different,
because there are multiple versions of channels Windows is distributed
through and every channel has different version.

Depending on source of your disk image I'd try to restore windows
bootloader (bcdboot) inside disk image and see if that helps. You can do
it from installation media without proceeding with repair procedure.
Press Shift-F10 to invoke CMD and from there you can check if your disk
image is ok, all partitions are intact (via diskpart.exe) and restore
bootloader inside mounted Windows' boot partition (via bcdboot.exe).


-- 
With kindest regards, Alexander.

⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄