Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #200322 > unrolled thread

using a Windows 7 disk image with KVM?

Started byGary Dale <garyndp@gmail.com>
First post2018-09-20 07:10 +0200
Last post2018-09-21 10:10 +0200
Articles 13 — 4 participants

Back to article view | Back to linux.debian.user


Contents

  using a Windows 7 disk image with KVM? Gary Dale <garyndp@gmail.com> - 2018-09-20 07:10 +0200
    Re: using a Windows 7 disk image with KVM? "Alexander V. Makartsev" <avbetev@gmail.com> - 2018-09-20 09:30 +0200
      Re: using a Windows 7 disk image with KVM? Chris <chris2014@postbox.xyz> - 2018-09-21 07:10 +0200
        Re: using a Windows 7 disk image with KVM? "Alexander V. Makartsev" <avbetev@gmail.com> - 2018-09-21 16:00 +0200
          Windows bootloader (was Re: using a Windows 7 disk image with KVM?) Chris <chris2014@postbox.xyz> - 2018-09-22 08:40 +0200
    Re: using a Windows 7 disk image with KVM? didier gaumet <didier.gaumet@gmail.com> - 2018-09-20 10:20 +0200
      Re: using a Windows 7 disk image with KVM? Gary Dale <garyndp@gmail.com> - 2018-09-20 19:30 +0200
        Re: using a Windows 7 disk image with KVM? didier gaumet <didier.gaumet@gmail.com> - 2018-09-20 20:20 +0200
          Re: using a Windows 7 disk image with KVM? Gary Dale <garyndp@gmail.com> - 2018-09-21 06:20 +0200
            Re: using a Windows 7 disk image with KVM? Chris <chris2014@postbox.xyz> - 2018-09-21 07:10 +0200
              Re: using a Windows 7 disk image with KVM? Gary Dale <garyndp@gmail.com> - 2018-09-21 10:10 +0200
                Re: using a Windows 7 disk image with KVM? Chris <chris2014@postbox.xyz> - 2018-09-22 08:40 +0200
              Re: using a Windows 7 disk image with KVM? Gary Dale <garyndp@gmail.com> - 2018-09-21 10:10 +0200

#200322 — using a Windows 7 disk image with KVM?

FromGary Dale <garyndp@gmail.com>
Date2018-09-20 07:10 +0200
Subjectusing a Windows 7 disk image with KVM?
Message-ID<wzZnX-7U3-5@gated-at.bofh.it>
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?

[toc] | [next] | [standalone]


#200327

From"Alexander V. Makartsev" <avbetev@gmail.com>
Date2018-09-20 09:30 +0200
Message-ID<wA1zr-D3-1@gated-at.bofh.it>
In reply to#200322

[Multipart message — attachments visible in raw view] — view raw

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
⠈⠳⣄⠀⠀⠀⠀ 

[toc] | [prev] | [next] | [standalone]


#200364

FromChris <chris2014@postbox.xyz>
Date2018-09-21 07:10 +0200
Message-ID<wAlRw-4h3-7@gated-at.bofh.it>
In reply to#200327
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

[toc] | [prev] | [next] | [standalone]


#200380

From"Alexander V. Makartsev" <avbetev@gmail.com>
Date2018-09-21 16:00 +0200
Message-ID<wAu8p-qR-5@gated-at.bofh.it>
In reply to#200364

[Multipart message — attachments visible in raw view] — view raw

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
⠈⠳⣄⠀⠀⠀⠀ 

[toc] | [prev] | [next] | [standalone]


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

FromChris <chris2014@postbox.xyz>
Date2018-09-22 08:40 +0200
SubjectWindows bootloader (was Re: using a Windows 7 disk image with KVM?)
Message-ID<wAJK9-1ef-1@gated-at.bofh.it>
In reply to#200380
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

[toc] | [prev] | [next] | [standalone]


#200330

Fromdidier gaumet <didier.gaumet@gmail.com>
Date2018-09-20 10:20 +0200
Message-ID<wA2lP-17t-1@gated-at.bofh.it>
In reply to#200322
>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

[toc] | [prev] | [next] | [standalone]


#200348

FromGary Dale <garyndp@gmail.com>
Date2018-09-20 19:30 +0200
Message-ID<wAaW5-65o-1@gated-at.bofh.it>
In reply to#200330
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.

[toc] | [prev] | [next] | [standalone]


#200349

Fromdidier gaumet <didier.gaumet@gmail.com>
Date2018-09-20 20:20 +0200
Message-ID<wAbIt-6zK-1@gated-at.bofh.it>
In reply to#200348
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

[toc] | [prev] | [next] | [standalone]


#200362

FromGary Dale <garyndp@gmail.com>
Date2018-09-21 06:20 +0200
Message-ID<wAl57-3K8-1@gated-at.bofh.it>
In reply to#200349
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!

[toc] | [prev] | [next] | [standalone]


#200365

FromChris <chris2014@postbox.xyz>
Date2018-09-21 07:10 +0200
Message-ID<wAlRw-4h3-5@gated-at.bofh.it>
In reply to#200362
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

[toc] | [prev] | [next] | [standalone]


#200369

FromGary Dale <garyndp@gmail.com>
Date2018-09-21 10:10 +0200
Message-ID<wAoFH-5Tv-5@gated-at.bofh.it>
In reply to#200365
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.

[toc] | [prev] | [next] | [standalone]


#200413

FromChris <chris2014@postbox.xyz>
Date2018-09-22 08:40 +0200
Message-ID<wAJK9-1ef-3@gated-at.bofh.it>
In reply to#200369
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

[toc] | [prev] | [next] | [standalone]


#200370

FromGary Dale <garyndp@gmail.com>
Date2018-09-21 10:10 +0200
Message-ID<wAoFI-5Tv-7@gated-at.bofh.it>
In reply to#200365
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=<mountpoint>/<filename>.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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web