How to add more RAM to a KVM Virtual Machine

I have  VM running Emby that I set up a while ago on an low spec machine that had been the guest computer before everyone got Chromebooks and tablets. But it only had 2GB of RAM and I gave 1GB to the VM. So I added some new RAM to bring the system up to 8GB and wanted to start off by giving the VM 4GB to see if that improved performance.

So first I had to type

virsh edit BabyLuigi

I found the part of the XML near the top that was memory unit (in kilobytes) and changed it to 4194304. Whenever I tried to change it, it would fail when I tried to save the configuration. Eventually when it complained I hit “i” instead of “y” and it worked for some reason.

So the next step was to type:

virsh setmem BabyLuigi 4194304

But that did not work because it was not running. So I ran the VM and ran the command again. Success!

# free -h
 total used free shared buff/cache available
Mem: 3.7G 218M 3.2G 8.4M 345M 3.3G
Swap: 1.0G 0B 1.0G

 

Author: Eric Mesa

To find out a little more about me, see About Me