Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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.

enter image description here

2. Add a new attachment: "Add Hard Disk".

enter image description here enter image description here

3. "Create new disk"

enter image description here

4. VirtualBox will use the new disk.

enter image description here

share|improve this answer
    
Thanks @Deltik (+1) - I presume I accomplish this in Settings >> Storage? I see an "Attributes" section with a CD icon that allows me to choose an ISO? Do I just choose the same ISO as before (would doing so cause VBox to overwrite my old VM with the new ISO)? –  pnongrata Jul 29 '12 at 20:42
    
@zharvey You replace the .vdi file with a new one. (Sorry for the late clarification, but I'm on a different computer right now, so I just downloaded VirtualBox to get screenshots.) –  Deltik Jul 29 '12 at 20:45
    
Thanks again - I removed my existing attachment and added a new one (pointing to my Ubuntu ISO). I restarted the VM and got the following error: FATAL: Could not read from the boot medium. System halted. Where am I going wrong here? Thanks again! –  pnongrata Jul 29 '12 at 20:54
    
Create a new hard disk. Don't point it to the ISO file. Then start up the virtual machine. You'll still get the fatal error, but go to Devices >> CD/DVD Devices >> Choose a virtual CD/DVD disk file..., choose your ISO file, then reset the virtual machine. (Screenshot) –  Deltik Jul 29 '12 at 21:08
add comment

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!

snapshot


See Also:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.