gpt4 book ai didi

virtual-machine - 虚拟机需要交换分区吗?

转载 作者:行者123 更新时间:2023-12-04 02:07:18 28 4
gpt4 key购买 nike

关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。












想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。

6年前关闭。




Improve this question




我在我的物理机上运行 Ubuntu;和 VirtualBox 在上面运行各种虚拟的。

大多数时候,我在做“直接”安装;但今天我想变得“聪明”并检查了 Fedora 或 ubuntu 安装程序将在我的虚拟磁盘上创建的分区。

当然,在使用默认值时,我的虚拟磁盘的一些 GB 将用作“交换空间”。

现在我想知道:假设我有足够的物理内存(所以我可以为虚拟机分配 6 或 8 GB) - 虚拟机的专用交换空间是否有意义?

最佳答案

这是 answered at ServerFault :

TL;DR:使用交换:1. 避免内存不足错误,2. guest 操作系统更擅长内存管理

Ignoring the fact that people are dealing with OS specific reasons I have two reasons why it's a bad idea to not run with a swap partition/file.

  1. If you have 1.5 GB of RAM allocated to a VM with no space file/partition and it wants to use 1.5 GB + 1 MB it will report an out of memory error. With the swap space it will be able to swap data out of active memory and onto the disk.

  2. The guest OS does a much better job of memory management than the host. This is why technology like memory ballooning exists because the Host can make educated guesses on what memory isn't needed right now but the guest knows at a much more intelligent level (this keeps OS memory from being swapped out which could kill your performance).

关于virtual-machine - 虚拟机需要交换分区吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28340676/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com