Do I need virtual machines to swap?

I am running Ubuntu on my physical machine; and VirtualBox for launching various virtual ones from above.

In most cases, I made "straightforward" installations; but today I wanted to be smart and checked the partitions that fedora or ubuntu installers would create on my virtual disks.

And of course, when you use the default values, some GB files of my virtual disks will be used as the "swap space".

Now I'm wondering: considering that I have a lot of physical memory (so I can assign 6 or 8 GB for the virtual machine). Does it make sense in the allocated swap space for the virtual machine?

+8
virtual-machine virtualbox
source share
3 answers

This was answered by ServerFault :

TL; DR: use swap: 1. avoids a memory error, 2. the guest OS manages memory better

Ignoring the fact that people are dealing with specific OS reasons, I have two reasons why it is a bad idea not to start a partition / file with the exchange.

  • If you have 1.5 GB of RAM allocated for a virtual machine without a spatial file / partition, and it wants to use 1.5 GB + 1 MB, it will report no memory error. With the swap space, he will be able to exchange active memory data and to disk.

  • The guest OS does a much better job of managing memory than the host. This is why a technology such as a memory burst exists because the Host can give reasoned guesses about which memory is not needed right now but the guest knows at a much more intelligent level (this allows the OS memory to be replaced, which can kill your performance) .

+5
source share

Separated sections are used to free physical memory when it leaves space. In modern machines with lots of memory, this depends on the type of applications that you will run. If you plan to run memory-intensive programs like video editors, high-end games, or something like that, virtual memory or swap space is an asset. But if that is not the case, then you can avoid swap space if you have enough memory. But it’s safe to have a reserve.

+3
source share

It depends on which programs you use on your host system with the virtual machine or which programs you use on the virtual machine.

The only upper memory limit that the software can use is the shared memory (physical or virtual) available to it. There are many programs that require large amounts of memory in normal behavior, and many circumstances that make the program consume large amounts of memory (for example, downloading input files). There are also many erroneous programs that inadvertently consume large amounts of memory.

Often you can get an idea by examining the requirements or recommendations (such as memory and disk space) of the programs that you run. Otherwise, try.

+3
source share

All Articles