Uncategorized

KVM/libvirt intro

virt-install -c slackware-14.1-install-d1.iso –network network=default,model=e1000 -n vm1 –disk path=vm1.img,size=30 –ram 384
virt-install -c debian-8.3.0-amd64-CD-1.iso –network network=default,model=e1000 -n vm2 –disk path=/home/sj/vm2.img,size=30 –ram 2048

Ez így RAW image lesz a vm-hez, amit NEM tudsz snapshot-olni, csak menteni:
tar –create –sparse –file /mnt/bkp/guest1-2012-06-03.img.tar /home/sj/vm2.img

alternativa: qemu-img create 1.qcow2 100G

virsh attach-disk vm1 slackware-14.1-install-d1.iso hdc –type cdrom
virsh attach-disk vm1 “” hdc –type cdrom

virsh destroy vm1
virsh undefine vm1

virsh console vm1

virsh dumpxml vm1

$ virsh domblklist vm1 –details
Type       Device     Target     Source
————————————————
file       disk       hda        /home/sj/vm1.img
block      cdrom      hdc        –

$ qemu-img info vm1.img
image: vm1.img
file format: raw
virtual size: 30G (32212254720 bytes)
disk size: 2.0G

$ virsh snapshot-create-as vm1 vm1-snap-1 “1st snap of vm1” –diskspec hda,file=vm1.snap.1.qcow2  –disk-only –atomic

$ virsh snapshot-list vm1
Name                 Creation Time             State
————————————————————
vm1-snap-1        2016-03-31 10:38:22 +0200 disk-snapshot