==== Create partition table ==== 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 ==== Copy data to new disk ==== === Add partitions to the kernel for use when copying data === partx -a /dev/mapper/vgname-diskname === Copy data === cp /dev/org-disk /dev/mapper/vgname-diskname3 === Remove the partitons from the kernel === partex -d /dev/mapper/vgname-diskname # or if it is not working dmsetup remove vgname-diskname{partnr} ==== Create VM with libvirt ==== Debian 11 is currently the highest supported debian os in Debian Bookworm virt-install -n --import --memory --disk /dev/vgname/diskname --osinfo debian11 --noautoconsole --network 'network=host-bridge' --graphics vnc --boot uefi ==== To connect with Virtual Machine Manager (VMM) remotely ==== Allow ssh with root echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/tmp_permit_root_login.conf systemctl restart ssh ==== Boot Debian installation in rescue mode ==== Add the Debian Install cdrom image (using VMM) and boot it (select rescue). ==== Create FS for EFI and boot partitons ==== Install `dosfstools` if needed (for mkfs.fat) mkfs.fat -n EFI /dev/vda1 mkfs.ext2 -m 0 -L boot /dev/vda2 ==== Edit /etc/fstab ==== 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.) ==== Install GRUB ==== 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 ==== Configure VLAN for NIC if needed ==== Edit VM XML configuration virsh edit Update NIC with something like this