I wish to boot QEMU with a disk image I created from a real machine running Ubuntu. After creating the image and trying to run QEMU, the VM hangs on "Booting from Hard Disk".
I have a desktop x86_64 machine on which I have installed standard Ubuntu 20.04.3. As per the default, this also installed GRUB as the bootloader on the 1TiB HDD. The disk has a GPT, a EFI partition, plus a single ext4 partition (~50GiB). This system boots, runs and is fully functional. Running from a live-USB, I have created a raw image of the entire boot disk. Lets call the image
From a remote machine, I created the image by running
ssh root@<IP> "dd if=/dev/sda bs=100M status=progress | xz -T 8 -1" | unxz | cp --sparse=always /proc/self/fd/0 ae.img
unxz which compressed the data over the network, essentially the entire disk was read by
dd, sent over the network, and written to a sparse file
cp. For the running live USB,
/dev/sda was the HDD. I have checked the partition table for the image using
fdisk, and the data in the actual ext4 partition by mounting it as a loopback device.
I want to run a VM with this disk image on another (almost identical) system using QEMU. I think that if I specify this image as a drive on QEMU, it might try booting from it, then hit the GRUB bootloader, so on and so forth. To keep it identical, I am trying to boot it with a video output. The command I used was:
-m 4G \ -machine type=q35,accel=kvm \ -smp 4 \ -drive format=raw,file=ae.img \ -cpu host \ -display default \ -vga virtio \ -show-cursor
I have specified the image as a drive, given it a vga display, 4GB memory and 4 cores. Should be enough. Running this command gives me a QEMU window as displayed below. I am stuck on booting, with no further progress.
htop reports that QEMU is consuming one core at 100%, with a bar 50% blue (low priority processes) and 50% red (kernel).
How do I diagnose what is going on? Any suggested fixes?