Removing VMs, but keeping VDIs

This is for discussing general topics about how to use VirtualBox.
Post Reply
street spirit
Posts: 4
Joined: 5. Dec 2008, 15:45

Removing VMs, but keeping VDIs

Post by street spirit »

I have several VMs (different OSs) running on a Linux host. After migrating the host to a 64bit system, I found that I had to create new VMs, but was able to reuse the old VDI files. So far, everything works fine, and I'd like to delete the old (32bit) VM entries now. When I select "Remove" from the manager GUI, I am asked if I only want to remove the entries, or if I want to "delete the files containing the virtual machine" as well. Does this include the VDIs? Even if they are still used by other VMs?

What I would like to do is remove the old VMs as completely as possible, including their configuration and any snapshots, but keep the virtual disks. Is it safe to choose "Delete all files" at the Remove dialog, or should I choose "Remove only" and clean up the snapshots and other cruft manually? In the latter case, which files can I delete? The contents of my ~/.VirtualBox are:
.
|-- Machines
|   |-- Crypto1_old
|       .....
|   `-- Testerling_old
|-- VDI -> /home/virtual/VDI    (stored outside my $HOME to simplify backups)
|-- sharedfolder
|-- sharedfolder_mnt
|-- VBoxSVC.log
|-- VirtualBox-1.6-linux.xml
|-- VirtualBox.xml
|-- VirtualBox.xml-prev
|-- VirtualBox.xml.1.3-linux.bak
|-- compreg.dat
`-- xpti.dat
The subdirectories of the Machines folder all correspond to my old VMs; I guess newer versions of VirtualBox store this information somewhere else. It looks like Machines can be completely removed, as well as VirtualBox-1.6-linux.xml, VirtualBox.xml.1.3-linux.bak, and maybe VBoxSVC.log (which hasn't been touched since 2007).

Current version is "Oracle VM VirtualBox Manager 4.0.10_Ubuntu" running on Ubuntu Natty.

Thanks in advance.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Removing VMs, but keeping VDIs

Post by mpack »

It rather depends on whether you copied the old VDI to a new folder, or not. If you did then the old files can be safely deleted, if not then you have to answer no and delete them individually using the host OS's file browser. I should however mention: the fact that you have messed with the files and/or shared the disk of a VM which uses snapshots... does not inspire confidence! However, I hope you have verified by now that your working VM is fully working and not missing any data.

An alternative strategy is to clone your working VM using the cloning feature introduced by VirtualBox v4.1.x. The clone (it must not be a linked clone) will definitely will not reference your original VDI files and snapshots, and the latter can safely be deleted after you make sure that the clone works!
street spirit
Posts: 4
Joined: 5. Dec 2008, 15:45

Re: Removing VMs, but keeping VDIs

Post by street spirit »

Thanks, I will delete the files manually, then. The VDIs are only shared between the new and old versions of the VMs, I should have mentioned that. Copying them would be the safe thing to do, but I don't have enough free disk space for that. Hence the need to "clean up".
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Removing VMs, but keeping VDIs

Post by mpack »

Just be careful: sharing a disk image which uses snapshots is fraught with problems, i.e. all the control information will be in the original .vbox/xml file. I wouldn't like to take on the task of manually moving a whole snapshot tree that stuff to a new VM, and if you took the obvious way and only referenced the base VDI then you should have lost a lot of data. If I was you I would clone the original VM, taking the option to ditch the snapshots in the clone.
Post Reply