# Overview of QEMU-KVM
・ libvirt
# KVM Architecture

# Quick Commands
# List all supported operating systems. | |
osinfo-query os | |
# Hot add/remove disk. | |
qemu-img create -f qcow2 /var/lib/libvirt/images/vm1-02.qcow2 5G | |
virsh attach-disk vm1 /var/lib/libvirt/images/vm1-2.qcow2 vdb --subdriver qcow2 --live --config | |
virsh detach-disk vm1 vdb --live --config | |
# SELinux | |
setsebool -P virt_use_nfs 1 |
# Tips
Press CTRL + ] to escape VM.
# Create VM
qemu-system-ppc64 -cpu POWER8 -machine pseries -m 4096 -serial stdio \ | |
-drive file=/mnt/d/Qemu/AIX_v7.2/hdisk0.qcow2,if=none,id=drive-virtio-disk0 \ | |
-drive file=/mnt/d/Qemu/AIX_v7.2/hdisk1.qcow2,if=none,id=drive-virtio-disk1 \ | |
-device virtio-scsi-pci,id=scsi \ | |
-device scsi-hd,drive=drive-virtio-disk0 \ | |
-device scsi-hd,drive=drive-virtio-disk1 \ | |
-cdrom /mnt/e/Downloads/AIX_v7.2_Install_7200-03-03-1913_DVD_1_of_2_052019.iso \ | |
-prom-env "boot-command=boot disk:" \ | |
-net nic,macaddr=56:44:45:30:31:32 -net tap,script=no,ifname=tap0 |
# Migration
virsh pool-define-as vm dir --target "/vm" | |
virsh pool-autostart vm | |
virsh pool-start vm | |
virsh pool-list | |
virsh migrate vm1 qemu+ssh://kvm02/system --live --persistent --undefinesource --copy-storage-all --verbose |
# Foreign mount
libguestfs-tools
virt-df -h -d vm1 | |
virt-filesystems -d vm1 | |
guestmount -d vm1 -m /dev/centos/root --rw /mnt | |
guestunmount /mnt |