My disk storage is /vz/disk/.Īfter that, you can add a virtual disk device to the VM itself: # qemu-img create -f qcow2 -o size=20G /vz/disk/test.imgInstead of qcow2, you can specify the desired disk format, you also need to specify the path to the file. But we did not describe the option of adding an additional disk. In one of our articles, we described the process of expanding and shrinking virtual machine disks in KVM. In this case, stop the virtual machine and then just start it. # vi /root/test.xmlChange the settings you need, save the file and apply to the virtual machine:ĭomain test-centos defined from /root/test.xmlĭomain test-centos startedSometimes when changing the VM configuration file online, the assigned resources are reset after a reboot. The same can be done by making a backup of the XML file: # virsh edit In the vi editor that opens, make changes by clicking the “Insert” button.įor example, let's set the VM to have 2 cores and 1GB of memory: You can modify the file online or make a backup of the VM XML file, modify it and apply it to the virtual machine. You can also change the resources of a KVM VM through its XML configuration file. Now you can increase the memory of the VM.īefore all changes, do not forget to stop the VM, and then start it. “error: invalid argument: cannot set memory higher than max memory.”Increase the maximum memory value: # virsh setmem test-centos 4G -configAll for the same reason, immediately got an error: Let's check the number of processors in the VM settings: the number of processors shown:Ħ Let's add memory to the virtual machine in the same way: Repeat the first command and start the virtual machine: # virsh setvcpus test-centos 6 -config -maximum To increase the maximum number of VM cores, run the command: We cannot set the number of processor cores to be more than the maximum number. “error: invalid argument: requested vcpus is greater than max allowable vcpus for the persistent domain: 6 > 4” # virsh setvcpus test-centos 6 -configBut when using this command, I immediately got an error: Through the configuration XML file of the VMIf the virtual machine is running, it must be stopped:ĭomain test-centos is being shutdownNow with the help of virsh we will change the number of virtual processors to 6 (vCPU): In the KVM console, you can add or decrease the CPU and memory allocated to the VM in two ways: # virsh dumpxml - output the configuration file of the specified virtual machine in XML formatĪdding memory and vCPU to the KVM virtual machine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |