Qemu
Sommaire
Pre Steps
- Downloaded an OS iso image file to install, in this case ReactOS zip
- Installed Qemu on the host, in this case Arch Linux
pacman -S qemu
Command line options
qemu-system
Ram
-m <SIZE UNIT>
-m 256 M
cdrom
-cdrom <path>
enable-kvm
If virtualisation is enabled in BIOS (enable virtualisation option in BIOS menu) and in OS (load kernel module) use the --enable-kvm to boost perf by allowing virtualisation from host hardware.
cpu
--cpu host tells to use the host cpu as much as possible when kvm is enabled.
soundhw
Create a sound card inside qemu
Install Operating System
Create image disc
qemu-img create -f qcow2 drive.qcow2 16G
Run with iso
qemu-system-x86_64 -cdrom ReactOS-0.4.3.iso -m 4G --enable-kvm -cpu host drive.qcow2
Proceed the installation like on a standard computer
Run
Where $1 is the command line parameter corresponding to the virtual disc drive to run
- Simple
qemu-system-x86_64 image_file
- With RAM, Sound (pulse audio for host, intel hd audio virtual card), kvm and use of host CPU
QEMU_AUDIO_DRV=pa qemu-system-x86_64 $1 -m 4G --enable-kvm -cpu host -soundhw hda
- The same with better mouse grab
QEMU_AUDIO_DRV=pa qemu-system-x86_64 $1 -m 4G --enable-kvm -cpu host -soundhw hda -usb -device usb-tablet
Sharing data
With networking
The common way of sharing data between the host and the guest is to use the local network, for exemple, ssh, ftp, or samba
SSH and SCP
In the host, launch an ssh server.
Under Arch Linux this is
systemctl start sshd.service
In the guest connect to the server
Under Windows a good SCP client is WinSCP
To connect With WinSCP, choose the following options:
- Hostname : the IP adress of the host
- Username : the username on the host
- Password : The password on the host
Mount a raw image
A raw image file can be mounted to access the inner filesystem.
sudo mount -o loop,offset=32256 -t vfat reactos-0.4.3.raw ~/mnt/
Resize an image file
- Increase the image file size
qemu-img resize Win10x64 +20G
- Use the allocated space in the guest
The volume must be resized from inside the guest OS.
For Windows, see Windows 10
Convert Virtual Disc Format
Example, convert a disk from vmdk to qcow2
qemu-img convert -f vmdk -O qcow2 BVM.vmdk BVM.qcow2