Skip to content

Instantly share code, notes, and snippets.

@zorchp
Created October 13, 2023 01:21
Show Gist options
  • Save zorchp/c329e9c34065c1b89df0830d2c8e9ad0 to your computer and use it in GitHub Desktop.
Save zorchp/c329e9c34065c1b89df0830d2c8e9ad0 to your computer and use it in GitHub Desktop.
qemu
#!/usr/bin/env bash
if [ $# -ne 1 ]; then
echo "USAGE: $0 disk"
echo " e.g.: $0 Archlinux.qcow2"
exit 1
fi
if [ ! -f $1 ]; then
echo "could not open $1 : no such file"
exit 1
fi
nohup qemu-system-x86_64 \
-m 2G \
-smp cores=3,threads=1,sockets=1,maxcpus=3 \
-display none \
-nographic \
-drive file=$1,if=virtio,cache=none \
-nic user,hostfwd=tcp::60022-:22 \
-accel tcg \
-cpu q35 \
-D archlinux-vm.log \
-monitor tcp:127.0.0.1:60023,server,nowait &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment