Is there any shortcut way where I can bring my virtual machine back to the new original state. I don’t want to create a new virtual machine, instead I want to revert my machine back to factory defaults. Basically I want to do this for my Ubuntu VM.

  • 3
    This question appears to be off-topic because it is about managing virtual machines not software QA and testing
    – Kate Paulk
    Dec 10 '14 at 12:23
  • Is this so that you can guarantee that your testing environment is always pristine?
    – corsiKa
    Dec 10 '14 at 16:23

I'd recommend you take a look at Vagrant - https://docs.vagrantup.com/v2/. Tearing down a VM is as simple as running 'vagrant destroy' from the command line. When you're ready to bring it back up, you can re-provision with 'vagrant up'

  • +1 How could I forget about Vagrant, much better idea then snapshots for having a update/clean dev and test environments. Dec 11 '14 at 10:22

Most virtualization software supports snapshots.

A snapshot is the state of a system at a particular point in time.

The free/open-source Virtualbox supports snapshot creation and restoring from the command line. Also VMWare Workstation supports snapshots from the commandline with the revertToSnapshot option.

This allows you to create a batch/shell script which you could trigger/run to restore the VM to a certain point in time.

Keep in mind that a snapshotted machine will be somewhat slower since it has to keep track of all changes made to the disk.

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