gpt4 book ai didi

vagrant - 我应该使用 vagrant resume 还是 vagrant up?

转载 作者:行者123 更新时间:2023-12-04 01:33:30 30 4
gpt4 key购买 nike

在学习了几天之后,我很高兴能够成功设置我的 VM 并运行 Laravel 起始页。在那里很开心:)

有人可以澄清“何时”使用 Vagrant 函数。我的问题:

  • 如果我打算关闭我的电脑,你应该使用 haltsuspend ? (我猜halt)如果我忘记做这两个中的任何一个,会不会有问题?
  • 我刚打开电脑后应该立即使用 upresume ?
  • 如果我通过关闭盖子使计算机进入休眠模式,是否需要 vagrant suspend ?
  • 最佳答案

    简而言之
    1. 关机
    “关闭”方法在关闭/打开 VM 时的速度和 VM 占用的磁盘空间量方面有所不同。来自 更快/更多磁盘消耗更慢/更少的磁盘消耗 ,命令是:vagrant suspend , vagrant haltvagrant destroy .
    2. 开启
    只需使用 vagrant up . “启动”方法之间的区别在于 vagrant resume将在 vagrant up 时“唤醒”VM在此之前将进行一些配置检查。例如,它会检查你的 vagrant box 是否有更新的版本,并通过运行 vagrant box update 通知你可以更新。 .
    您也可以使用 vagrant resume仅在先前暂停的 VM 上。在时间上,在悬挂的机器上使用时,两者之间没有明显差异。
    有关更多详细信息,请参阅下面的文档引用。
    3. sleep /休眠
    将您的计算机置于 sleep 状态或什至使其休眠应该不会造成任何伤害。前者只是低功耗状态,而后者将 RAM 保存到存储驱动器,然后在您启动计算机时将其恢复。这是操作系统级别的东西,除非发生 sleep 失败或其他问题,否则它不会影响任何事情。
    引用文档
    Vagrant documentation有一个部分介绍了不同命令的作用:

    Suspending the virtual machine by calling vagrant suspend will save the current running state of the machine and stop it. When you're ready to begin working again, just run vagrant up, and it will be resumed from where you left off. The main benefit of this method is that it is super fast, usually taking only 5 to 10 seconds to stop and start your work. The downside is that the virtual machine still eats up your disk space, and requires even more disk space to store all the state of the virtual machine RAM on disk.

    Halting the virtual machine by calling vagrant halt will gracefully shut down the guest operating system and power down the guest machine. You can use vagrant up when you're ready to boot it again. The benefit of this method is that it will cleanly shut down your machine, preserving the contents of disk, and allowing it to be cleanly started again. The downside is that it'll take some extra time to start from a cold boot, and the guest machine still consumes disk space.

    Destroying the virtual machine by calling vagrant destroy will remove all traces of the guest machine from your system. It'll stop the guest machine, power it down, and remove all of the guest hard disks. Again, when you're ready to work again, just issue a vagrant up. The benefit of this is that no cruft is left on your machine. The disk space and RAM consumed by the guest machine is reclaimed and your host machine is left clean. The downside is that vagrant up to get working again will take some extra time since it has to reimport the


    还有关于 vagrant upvagrant resume :

    Command: vagrant up

    This command creates and configures guest machines according to your Vagrantfile.

    This is the single most important command in Vagrant, since it is how any Vagrant machine is created. Anyone using Vagrant must use this command on a day-to-day basis

    Command: vagrant resume

    This resumes a Vagrant managed machine that was previously suspended, perhaps with the suspend command.


    或者看看这两个命令在终端中的输出有何不同:
    $ vagrant resume
    ==> default: Resuming suspended VM...
    ==> default: Booting VM...
    ...

    $ vagrant up
    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Checking if box 'laravel/homestead' is up to date...
    ==> default: Resuming suspended VM...
    ==> default: Booting VM...
    ...
    期间 vagrant up你可以看到签到阿克顿。例如,如果您的盒子有更新版本,您将收到通知:
    $ vagrant up
    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Checking if box 'laravel/homestead' is up to date...
    ==> default: A newer version of the box 'laravel/homestead' is available! You currently
    ==> default: have version '0.3.3'. The latest is version '0.5.0'. Run
    ==> default: `vagrant box update` to update.
    ==> default: Resuming suspended VM...
    ==> default: Booting VM...

    关于vagrant - 我应该使用 vagrant resume 还是 vagrant up?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25966283/

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