Vagrant 在哪里保存对 VM 的更改? [英] Where is Vagrant saving changes to the VM?

查看:22
本文介绍了Vagrant 在哪里保存对 VM 的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用 Vagrant,在理解一些细节方面有点困难.我已经通读了文档,但仍然缺少一个基本概念.当我想启动一个 Vagrant box 时,我运行:

I am just starting with Vagrant and I am having a little trouble understanding a few details. I have read through the docs but still am missing a basic concept. When I want to start a Vagrant box I run:

流浪

这将基于盒子构建虚拟机"我知道盒子存储在 ~/.vagrant.d 并且实际上我已经从基本的 Ubuntu 盒子打包了我自己的盒子.但是,当我运行 vagrant up 并开始向 vm 添加文件时,vm 的虚拟硬盘存储在哪里?比如我运行apt-get install apache2,修改了root系统,这个修改在哪里?

This will "build the VM based on the box" I understand that the boxes are stored at ~/.vagrant.d and in fact I have packaged up my own box from a base Ubuntu box. However, when I run vagrant up and start to add files to the vm, where is the virtual hard drive for the vm stored? For example, when I run apt-get install apache2 and the root system is modified, where is this modified?

当我对当前目录执行 du 操作时,我看不到任何更改.我也没有看到 ~/.vagrant.d 目录中有任何变化.但是,我可以暂停 vagrant,重新启动我的本地机器,然后再次运行 vagrant up 并将更改保留在某处.

When I do a du on my current directory I do not see any changes. I also do not see any changes in the ~/.vagrant.d directory. However, I can do vagrant halt, restart my local machine and then run vagrant up again and the changes are persisted somewhere.

vagrant up 也报告

vagrant up also reports

[default] VM already created. Booting if its not already running...

有人能告诉我 VM 是在哪里创建的,以及在哪里进行了更改吗?

Can someone tell me where the VM is created and where the changes are made?

推荐答案

Vagrant 导入位于 ~/.vagrant.d/boxes/ 的 base box,就像你说的.这是保存底盒的地方.它使用它从干净状态启动 VM.导入 VM 时,存储数据文件和 VM 状态的位置由 VirtualBox 本身负责.这是一个可配置的位置,但对于 Mac OS X 和 Linux,通常默认为 ~/VirtualBox\ VMS.在 Windows 中,框保存在 %userprofile%\.vagrant.d\boxes

Vagrant imports the base box which is located at ~/.vagrant.d/boxes/, like you said. This is where the base boxes are kept. It uses it to start a VM from the clean state. When importing a VM, the responsibility of where to store data files and VM state is up to VirtualBox itself. This is a configurable location but typically defaults to ~/VirtualBox\ VMS for Mac OS X and Linux. In Windows the boxes are kept in %userprofile%\.vagrant.d\boxes

无论您碰巧使用什么平台,都可以轻松找到创建它们的位置.

It is easy to find the place where they are getting created, regardless of what platform you happen to be using.

1. Start VirtualBox. 
2. Go to the VM that shows as running instance. 
3. Check out the Settings ->Storage. 
4. You can find the path to location where VMs are created and stored in your file system.

这篇关于Vagrant 在哪里保存对 VM 的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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