linux:apps:kvm
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:apps:kvm [2025/09/16 20:36] – oscar | linux:apps:kvm [2025/10/21 20:15] (current) – oscar | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== KVM ====== | ====== KVM ====== | ||
| - | S2YLNY0HA01587 | + | |
| + | ---- | ||
| ===== Installation ===== | ===== Installation ===== | ||
| Install all the required for the installation of Qemu, KVM hypervisor, and Libvirt | Install all the required for the installation of Qemu, KVM hypervisor, and Libvirt | ||
| Line 40: | Line 42: | ||
| Output: | Output: | ||
| enabled | enabled | ||
| - | </ | + | </ |
| If disabled run the following command to have it boot automatically: | If disabled run the following command to have it boot automatically: | ||
| # systemctl enable --now libvirtd | # systemctl enable --now libvirtd | ||
| Line 55: | Line 57: | ||
| In order to manage virtual machines as a regular user, that user needs to be added to the libvirt group: | In order to manage virtual machines as a regular user, that user needs to be added to the libvirt group: | ||
| - | # usermod -aG libvirt, | + | |
| + | | ||
| + | | ||
| === User-specific and system-wide VMs === | === User-specific and system-wide VMs === | ||
| - | By default, if virsh is run as a normal user it will connect to libvirt using qemu:/// | + | By default, if virsh is run as a normal user it will connect to libvirt using: **qemu:%%///%%session** URI string. This URI allows virsh to manage only the set of VMs belonging to this particular user. |
| + | |||
| + | To manage the system set of VMs (i.e., VMs belonging to root) virsh should be run as root or with: **qemu:%%///%%system** URI: | ||
| $ virsh --connect qemu:/// | $ virsh --connect qemu:/// | ||
| Line 67: | Line 73: | ||
| ===== Libvirt default network ===== | ===== Libvirt default network ===== | ||
| - | If you use libvirt to manage your VMs, libvirt provides a NATed bridged network named " | + | If you use libvirt to manage your VMs, libvirt provides a NATed bridged network named " |
| + | < | ||
| + | 3: virbr0: < | ||
| + | link/ether 52: | ||
| + | inet 192.168.122.1/ | ||
| + | | ||
| + | </ | ||
| + | This network is available only for the system domains (that is VMs created by root or using the " | ||
| virsh --connect=qemu:/// | virsh --connect=qemu:/// | ||
| Line 104: | Line 117: | ||
| ===== Shrink KVM qcow2 image ===== | ===== Shrink KVM qcow2 image ===== | ||
| qemu-img convert -O qcow2 source.qcow2 shrunk.qcow2 | qemu-img convert -O qcow2 source.qcow2 shrunk.qcow2 | ||
| - | ===== Links ===== | + | ===== Make SATA disk available in Windows Client |
| + | To make a SATA disk partition available in a Windows VM add the disk to the domain’s xml config file by hand. First find the id of the partition that you want to add. Rather than using /dev/sda you should use / | ||
| + | ls -l / | ||
| + | |||
| + | Now edit the /// | ||
| + | < | ||
| + | # nano / | ||
| + | |||
| + | or | ||
| + | |||
| + | virsh edit ${YOUR_VM} | ||
| + | ---------------------------------------------- | ||
| + | <disk type=' | ||
| + | <driver name=' | ||
| + | <source dev='/ | ||
| + | <target dev=' | ||
| + | </ | ||
| + | </ | ||
| + | This will make the host’s partition available in the guest as /dev/vdb (D:). After changing a domain’s config by hand, you have to reload the config by hand. Log in to your host and issue this command: | ||
| + | |||
| + | # virsh define / | ||
| + | | ||
| + | Domain YOUR_VM defined from / | ||
| + | | ||
| + | ===== Links ===== | ||
| * [[https:// | * [[https:// | ||
linux/apps/kvm.1758054970.txt.gz · Last modified: by oscar
