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
home_server:home_server_setup:kvm [2023-07-29 Sat wk30 14:55] – [KVM Backup] baumkphome_server:home_server_setup:kvm [2024-02-18 Sun wk07 18:09] (current) – [Change the Disk Allocated Size] baumkp
Line 49: Line 49:
  
 ====Windows10 on KVM==== ====Windows10 on KVM====
 +I have not used Windows on a VM now since circa 2021.  Just no need.  I do have a dual boot on my main desk top that I default to Debian testing and can boot to Windows 11 when I need to use Windows based software.  My sons all still use Windows exclusively on their computers and game consoles..... So I still have a family MSOffice 365 subscription.  This give access to MSoffice and 1TB of MS Cloud each.
 I had poor performance on Windows 7, 8/8.1, and 10 running on KVM a few years back.  A large frustration was that I could not seem to get more than 2 CPUs functioning on the Windows VM even though I assigned 4.  Performance was very poor, with CPU usage usually saturated with any use and relatively high even when idle.  I found out early that Windows has limitations on the number of CPUs that could be used; 1 on Home, 2 on professional and 4 on Workstation and more on Server versions, at least that was my understanding.  As I did not have a great need for the Windows VM I did not try too hard and basically did not use.   I had poor performance on Windows 7, 8/8.1, and 10 running on KVM a few years back.  A large frustration was that I could not seem to get more than 2 CPUs functioning on the Windows VM even though I assigned 4.  Performance was very poor, with CPU usage usually saturated with any use and relatively high even when idle.  I found out early that Windows has limitations on the number of CPUs that could be used; 1 on Home, 2 on professional and 4 on Workstation and more on Server versions, at least that was my understanding.  As I did not have a great need for the Windows VM I did not try too hard and basically did not use.  
  
Line 73: Line 74:
  
 ====KVM Offline Backup==== ====KVM Offline Backup====
-Note this only works on VMs that are shut down.+<fc #ff0000>Note this only works on VMs that are shut down</fc>
   -''sudo virsh list --all'' to list all KVM virtual machines.   -''sudo virsh list --all'' to list all KVM virtual machines.
-  -''sudo virsh dumpxml VM_name | grep -i "source file"'' to list the VM source file location noted in the VM XML file.+  -''%%sudo virsh dumpxml VM_name | grep -i "source file"%%'' to list the VM source file location noted in the VM XML file.
   -''sudo virsh dumpxml vm-name > /path/to/xm_file.xml'' to archive/backup the VM XML definition file.   -''sudo virsh dumpxml vm-name > /path/to/xm_file.xml'' to archive/backup the VM XML definition file.
-  -''sudo mv /working/path/VM_image.qcow2 /path/to/'' to archive/move the VM file. (use cp to copy / backup the VM file)+  -''sudo cp -p /working/path/VM_image.qcow2 /path/to/'' to archive/move the VM file. 
 +  -''%%sudo virsh undefine vm-name --remove-all-storage%%'' to undefine the VM and remove its storage. <color #ed1c24>(Be careful with this one!)</color> 
 +  -''sudo virsh define --file <path-to-xml-file>'' to import (definea VM from an XML file. 
 + 
 + 
 +References: 
 +  *[[https://ostechnix.com/export-import-kvm-virtual-machines-linux/|How To Export And Import KVM Virtual Machines In Linux]]
 ====kvm back-up links==== ====kvm back-up links====
   *[[https://schh.medium.com/backup-and-restore-kvm-vms-21c049e707c1|Backup and Restore KVM Vms]]   *[[https://schh.medium.com/backup-and-restore-kvm-vms-21c049e707c1|Backup and Restore KVM Vms]]
Line 121: Line 128:
     *Next increase the allowed size of the vm disk: ''sudo qemu-img resize /path_vm/vm_name.img +20G''     *Next increase the allowed size of the vm disk: ''sudo qemu-img resize /path_vm/vm_name.img +20G''
     *We need to make a backup of the VM disk: ''sudo cp /path_vm/vm_name.img /path_vm/vm_name_backup.img''     *We need to make a backup of the VM disk: ''sudo cp /path_vm/vm_name.img /path_vm/vm_name_backup.img''
 +    *We can check the file system on the VM: ''%%virt-filesystems --long -h --all -a /path_vm/vm_name.img%%'', <fc #ff0000>//**we can also use this to confirm the correct partition to expand**//</fc>.
 +    *We the backup VM disk to create a new expanded drive: ''%%sudo virt-resize --expand /dev/sda1 /path_vm/vm_name_backup.img /path_vm/vm_name.img%%''
 +
 +The ''virt-filesystems'' command may not be installed by default and can be installed with the following ''sudo apt install guestfs-tools''  
  
 [[https://computingforgeeks.com/how-to-extend-increase-kvm-virtual-machine-disk-size/|How To extend/increase KVM Virtual Machine (VM) disk size]] [[https://computingforgeeks.com/how-to-extend-increase-kvm-virtual-machine-disk-size/|How To extend/increase KVM Virtual Machine (VM) disk size]]