Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

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