User Tools

Site Tools


public:managing_kvm_on_debian

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
public:managing_kvm_on_debian [2024/05/14 21:02] – [Deleting a VM] thomaspublic:managing_kvm_on_debian [2024/05/17 20:56] (current) thomas
Line 6: Line 6:
  
 <code> <code>
-sudo apt install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system virtinst qemu-utils dnsmasq swtpm swtpm-tools ovmf bridge-utils+sudo apt install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system virtinst qemu-utils dnsmasq swtpm swtpm-tools ovmf bridge-utils libvirt-daemon-driver-storage-zfs
 </code> </code>
  
Line 46: Line 46:
 </pool> </pool>
 </code> </code>
 +
 +You can also use a ZFS dataset as storage pool, with this alternative XML configuration:
 +
 +<code>
 +<pool type="zfs">
 +  <name>default</name>
 +  <source>
 +    <name>pool1/kvm</name>
 +  </source>
 +</pool>
 +</code>
 +
 +:!: Note that this does not support libvirt snapshots. You will need to make snapshots via ZFS manually, which may not be ideal.
  
 Then, create the pool based on the definition and make sure it autostarts: Then, create the pool based on the definition and make sure it autostarts:
Line 199: Line 212:
 </code> </code>
  
-If the server had NVRAM enabled, you must specify the --nvram option to delete it without errors:+If the server had NVRAM enabled, you must specify the ''nvram'' option to delete it without errors:
  
 <code> <code>
 virsh undefine windows-server-2022 --nvram virsh undefine windows-server-2022 --nvram
 </code> </code>
-===== Forcing VM to stop =====+===== Stopping guest ===== 
 + 
 +This will ask a VM to shut down:
  
 <code> <code>
-virsh destroy windows-server-2022+virsh shutdown <name> 
 +</code> 
 + 
 +This will force a VM to shut down: 
 +<code> 
 +virsh destroy <name>
 </code> </code>
 ===== Editing a VM's XML configuration ===== ===== Editing a VM's XML configuration =====
Line 215: Line 235:
 </code> </code>
  
 +===== Finding the VNC display for a guest =====
 +
 +<code>
 +virsh vncdisplay <name>
 +</code>
 +
 +or
 +
 +<code>
 +virsh domdisplay <name>
 +</code>
 +
 +This snippet will list out the displays for all guests:
 +
 +<code>
 +for dom in $(virsh list --name); do echo -n "$dom: "; virsh domdisplay $dom; done
 +</code>
 +
 +===== Managing media =====
 +
 +Listing attached media:
 +
 +<code>
 +virsh domblklist <guestname>
 +</code>
 +
 +To replace a disk or cd-rom with another:
 +
 +<code>
 +virsh change-media <guestname> /path/to/current/disk.img /path/to/new/disk.img
 +</code>
 +
 +Or to simply eject a disk:
 +
 +<code>
 +virsh change-media vm1 hdc --eject
 +</code>
 ===== Resources ===== ===== Resources =====
  
Line 221: Line 278:
   * https://libvirt.org   * https://libvirt.org
   * https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/   * https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/
 +  * https://serverfault.com/questions/334199/how-to-find-which-screen-and-thus-port-the-vnc-ui-for-a-kvm-guest-has-or-how
public/managing_kvm_on_debian.1715720533.txt.gz · Last modified: by thomas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki