kvm

warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

KVM Snapshot

virsh domblklist ${VM}
virsh blockcommit ${VM} vda --pivot
virsh domblklist ${VM}

# list snapshots
virsh snapshot-list ${VM}

# delete snapshot
virsh snapshot-delete ${VM} ${TIMESTAMP} --metadata

Links
http://www.bitbull.ch/notes/post/external-qcow2-snapshots-on-centos7-kvm-/
https://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit

oVirt

# install
https://www.ovirt.org/download/
sed -i 's|localhost|ovirt|g' /etc/hosts
sed -i 's|localdomain|dev|g' /etc/hosts
reboot
sudo yum install -y http://resources.ovirt.org/pub/yum-repo/ovirt-release42.rpm
sudo yum install -y ovirt-engine
sudo engine-setup --generate-answer=/tmp/ovirt.out

# cat /tmp/ovirt.out
# action=setup
[environment:default]
OVESETUP_DIALOG/confirmSettings=bool:True
OVESETUP_CONFIG/applicationMode=none:None
OVESETUP_CONFIG/remoteEngineSetupStyle=none:None
OVESETUP_CONFIG/sanWipeAfterDelete=bool:False
OVESETUP_CONFIG/storageIsLocal=bool:False

qcow2

# create image file
qemu-img create -f qcow2 /var/lib/libvirt/images/vm01.qcow2 25G

# create raw disk
chown libvirt-qemu.kvm /var/lib/libvirt/images/vm01.qcow2
chmod 600 /var/lib/libvirt/images/vm01.qcow2

# shrink qcow image
qemu-img convert -O qcow2 image01.in.qcow image.01.out.qcow

# shrink qcow image with compression
qemu-img convert -O qcow2 -c IN.qcow OUT.qcow

# convert
qemu-img convert -O qcow2 ubuntu-16.04-server-cloudimg-amd64-disk1.img ubuntu-16.04-server-cloudimg-amd64-disk1.qcow2

# create image
qemu-img create disk.img -f qcow2 4G

virsh

Manpage
https://linux.die.net/man/1/virsh

# list all vms
virsh list --all

virt-install \
--name ubuntu1604 \
#--ram 2048 \
--disk path=./ubuntu1604.qcow2,size=8 \
--accelerate \
--vcpus 2, maxvcpus=3 \
--memory=1024, maxmemory=2048 \
--memballoon virtio \
#--vcpus 2 \
--os-type linux \
--os-variant generic \
--network bridge=virbr0 \
--graphics none \
--console pty, target_type=serial \
--location "http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/" \
--extra-args "console=ttyS0, 115200n8 serial"

virt-install \

Instal KVM (Kernel-based Virtual Machine)

script:
https://installit.googlecode.com/hg/install.kvm.sh
 
 
# configure locale
wget -q http://www.panticz.de/sites/default/files/scripts/configure_locale.sh -O - | bash -
 
# install on ubuntu
apt-get install -y qemu kvm ubuntu-vm-builder
 
# install on debian
apt-get install -y kvm
apt-get install -y libvirt-bin
apt-get install -y virtinst
 
/etc/init.d/libvirt-bin restart
 
# net
virsh net-start default
virsh net-autostart default
 
# vg
mkdir /etc/libvirt/storage
cat <<EOF> /etc/libvirt/storage/vg0.xml
<pool type='logical'>
  <name>vg0</name>
  <target>
    <path>/dev
Syndicate content