The provided command launches a QEMU virtual machine on an x86-64 system with 2 virtual CPUs, 3 GB of memory, and various devices such as ATI VGA graphics, virtio network interface, and a virtual hard disk file. The command is customizable and may require modification based on the specific environment and configuration, with notable options including -enable-kvm
for KVM acceleration and -accel hvf
for improved Intel system performance.
qemu-system-x86_64 -monitor stdio \
-device ati-vga \
-enable-kvm -accel hvf \
-smp 2 \
-m 3G \
-net nic,model=virtio -net user,hostname=windowsvm \
-drive if=ide,index=1,media=cdrom,file="" \
-drive file="./Parallels/Windows 10.pvm/harddisk.hdd/harddisk.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds",if=none,id=windowshdd \
-device virtio-blk-pci,drive=windowshdd,bus=pci.0,bootindex=2
#!/bin/bash
# Define device and system settings
MONITOR="stdio"
GPU="ati-vga"
CPU_VIRT="kvm"
CPU_HOST="hvf"
CPU_CORES=2
MEMORY=3G
NETWORK_INTERFACE="virtio"
NETWORK_HOSTNAME="windowsvm"
# Define drive settings
CDROM_MEDIA=cdrom
CDROM_FILE=""
HARD_DISK_FILE="./Parallels/Windows 10.pvm/harddisk.hdd/harddisk.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds"
# qemu-system-x86_64 command settings
qemu_cmd=("qemu-system-x86_64"
"-monitor" "$MONITOR"
"-device" "vgabios" # added vga bios
"-device" "$GPU"
"-enable-kvm"
"-accel" "$CPU_HOST"
"-smp" "${CPU_CORES}"
"-m" "${MEMORY}"
"-net" "nic,model=${NETWORK_INTERFACE}"
"-net" "user,hostname=${NETWORK_HOSTNAME}"
"-drive" "if=ide,index=1,media=${CDROM_MEDIA},file=${CDROM_FILE}"
"-drive" "file=${HARD_DISK_FILE},if=none,id=windowshdd"
"-device" "virtio-blk-pci,drive=windowshdd,bus=pci.0,bootindex=2")
# Execute qemu-system-x86_64 command
execute_qemu() {
"${qemu_cmd[@]}"
}
execute_qemu
The provided command is used to launch a QEMU virtual machine on an x86-64 system.
qemu-system-x86_64
: The QEMU emulator for x86-64 architecture.-monitor stdio
: Sets the monitor to use standard input/output for console interaction.-device ati-vga
: Enables an ATI VGA graphics device for the virtual machine.-enable-kvm
: Enables KVM (Kernel-based Virtual Machine) acceleration for the virtual machine.-accel hvf
: Enables the Hax Virtualization Framework (HVF) for improved performance on Intel systems.-smp 2
: Specifies the number of virtual CPUs (2) for the virtual machine.-m 3G
: Allocates 3 GB of memory for the virtual machine.-net nic,model=virtio
: Enables a virtio network interface for the virtual machine.-net user,hostname=windowsvm
: Enables a user-mode network interface for the virtual machine, with the specified hostname.-drive if=ide,index=1,media=cdrom,file=""
: Mounts an empty CD-ROM drive at IDE index 1.-drive file="./Parallels/Windows 10.pvm/harddisk.hdd/harddisk.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds",if=none,id=windowshdd
: Mounts a virtual hard disk file at an idle interface, with the specified ID.-device virtio-blk-pci,drive=windowshdd,bus=pci.0,bootindex=2
: Configures the virtio block device at PCI bus 0, with the specified boot index.This command is used to launch a virtual machine with the following characteristics:
The specific file path and ID used in the command may vary depending on the environment and configuration.