Skip to content

Instantly share code, notes, and snippets.

@CarlFK
Created February 28, 2026 01:28
Show Gist options
  • Select an option

  • Save CarlFK/4a8d96b22daa0535e92d89d7dac6adfd to your computer and use it in GitHub Desktop.

Select an option

Save CarlFK/4a8d96b22daa0535e92d89d7dac6adfd to your computer and use it in GitHub Desktop.
#!/bin/bash
set -ex
dev="/dev/sda"
# sudo apt install qemu qemu-utils qemu-system ovmf
qemu() {
qemu-system-x86_64 \
-m 512 \
-machine q35,accel=kvm \
-cpu host \
-drive file=${dev},if=none,format=raw,id=dev \
-usb \
-device usb-storage,drive=dev \
-boot menu=on
}
# get the installer, write to usb
wget -N http://deb.debian.org/debian/dists/trixie/main/installer-amd64/current/images/hd-media/boot.img.gz
gunzip --keep --force boot.img.gz
sudo dd status=progress if=boot.img of=${dev}
# boots to installer (close qemu window to exit)
qemu
fatresize --progress --verbose --size 2G ${dev}
# boot error:
qemu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment