Use `parted` to create something like this (partition 3 for the data from the original VM)
Model: Linux device-mapper (linear) (dm) Disk /dev/dm-10: 6442MB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 257MB 256MB EFI boot, esp 2 257MB 769MB 512MB boot 3 769MB 5930MB 5161MB ext4 linux 4 5930MB 6441MB 512MB swap swap
partx -a /dev/mapper/vgname-diskname
cp /dev/org-disk /dev/mapper/vgname-diskname3
partex -d /dev/mapper/vgname-diskname
# or if it is not working
dmsetup remove vgname-diskname{partnr}
Debian 11 is currently the highest supported debian os in Debian Bookworm
virt-install -n <vmname> --import --memory <memsize_in_mb> --disk /dev/vgname/diskname --osinfo debian11 --noautoconsole --network 'network=host-bridge' --graphics vnc --boot uefi
Allow ssh with root
echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/tmp_permit_root_login.conf systemctl restart ssh
Add the Debian Install cdrom image (using VMM) and boot it (select rescue).
Install `dosfstools` if needed (for mkfs.fat)
mkfs.fat -n EFI /dev/vda1 mkfs.ext2 -m 0 -L boot /dev/vda2
Add something like this (and make sure existing entries point to the correct device/partition)
/dev/vda2 /boot ext2 defaults 0 2 /dev/vda1 /boot/efi vfat umask=0077 0 1
And then mount /boot and /boot/efi (create folders, copy boot data etc.)
Make sure that correct GRUB is installed
Remove grub-xen-* and install grub-efi-amd64-signed and grub-efi-amd64
ii grub-common 2.06-13+deb12u1 amd64 GRand Unified Bootloader (common files) ii grub-efi-amd64 2.06-13+deb12u1 amd64 GRand Unified Bootloader, version 2 (EFI-AMD64 version) ii grub-efi-amd64-bin 2.06-13+deb12u1 amd64 GRand Unified Bootloader, version 2 (EFI-AMD64 modules) ii grub-efi-amd64-signed 1+2.06+13+deb12u1 amd64 GRand Unified Bootloader, version 2 (amd64 UEFI signed by Debian) ii grub2-common 2.06-13+deb12u1 amd64 GRand Unified Bootloader (common files for version 2)
Edit /etc/default/grub so that the serial console works
GRUB_CMDLINE_LINUX="console=ttyS0,115200"
Install GRUB and update GRUB config and initramfs
grub-install --force-extra-removable update-grub update-initramfs -u
Edit VM XML configuration
virsh edit <vmname>
Update NIC with something like this
<vlan> <tag id='<vlanid>'/> </vlan> <virtualport type='openvswitch'> </virtualport>