Qemu syntax

From wikinotes

Disks

Documentation
block device options (raw hdd, partitions, etc) https://qemu.weilnetz.de/doc/qemu-doc.html#Block-device-options
disk-image types https://qemu.weilnetz.de/doc/qemu-doc.html#disk_005fimages

https://en.wikibooks.org/wiki/QEMU/Images

SUSE: using devices in QEMU https://www.suse.com/documentation/sles11/book_kvm/data/cha_qemu_running_devices.html

Disk Usage

qemu-system-x86_64 \
    -hda disk.img                                           `# file as partition` \
    -cdrom cdrom.iso                                        `# file as cdrom` \
    -blockdev driver=file,node-name=disk,filename=disk.img  `# file as raw HDD` \

    -drive file=/dev/hdb,media=disk,format=raw              `# real HDD` \
    -drive file=/dev/sr0,media=cdrom                        `# real CDROM` \

Creating Virtual Disks

qemu-img create -f raw myhdd.disk 4G    # Create Virtual image
qemu-img resize myhdd.disk +10G         # You can increase disk size if needed

Networking

Networking within qemu works just like normal. However if you want your host/guest to be able to access each other's networks, you may need additional parameters.

# Reach Host from Guest
ping 10.0.2.2

# Port Forwarding
qemu-system-x86_64 \
    -redir tcp:7777::8610 --nographic            `# redirect guest:8610 to host:7777` \
    -net user,hostfwd=tcp:127.0.0.1:7777-:8610   `# redirect guest:8610 to host:7777 (alternate)`

Shared Folders

QEMU can start a samba server between the host and the guest.

qemu-system-x86_64 \
    -hda /home/me/mydisk.hdd \
    -net nic -net user,smb=/home/myshared/dir

Passthrough Devices

In addition to virtio devices, qemu allows you to access hardware directly. This is super powerful, and dramatically speeds up your VM.

NOTE:

This looks very promising, if VGA-passthrough and I/O is performant enough for games it should be sufficient for what I need it to do.