Ingredients: Running system w/ LinuxMint (main system) and other OS's among which is an old Windows 7 image. System boots via GRUB2 into Ubuntu, Windows with no issues.
Here is the system's partion map:
(parted) print
Modell: ATA HGST HTS721010A9 (scsi)
Festplatte /dev/sda: 1000GB
Sektorgröße (logisch/physisch): 512B/4096B
Partitionstabelle: msdos
Disk-Flags:
Nummer Anfang Ende Größe Typ Dateisystem Flags
1 1049kB 252GB 252GB primary ntfs boot
4 252GB 306GB 54,6GB extended
6 252GB 273GB 21,0GB logical ext4
5 273GB 306GB 33,6GB logical linux-swap(v1)
2 306GB 359GB 52,4GB primary ext4
3 359GB 983GB 624GB primary ext4
Partition 1 holds the old W7 image to be converted to a virtual volume.
Scenario:
- Converting existing old W7 system to a VM image with disk2vhd tool under Windows. Result w7.vhdx image file ✓ (Note: This image already can be started with QEMU and Super Grub2 Disk.)
- Convert w7.vhdx to qcow2 format with qemu-image ✓
- Launch w7.qcow2 with
qemu-system-x86_64 -enable-kvm -m 4096M -hda 'w7.qcow2' -vga virtio -usb -device usb-tablet -device usb-host,bus=usb-bus.0,hostbus=1,hostport=1.2 -cdrom /dev/sr0
❌ => System boots into grub rescue - Reboot with
qemu-system-x86_64 -enable-kvm -m 4096M -hda 'w7.qcow2' -vga virtio -usb -device usb-tablet -device usb-host,bus=usb-bus.0,hostbus=1,hostport=1.2 -cdrom /dev/sr0 -boot menu=on
- Press Esc and boot from Super Grub2 Disk in DVD drive ✓ => I am able to boot the Windows system and everything works fine.
- Trying to boot from Live stick or Ubuntu DVD ❌ => system hangs (I was trying to re-install GRUB2 to manage to boot directly into the W7 system on w7.qcow2)
Observations:
Apparently disk2vhd reproduces the disk's partition layout. Super Grub lists the drive's orginal partitions (see above) with "No know filesystem detected" the only exception being the copied W7 partition with correct file system type NTFS and the correct size.
Parted:
(parted) print disk
Fehler: W7.VHDX: unbekannte Partitionstabelle
Fdisk:
Festplatte W7.VHDX: 226,3 GiB, 242934087680 Bytes, 474480640 Sektoren
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
Question: How do I fix w7.qcow2's boot such that QEMU boots directly into the Windows system or the GRUB boot menu with Windows as default system?
Remark: I tried an approach with kpartx, losetup with /dev/loop0 to get this fixed to no avail.