Apr 29
2021
To do so, log in to your guest machine via SSH or Virt-manager or Cockpit and run the following commands to enable and start a serial console:
systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service
connect to console from Host
virsh console
Feb 5
2021
virsh vcpucount <vm_name>
virsh setvcpus <vm_name> <max-number-of-CPUs> –maximum –config
virsh setvcpus <vm_name> <number-of-CPUs> –config
virsh setvcpus <vm_name> <number-of-CPUs> –live
Jan 24
2021
virsh net-list --all
Name State Autostart Persistent
----------------------------------------------------
default inactive yes yes
inner-network active yes yes
outer-network active yes yes
virsh attach-interface --domain debian11 --type bridge --source inner --mac 52:54:00:29:5c:2e --model virtio --config --live
Jan 22
2021
Create new bridge
sudo ip link add <bridge-name> type bridge
Add interface to bridge
sudo ip link set <ethX> up
sudo ip link set <ethX> master <bridge-name>
Add IP address to bridge and bring it up
sudo ip address add dev <bridge-name> 192.168.0.90/24
sudo ip link set dev <bridge-name> up
Create file bridged-network.xml
<network>
<name>bridged-network</name>
<forward mode="bridge" />
<bridge name="<bridge-name>" />
</network>
Add bridged-network to our KVM
sudo virsh net-define bridged-network.xml
Activate network and set autostart
sudo virsh net-start bridged-network
sudo virsh net-autostart bridged-network
Verify
virsh net-list --all
Jan 8
2021
STOP VM !
Add +5G do disk
qemu-img resize chr-7.2.img +5G
Change disk size to 20G
qemu-img resize chr-7.2.img 20G
This example will convert a raw image file named image.img to a qcow2 image file.
qemu-img convert -f raw -O qcow2 image.img image.qcow2
Rescan resized partition
partprobe /dev/vdb
or
growpart /dev/vdb 1
Resize partition
resize2fs /dev/vdb1
Useful commands
virsh destroy vm_name
virsh list
virsh edit vm_name
Set CPU resources
virsh vcpucount <vm_name>
virsh setvcpus <vm_name> <max-number-of-CPUs> --maximum --config
virsh setvcpus <vm_name> <number-of-CPUs> --config
virsh setvcpus <vm_name> <number-of-CPUs> --live