Restoring a VirtualBox VM to a clean/default state?
Olivia Zamora
I am playing around with Virtual Box and installed an Ubuntu 12.04 ISO on a my first VM. Now I want to "wipe" that VM clean and undo all the software I had installed on it. My co-worker said the easiest thing to do is to just re-install Ubuntu and overwrite everything.
What's the easiest way to do this with VBox? Should I just delete the whole VM and recreate it from scratch? It would be nice if I can just tell VBox "hey, take this VM, erase everything on it, and then replace it with this ISO" instead of having to delete the entire VM and create a new one. Is this possible? If so, how? If not, what's my best remedy here? Thanks in advance!
2 Answers
You seem to want to preserve the configurations for the virtual machine.
The easy way to accomplish this is obvious: detach the virtual disk image and replace it with a new one.
The configurations for the virtual machine remain in tact, but the stored data is gone.
1. In Settings >> Storage, remove the current virtual disk image.
2. Add a new attachment: "Add Hard Disk".
3. "Create new disk"
4. VirtualBox will use the new disk.
For future reference, after you've installed the virtual machine and have everything running, create a snapshot. This will allow you to revert back to this squeaky, clean state whenever you want!
See Also: