问题描述
我不知道为什么,但是在无所事事地停止然后继续运行之后,我在VM中的所有文件都丢失了.只有一个空的数据文件.当我通过SSH进行输入时,腻子告诉我密钥已更改.我已经保存了一个package.box,它可能有助于还原我的VM.
I don't know why but after doing vagrant halt then up, all my file in the VM are lost. There is only an empty data file. And when I SSH into it , putty tell me that the key has changed. I have saved a package.box that maybe can help to restore my VM.
我真的不知道该怎么办.
I really don't know what to do.
非常感谢
推荐答案
在某些情况下,流浪汉似乎会在已有虚拟机的情况下重新创建它.如果需要将现有的VM重新关联到当前的无业游民项目目录,则可以运行以下步骤:
In some occasions, vagrant seems to recreate a new VM while there is existing ones. If you need to re-associate an existing VM to your current vagrant project directory, you can run the following steps:
-
找出在VirtualBox中注册的VM:
VBoxManage list vms
fhenri@machine:~$ VBoxManage list vms
"<inaccessible>" {cf5c9fe6-be04-40f8-aeec-415bb0b74e37}
"<inaccessible>" {08732b8b-e80e-4707-9f4c-842bdcdb2442}
"<inaccessible>" {ced87630-c5d9-4396-9fc1-7a9277ec2f4a}
"<inaccessible>" {b9fc4466-2382-4629-9fcf-f414ab5093fd}
"<inaccessible>" {4442b12f-2b52-4edd-aa94-e87e2f4e54cd}
"default" {650472d0-3bb7-4a64-9035-8a6c6e012eb3}
"<inaccessible>" {17140ebf-94f3-4434-8576-e8c19cce05f4}
"<inaccessible>" {4bbf157f-00d4-4ee6-8aa1-fc3b170ad1a9}
"java_default_1460033990347_57680" {ff197c01-2f63-4e46-b8b6-98757a6f5084}
"debian_default_1461336132946_97987" {57559b51-0446-4b62-98c6-100bd09700a0}
"puppet-java_app_1463209753687_62581" {47779f5f-a5c2-4cda-9e6e-636173fc3dd2}
"testboxpuppet_default_1463642283236_68875" {ab8e9fcf-2803-4301-8a75-59c6a7a3f283}
"ud381_default_1463643058938_27416" {06d4940b-067f-4bac-b4e7-a5409340da95}
"api.notification.guru-core-01" {311aef0a-8a34-48da-a2fb-fceef89a635a}
"scotchio_default_1464423206546_32780" {c94b7982-5bef-4d78-9601-913606e117c6}
"ubuntu_default_1464510147764_37768" {c8e7ffba-eac6-47a4-b293-699ac4feca2f}
"php7_default_1464762585884_30680" {c2c73091-133b-4987-a644-90601abd1465}
您将获得当前在虚拟框中注册的所有虚拟机及其关联的UUID的列表
You will get a list of all the VMs currently registered in virtual box with their associated UUID
- 更新您现有的
id
文件:
文件将位于以下文件夹<project>/.vagrant/machines/default/virtualbox/id
中.只需复制您在第1步中找到的值
The file will be located in the following folder <project>/.vagrant/machines/default/virtualbox/id
. Just copy the value you have found from step1
在我的示例中,如果要关联虚拟机java_default_1460033990347_57680
,我将复制值ff197c01-2f63-4e46-b8b6-98757a6f5084
From my example, if I wanted to associated VM java_default_1460033990347_57680
I will copy the value ff197c01-2f63-4e46-b8b6-98757a6f5084
- 就是这样!只需运行
vagrant up
,vagrant就会运行正确的VM.
- Thats it ! just run
vagrant up
and vagrant will operate the correct VM.
这篇关于如何还原无业游民的VM(所有文件均已删除)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!