使用虚拟框在外部驱动器(USB)上引导流浪框

Boot vagrant box on an external drive (usb) with virtual box

我有虚拟盒子和一个定制的流浪者盒子。问题是我自己的笔记本电脑 (Macbook) 只有大约 10 Gb 的可用空间 space。所以我买了一个 128Gb 的 U 盘。现在我需要找出一种方法来在这个 USB 记忆棒而不是笔记本电脑的默认硬盘驱动器上启动 vagrant boxes。

几乎所有 google 文章都解释了如何从 USB 启动。但这不是我真正想要的。你有没有经历过这样的情况?

如有任何帮助,我们将不胜感激!

你可以做 3 件事:

  1. 移动你的 vagrant 主目录和 U 盘上的所有盒子(如果你有很多盒子,它会节省一些 space)

您需要设置$VAGRANT_HOME环境变量

  1. 将您的 VirtualBox VM 移动到 U 盘;打开 VirtualBox 首选项面板和 select 虚拟机的新默认位置文件夹。在将所有文件移动到外部硬盘驱动器后,您需要 remove/re-add VirtualBox 中的 VM

  2. 您可以使用Linked Clones

By default new machines are created by importing the base box. For large boxes this produces a large overhead in terms of time (the import operation) and space (the new machine contains a copy of the base box's image). Using linked clones can drastically reduce this overhead.

Linked clones are based on a master VM, which is generated by importing the base box only once the first time it is required. For the linked clones only differencing disk images are created where the parent disk image belongs to the master VM.

这对现有的 vagrant VM 没有帮助,但对于您的新项目,它将有助于节省 space