在 Vagrant 中,停止和暂停哪个更好? [英] In Vagrant which is better out of halt and suspend?

查看:38
本文介绍了在 Vagrant 中,停止和暂停哪个更好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我要关闭我的主机时,我应该:

When I'm about to shutdown my host machine off should I:

vagrant halt 

vagrant suspend

有什么区别?

推荐答案

tl;dr

当你想关闭你的机器时使用vagranthalt,当你想休眠你的机器时使用vagrant suspend.

tl;dr

Use vagrant halt when you want to power off your machine, use vagrant suspend when you want to hibernate your machine.

来自 Vagrant 文档:

From the Vagrant docs:

vagrant 暂停

挂起有效地保存了确切的时间点状态机器,这样当你稍后恢复它时,它就会开始运行立即开始,而不是完全启动.

A suspend effectively saves the exact point-in-time state of the machine, so that when you resume it later, it begins running immediately from that point, rather than doing a full boot.

这通常需要额外的磁盘空间来存储所有内容来宾机器中的 RAM,但机器不再消耗主机的 RAM 或 CPU 在挂起时循环.

This generally requires extra disk space to store all the contents of the RAM within your guest machine, but the machine no longer consumes the RAM of your host machine or CPU cycles while it is suspended.

流浪汉停止

这个命令会关闭 Vagrant 正在管理的正在运行的机器.

This command shuts down the running machine Vagrant is managing.

您想使用哪个?

这基本上取决于您 - 您是否在 VM 上正在进行工作(可能通过 GUI 打开多个应用程序等)您更愿意暂停 VM,因此当您启动机器时,一切都在那里(Vagrant/VirtualBox 需要将实例的状态存储在您的硬盘驱动器上,从而消耗主机的一些硬盘驱动器空间).如果你想从一个干净的开始,因为你的所有进程都是从 init 设置的,那么去 vagrant halt

示例:

  • 如果您在 VM 上工作不多,这意味着您的所有项目文件都存储在您的主机上并与您的 VM 共享以查看它们如何使用LAMP 服务器,然后你可以安全地使用 vagrant halt

如果启动实例时需要手动启动特定进程,或者直接在VM中处理文件;那么最好暂停它,以便当您重新打开它时,它会保存您的会话并以暂停之前的相同状态检索实例.

If when you start your instance, you need to manually start specific processes, or you work on files directly in the VM; then it's better to suspend it so that when you turn it back on, it'll save your session and retrieve the instance in the same state it was in before you suspended it.

这篇关于在 Vagrant 中,停止和暂停哪个更好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆