Recovering Homestead Instance

If you don’t know about homestead, its a vagrant box that automatically configures a great development environment for laravel. http://laravel.com/docs/homestead

The box should always be suspended before shutting down your machine to prevent loss of data.  This is not always possible and you may lose data. This may include data stored in database, new applications installed, custom configurations etc.

You will likely notice the loss of data when you try to run

vagrant up

on your box.

The steps detailed below are for Ubuntu 14.04, Virtualization provided by Oracle’s Virtual Box

 

Step1:

Open terminal and run

VBoxManage list vms

This will give you a list of existing instances. That look something like this

"Homestead_default_1404163399305_36682" {193c3aff-1024-429d-bfe8-6fc4f5e95e1d}
"Homestead_default_1406635335344_88720" {2dc5a526-338d-4c6d-8483-f697f50df6ee}

It is very likely one of them is the box you lost. In my case it was the second last one.

 

Take note of the id (The value in the brackets)

Step 2:

Navigate to the base of your homestead box, ie that is where you normally start your box from.

From there you need to edit the id file ie

vim {PATH_TO_HOMESTEAD}/.vagrant/machines/default/virtualbox/id

 

Step 3:

Replace the value in the id file with a value of one of the previous instances and save.

Step 4:

Restart homestead.

This steps helped me recover a lost instance.

All the best 🙂

 

 

Facebooktwittergoogle_plusredditpinterestlinkedinmail