kvm install

sudo pacman -S qemu virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat iptables ebtables edk2-ovmf dmidecode sudo systemctl enable libvirtd.service sudo systemctl start libvirtd.service

Open the file /etc/libvirt/libvirtd.conf for editing.

sudo vi /etc/libvirt/libvirtd.conf Set the UNIX domain socket group ownership to libvirt, (around line 85)

unix_sock_group = "libvirt" Set the UNIX socket permissions for the R/W socket (around line 102)

unix_sock_rw_perms = "0770" Add your user account to libvirt group.

sudo usermod -a -G libvirt $(whoami) newgrp libvirt Restart libvirt daemon. sudo systemctl restart libvirtd.service

change default path

https://dwaves.org/2015/07/20/linux-kvm-how-to-change-default-location-where-libvirt-vm-images-are-saved/ utility which comes with libvirt package.

First, run the following command to dump XML definition of the default storage pool.

$ virsh pool-dumpxml default > pool.xml Open this XML file with a text editor, and change <path> element from /var/lib/libvirt/images to a new location. Remove the current default pool.

$ virsh pool-destroy default Pool default destroyed Now create a new storage pool based on the updated XML file.

$ virsh pool-create pool.xml Pool default created from pool.xml At this point, a default pool has been changed to a new location, and is ready for use.

kvm backup

cd /home/wimm/vm/Machines/vm_pool

  1. Use multicore to compress

tar -I pigz -cf maossierra.tar.gz macOSsierra.qcow2 chown wimm macOSsierra.tar.gz cp /etc/libvirt/qemu/macOS-Simple-KVM.xml ./ chown wimm macOS-Simple-KVM.xml

  1. tar multicore

The three tools for parallel compression I will use today, all can be easy installed via apt install under Debian/Ubuntu based GNU/Linux distributions, here are the commands and corresponding apt package name:

gz: pigz bz2: pbzip2 xz: pxz Originally commands to tar with compression will be look like:

gz: tar -czf tarball.tgz files bz2: tar -cjf tarball.tbz files xz: tar -cJf tarball.txz files The multi-thread version:

gz: tar -I pigz -cf tarball.tgz files bz2: tar -I pbzip2 -cf tarball.tbz files xz: tar -I pxz -cf tarball.txz files I am going to use Linux kernel v3.18.6 as compression example, threw the whole directory on the ramdisk to compress them, and then compare the difference! (PS: CPU is Intel(R) Xeon(R) CPU E3-1220 V2 @ 3.10GHz, 4 cores, 4 threads, 16GB ram) https://www.peterdavehello.org/2015/02/use-multi-threads-to-compress-files-when-taring-something/