Search code examples
laravelvagrantvirtualbox

Virtual Box- Accidentally deleted vmdk file. What can I do?


Hope someone can help me here. Really need to get back to work.

This morning my 120gb macbook air was filling up and I was prompted to remove some files. I had been playing around with Kali this week on another vm so decided to remove that to continue working on my Laravel apps. Unfortunately in a morning haze I deleted the wrong file :D

I am using virtual box + vagrant to run a Laravel development environment with Homestead laravel [.] com/docs/5.4/homestead

Thankfully all my files are saved locally and mirrored on the vm so everything should be okay right?

When I try to 'vagrant up' and power on the vm I get error VERR_FILE_NOT_FOUND opening image file '/Users/user/VirtualBox VMs/homestead-7/box-disk1.vmdk' (VERR_FILE_NOT_FOUND) - the one I stupidly deleted. Lesson learned.

Inside the Virtual Box GUI -> homestead-7 (name of the machine) -> settings -> storage -> Controller SATA controller. Should I remove the reference to the deleted file and create a new one? Or should I delete this vm entirely and make a new one?

Can anyone tell me what to do? Would really appreciate some help here.

Thanks so much


Solution

  • Your data in vagrant not deleted, but database files deleted (ex. MySQL), You have to reinstall vagrant by delete machine from virtualbox How to delete machine

    Then open Terminal

    mv ~/Homestead/Homestead.yaml ~/Homestead.yaml
    rm -rf ~/Homestead
    cd ~
    cd Homestead
    git checkout v5.4.0
    mv ~/Homestead.yaml ~/Homestead/Homestead.yaml
    vagrant up
    

    Hope that will work with you