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
tools:kvm [2024/05/21 18:36] – [VM] darrontools:kvm [2025/03/19 16:16] (current) darron
Line 12: Line 12:
 </code> </code>
  
 +===qemu===
  
 +To allow a user to create a virtual network permissions must be altered for a qemu script.
 +
 +If it doesn't exist, create a script `/etc/rc.local'.
 +
 +<code>
 +#! /bin/bash
 +chmod u+s /usr/lib/qemu/qemu-bridge-helper
 +exit 0
 +</code>
 +
 +Make the script executable and run it.
 +
 +<code>
 +chmod +x /etc/rc.local && /etc/rc.local
 +</code>
 +
 +To make this script run at every boot with systemd add the following to
 +`/etc/systemd/system/rc-local.service'
 +
 +<code>
 +[Service]
 +Type=oneshot
 +RemainAfterExit=yes
 +ExecStart=/etc/rc.local
 +
 +[Install]
 +WantedBy=multi-user.target
 +</code>
 +
 +Enable the service with
 +
 +<code>
 +systemctl enable rc-local.service
 +</code>
 ===User=== ===User===
  
Line 158: Line 193:
 virsh undefine debian12 virsh undefine debian12
 </code> </code>
 +
 +==Export==
 +
 +<code>
 +virsh dumpxml debian12 > debian12.xml
 +</code>
 +
 +==Import==
 +
 +<code>
 +virsh define debian12.xml
 +</code>
 +
 +===Disk===
 +
 +==Tools==
 +
 +<code>
 +apt install guestfs-tools
 +</code>
 +
 +==Info ==
 +
 +<code>
 +qemu-img info vm1.qcow2
 +image: vm1.qcow2
 +file format: qcow2
 +virtual size: 20 GiB (21474836480 bytes)
 +disk size: 3.42 GiB
 +cluster_size: 65536
 +Format specific information:
 +    compat: 1.1
 +    compression type: zlib
 +    lazy refcounts: true
 +    refcount bits: 16
 +    corrupt: false
 +    extended l2: false
 +</code>
 +
 +==Compact==
 +
 +<code>
 +virt-sparsify --in-place vm1.qcow2
 + 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ --:--
 +[   6.4] Trimming /dev/sda1
 +[   6.8] Clearing Linux swap on /dev/sda5
 +[   7.1] Sparsify in-place operation completed with no errors
 +</code>
 +
 +==Resize==
 +
 +<code>
 +qemu-img resize vm1.qcow2 40G
 +</code>
 +
 +<code>
 +qemu-img info vm1.qcow2
 +image: vm1.qcow2
 +file format: qcow2
 +virtual size: 40 GiB (42949672960 bytes)
 +disk size: 2.49 GiB
 +cluster_size: 65536
 +Format specific information:
 +    compat: 1.1
 +    compression type: zlib
 +    lazy refcounts: true
 +    refcount bits: 16
 +    corrupt: false
 +    extended l2: false
 +</code>
 +
 +
 +__VM__
 +
 +<code>
 +sudo apt-get install gparted
 +</code>
 +
 +Run gparted to re-arrange and resize the partitions as appropriate
 +
 ===Resources=== ===Resources===
  
Line 164: Line 279:
 [[https://www.golinuxcloud.com/virt-install-examples-kvm-virt-commands-linux/|virt-install examples]] [[https://www.golinuxcloud.com/virt-install-examples-kvm-virt-commands-linux/|virt-install examples]]
  
 +[[https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/|DVD ISO Debian Current]]
 +
 +[[https://cloud.debian.org/cdimage/archive/11.10.0/amd64/iso-dvd/|DVD ISO Debian Bullseye 11.10]]
 +
 +[[https://cloud.debian.org/cdimage/archive/10.13.0/amd64/iso-dvd/|DVD ISO Debian Buster 10.13]]