25

I have installed Windows XP in my VirtualBox some days ago. Now, I want to remove Windows XP completely from VirtualBox and I decided to install Ubuntu 13.04 for testing.

What is the correct way to remove completely Windows XP from VirtualBox?

0

2 Answers 2

49

It makes no sense to keep a particular Virtual Machine and change the OS inside - so remove the VM and create a new one:

Virtual Box Manager

In the graphical frontend for Virtual Box we can easily remove a virtual machine by selecting the machine to remove and go to the menu entry "Machine --> Remove" or choose "Remove" from the right-click context menu.

enter image description here

We will then be asked whether we wish to only remove the machine (i.e. unregister it) or if we want to also "Delete all files". The latter will completely remove the virtual machine with all files from our drive.

enter image description here


Command line

This can also be done from command line with the following command:

VBoxManage unregistervm --delete "<Name of Machine>"

By doing so the following files will be deleted:

  • all hard disk image files, including differencing files, which are used by the machine and not shared with other machines;
  • saved state files that the machine created, if any (one if the machine was in "saved" state and one for each online snapshot);
  • the machine XML file and its backups;
  • the machine log files, if any;
  • the machine directory, if it is empty after having deleted all the above.

Source: Virtual Box Manual

2

If the issue still persists, you can also kill the VBoxHeadless & VirtualBoxVM processes associated with the VM.

E.g. Assume the name of your locked / bad vm is My-Locked-VM.

Get the process id of the VirtualBox processes associated with that VM and kill it.

MyHostName:homedir ayekay$ ps -ef| grep -i My-Locked-VM
1624398723  1196 23121   0 11:34AM ??         0:05.11 /Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/VirtualBoxVM --comment My-Locked-VM --startvm 8dc249f1-6877-4caf-bbd4-27ae6b78ceb6 --no-startvm-errormsgbox --separate
1624398723 89252 23121   0 10:06AM ??         3:07.87 /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless --comment My-Locked-VM --startvm 8dc249f1-6877-4caf-bbd4-27ae6b78ceb6 --vrde config
1624398723  2323 79114   0 11:48AM ttys007    0:00.00 grep -i My-Locked-VM
MyHostName:homedir ayekay$ kill -9 1196 89252
MyHostName:homedir ayekay$

Once the process is killed, the VirtualBox UI will show the VM state as Aborted. You can then use the UI to delete the VM.

1
  • You could be a bit more elaborate about how to do that, this would greatly improve the quality of your answer.
    – Videonauth
    Jun 3, 2016 at 1:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .