Site Tools


start:virtualization

This is an old revision of the document!


So there is quite a bit to do when setting up for KVM. In the How To Setup Zramswap And Make Your PC Awesome we touch on setting up zram so that you can get more VM's but there is actually a way to get even better performance that I did not mention in that guide.

Here we will cover some additional tunables so once you have your zram setup so that you can have extra vm's running lets do a bit more so we can have even more memory available.

As like in zram the cost is more cpu cycles so on a very slow cpu that might not be desirable but if you have spare CPU there is no reason not to clear up some ram using things like zram or other kvm switches available. While zram compresses what ram is used to give more available, kvm can deduplicate what is used so that ram is only stored one time across machines.

Lets start by installing virtual machine manager for debian: (by the way if you ever need copy/paste functionality between the vm and your host just install “spice-client-gtk” and “spice-vdagent” package on the vm, then turn it off and back on).

sudo apt-get install virt-manager

There is a lot to install so sit back and wait a while then reboot the machine when done so it can complete.

Once back in the machine you can start enabling some tweaks. First thing is to allow passing through hardware to your VM's so you will want to enable that (as its useful for a variety of reasons) and also to check nested vm's are enabled (normally is).

First thing to check is if nested vm's are allowed. You can check this by:

cat /etc/modprobe.d/kvm.conf 

And you should see this line is returned: 'options kvm_intel nested=1' (for intel cpu's or 'options kvm_amd nested=1' for AMD).

On mine this was already enabled but if you are missing that file or the option first check that your system supports it by either :

cat /sys/module/kvm_intel/parameters/nested
or
cat /sys/module/kvm_amd/parameters/nested

and if the relevant command returns a 1 then you can enable the function by creating the file or editing it to include the option you need eg:

sudo nano /etc/modprobe.d/kvm.conf

and add either of these two lines depending on CPU:

options kvm_intel nested=1
or
options kvm_amd nested=1

Obviously after enabling nested vm support you will need to reboot for it to take effect.

start/virtualization.1649954274.txt.gz · Last modified: 2022/04/14 16:37 by peter