179 shaares
1 result
tagged
qemu
install
https://computingforgeeks.com/install-kvm-qemu-virt-manager-arch-manjar/
sudo pacman -S qemu virt-manager virt-viewer libguestfs # dnsmasq vde2 bridge-utils openbsd-netcat
# see virt-sandbox
sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service
systemctl status libvirtd.service
conf
file=/etc/libvirt/libvirtd.conf
sudo cp -a $file $file$(date +%s)
sudo sed -i 's|^#\?\(unix_sock_group =\).*$|\1 "libvirt"|' $file
sudo sed -i 's|^#\?\(unix_sock_rw_perms =\).*$|\1 "0770"|' $file
sudo usermod -a -G libvirt $USER
sudo systemctl restart libvirtd.service
mod=$(lsmod|awk '/^kvm_/ {print $1}')
sudo modprobe -r $mod
sudo modprobe $mod nested=1
echo "options ${mod/_/-} nested=1" | sudo tee /etc/modprobe.d/${mod/_/-}.conf
systool -m ${mod} -v | grep nested
share
host
hostpath=/vms/share
sudo mkdir $hostpath
#sudo usermod -G libvirtd -a $USER
sudo usermod -G libvirt-qemu -a $USER
hostpath=/vms/share
#sudo chown -R libvirt-qemu:libvirt-qemu $hostpath
sudo setfacl -d -Rm g:libvirt-qemu:rwx $hostpath
virt-manager
hostshare
<filesystem type="mount" accessmode="mapped" fmode="0660" dmode="0770">
<source dir="/vms/share"/>
<target dir="/hostshare"/>
<address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</filesystem>
guest
guestpath=/share
#sudo chmod -R 777 $guestpath
sudo chown -R $USER:$USER $guestpath
mount
sudo mount -t 9p -o trans=virtio,rw,version=9p2000.L /hostshare $guestpath
sudo sh -c "echo '
# qemu share
/hostshare /share 9p trans=virtio,version=9p2000.L,rw,noauto 0 0' >> /etc/fstab"
disk
shrink
# linux
sudo dd if=/dev/zero of=/zero bs=4M
sudo rm /zero
# windows
sdelete -z C
qemu-img convert -O qcow2 $file $file2
reduce
qemu-img info $file
qemu-img resize -f qcow2 --shrink $file -10G
expand
qemu-img info $file
qemu-img resize $file +2G
import / export
virsh --connect qemu:///system dumpxml $guest > $guest.xml
virsh --connect qemu:///system define $guest.xml
ova
vm=tsurugi_linux_2022.1_vmdk
mkdir tmp
tar xf ${vm}.ova -C tmp/
qemu-img convert -f vmdk tmp/${vm}.vmdk tmp/${vm}.qcow2
qemu-img convert -O qcow2 tmp/${vm}-disk001.qcow2 ${vm}.qcow2