Hits : 5793

Contents


kvm ( Kernel-based Virtual Machine )


KVM wikipedia[link1]

grep -E '^flags.*(vmx|svm)' /proc/cpuinfo


Packages


top


qemu-kvm -hda WinXP.vmdk

-win2k-hack
-m 256 
-vga std
-boot d
-cdrom WinXP.iso
-no-acpi
-localtime



qemu-kvm winxp.qcow2 -cdrom winxp.iso


qemu-kvm archlinux.vdi


# qemu-img convert -f vdi win2003.vdi -O qcow2 win2003.qcow2

# qemu-img convert -f qcow2 winxp.qcow2 -O qed winxp.qed


qemu-img create -f qcow2 virtualdisk 5G


$ qemu-img info WinXP.vmdk 

image: WinXP/WinXP-disk1.vmdk
file format: vmdk
virtual size: 4.0G (4294967296 bytes)
disk size: 3.6G


kvm archlinux.qcow2


top



qemu-img -f qcow2 vdisk1 10g
qemu-img -f qcow2 vdisk2 10g
qemu-img -f qcow2 vdisk3 10g
qemu-img -f qcow2 vdisk4 10g

kvm \
-cdrom systemrescuecd-x86-2.3.1.iso \
-drive file=vdisk1,if=virtio \
-drive file=vdisk2,if=virtio \
-drive file=vdisk3,if=virtio \
-drive file=vdisk4,if=virtio



User Authentication

sudo saslpasswd2 -a libvirt ebal 
Password: ******
Again (for verification): ******


top

kvm on lvm


# lvcreate -L 5G vg01 -n winxp

# kvm -cpu host -m 2048 /dev/vg01/winxp -cdrom winxp.iso -boot d


top

kvm on lvm on virtio


qemu-kvm -drive file=/dev/vg01/wintest,if=virtio -cdrom winxp.iso -m 1024 -usb -fda viostor-0.1-22.img -cpu host -boot d


viostor-0.1-22.img[link12]

top

virsh qemu-attach


qemu-kvm /dev/vg01/wintest -cdrom winxp.iso -m 1024 -usbdevice tablet -name wintest -vnc :1 -monitor unix:/tmp/wintest,server,nowait -boot menu=on -fda viostor-0.1-22.img 

virsh qemu-attach PID


top

kernel initrd


Boot specific kernel image with initrd image

/usr/bin/qemu-system-x86_64 -kernel vmlinuz -initrd core.gz


dnsmasq


default example

<network>
  <name>default</name>
  <uuid>20afd66e-3b86-4d3d-b7d8-57d03c28ef0c</uuid>
  <bridge name="virbr0"/>
  <forward/>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254"/>
	<host mac='52:54:00:ea:05:c5' name='winxp' ip='192.168.122.20' />
    </dhcp>
  </ip>
</network>



top

qemu-kvm supported machine types


qemu-kvm -M ?


top

qemu-kvm driver


qemu-kvm -device ?


top


libvirt operating system support


virt-install --os-variant list


top


spice channel


host

-device virtio-serial -chardev spicevmc,id=vdagent,name=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0


top



usb 



# lsusb
Bus 001 Device 010: ID 058f:6387 Alcor Micro Corp. Flash Drive


sudo kvm winxp.clone -m 1024 -usb -device usb-host,hostbus=1,hostaddr=10 -cpu host  -usbdevice tablet


top



arm 


qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.img-2.6.32-5-versatile -hda debian_lenny_armel_standard.qcow2 -append "root=/dev/sda1"


top



Links
[link1] https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine

[link2] http://sourceforge.net/projects/kvm/files/qemu-kvm/

[link3] http://wiki.qemu-project.org/download/

[link4] http://libvirt.org/

[link5] https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/

[link6] http://virt-manager.org/

[link7] http://augeas.net/

[link8] http://people.redhat.com/~rjones/febootstrap/files/

[link9] http://libguestfs.org/download/supermin/

[link10] http://libguestfs.org/download/hivex/

[link11] http://libguestfs.org/

[link12] https://balaskas.gr/img/viostor-0.1-22.img