I have till now everytime saved and loaded machine from snapshot, but my SSD disk now is full and I can't do anything. Snapshots folder are using 70 GB and what I want to do now is delete all snapshots and everytime turn off machine and then turn on without snapshots. Is there any way to load last snapshot state into machine and delete all snapshots?
-
What is the host OS you are running VirtualBox in? – adric Aug 06 '13 at 11:43
-
Does this answer your question? [Quickest way to merge snapshots in VirtualBox?](https://superuser.com/questions/590968/quickest-way-to-merge-snapshots-in-virtualbox) – StayOnTarget Jun 03 '21 at 12:00
2 Answers
The ability to delete all snapshots has been requested on Oracle's enhancement & bug tracker, and also in Virtualbox's forums. Sadly, AFAIK, this is still not possible to do; out-of-the-box.
There is, however, a solution!
In the form of some Python and XAML source code: VirtualBox Snapshot Deletion GUI.
You will need to compile this into an .exe file to run it. Information on how to do that can be found over at Stack Overflow: Compiling an IronPython WPF project to exe.
The author of the tool believes it would also be compatible with OS X and Linux hosts.
- 1,375
- 6
- 23
- 38
-
-
@CroiOS IronPython is available for Mac too, in the form of Mono: http://ironpython.net/download/ – Danny Beckett Aug 06 '13 at 12:09
-
1@iWizard Do you still care about this after 5 years? See my answer below – Otheus Oct 10 '18 at 10:31
This answer works, but is a bit more crude than the GUI alternative (which 5 years later, still hasn't been ported to work on anything but Windows). This will work on BSD, Linux, Mac, but not Windows (without a Cygwin). ** Run at your own risk **
DEBUG=true; PROMPT=true
vbox_delete_all_snapshots() {
vboxmanage snapshot "$1" list |
tac |perl -lane 'print $1 if /UUID: ([a-z0-9-]+)/' |
xargs ${PROMPT:+-p} -n1 ${DEBUG:+echo} vboxmanage snapshot "$1" delete
if $DEBUG && [ $? = 0 ] ; then
echo "The above commands were NOT run. Unset DEBUG (and PROMPT if you feel lucky) to do so."
fi
}
read -p"Enter the name of the VM (or its ID): " vmname; vbox_delete_all_snapshots "$vmname"
Caveats
- Linux will complain if there are no snapshots. If you are using Linux/GNU, you can add
-roption toxargscommand - To actually run execute the commands, do
unset DEBUG. To run the commands without a prompt for each one, executeunset PROMPT. - This should handle a normal "tree" of snapshots, but I have only tested it on the case where each snapshot had exactly 0 or 1 children.
Sample Output
Deleting snapshot 'B5' (a02cb9e8-c5be-425d-9bcd-806d72e5a083)
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Deleting snapshot 'B4' (422b29b8-cf79-4c92-a415-a08c1d3dd5a0)
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Deleting snapshot 'B3' (c1ed469f-ffc3-4cb8-81fe-bbf6581e5858)
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Deleting snapshot 'b2' (c0fa9d90-6293-46e5-bcd7-25f2b36f95c4)
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Deleting snapshot 'B1' (894147cb-2cc0-48e3-86c7-bec156da762a)
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Deleting snapshot 'test' (44a69565-1354-4b98-a2cf-64fd7caa6c56)
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
- 111
- 2