The delay between creating and discarding the first snapshot is critical in VBox 2.2.0 (and 2.1.4 as well):
FAILURE: Create the first snapshot and wait 5 seconds or more. Discarding will fail for any snapshot afterwards.
OK: Create the first snapshot and discard it immediately. Discarding snapshots will then work OK for all snapshots.
This bug disables the snapshot feature completely. It prevents live backup of running VMs! Please look at this as soon as you can. Examples are enclosed in the enclosed archive of two .VirtualBox folders.
Thanks, Rudy
Host: Ubuntu server 8.04 LTS
Guest: Ubuntu JeOS 8.04 (but the problem is guest-independent)
Tool used: VBoxManage
WARNING: Backup (or move) your ~/.VirtualBox folder before testing any code below!!!! Otherwise you may corrupt your VirtualBox settings or VMs.
Failed snapshot discardation step-by-step
1. Backup (or move) your ~/.VirtualBox folder
2. Create a VM
VBoxManage createhd -filename TestVM.vdi -size 15000 -register
VBoxManage createvm -name TestVM -register
VBoxManage modifyvm TestVM -hda TestVM.vdi
3. Create a snapshot and discard it after 5 seconds
(Copy and paste ALL 3 lines)
VBoxManage snapshot TestVM take TestSnapshot; \
sleep 5; \
VBoxManage snapshot TestVM discard TestSnapshot
4. Error Message
0%...FAILED
Error: failed to discard snapshot. Error message:
Medium '/root/.VirtualBox/Machines/TestVM/Snapshots/{d4020afe-309f-47d5-854d-3649bd4288a3}.vdi'
is not accessible. Accessibility check was not yet performed
The critical 5 seconds
If in step 3 you replace "sleep 5" by "sleep 4" then the snapshot will be discarded OK.
AFTER that, the delay is NOT critical.
(I tested this on two different computers, the critical delay really seems to be 5 seconds.)
OK snapshot discardation step-by-step
1. Move your ~/.VirtualBox folder somewhere else
(Remember that you have to create the VM from scratch every time when you test this. )
2. Create a VM
VBoxManage createhd -filename TestVM.vdi -size 15000 -register
VBoxManage createvm -name TestVM -register
VBoxManage modifyvm TestVM -hda TestVM.vdi
3. Create a snapshot and discard it after 4 seconds
(Copy and paste ALL 3 lines)
VBoxManage snapshot TestVM take TestSnapshot; \
sleep 4; \
VBoxManage snapshot TestVM discard TestSnapshot
I repeat: Backup (or move) your ~/.VirtualBox folder before testing any code described here!!!! Otherwise you may corrupt your VirtualBox settings or VMs.