We have a virtual server named Jira running under VirtualBox 4.0 (host is Debian Squeeze). At some point in time a VM failed to boot, so we had to boot from GRML rescue iso. Before doing that we have created a snapshot of VM. After fixing boot problems VM continued to use that snapshot as it's current state. This is the output of VBoxManage showvminfo jira:
Name: jira
Guest OS: Other/Unknown
UUID: ef5260be-46d3-45cb-8c9d-9f9e322f9110
Config file: /home/vbox/.VirtualBox/Machines/jira/jira.xml
Snapshot folder: /home/vbox/.VirtualBox/Machines/jira/Snapshots
Log folder: /home/vbox/.VirtualBox/Machines/jira/Logs
Hardware UUID: ef5260be-46d3-45cb-8c9d-9f9e322f9110
Memory size: 2048MB
Page Fusion: off
VRAM size: 8MB
HPET: off
Chipset: piix3
Firmware: BIOS
Number of CPUs: 1
Synthetic Cpu: off
CPUID overrides: None
Boot menu mode: message and menu
Boot Device (1): Floppy
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI: on
IOAPIC: on
PAE: on
Time offset: 0 ms
RTC: local time
Hardw. virt.ext: on
Hardw. virt.ext exclusive: on
Nested Paging: on
Large Pages: off
VT-x VPID: on
State: running (since 2012-05-24T12:23:48.127000000)
Monitor count: 1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Storage Controller Name (0): jira.sata
Storage Controller Type (0): IntelAhci
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0): 30
Storage Controller Port Count (0): 30
Storage Controller Bootable (0): on
Storage Controller Name (1): jira.ata
Storage Controller Type (1): PIIX4
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1): 2
Storage Controller Port Count (1): 2
Storage Controller Bootable (1): on
jira.sata (0, 0): /home/vbox/.VirtualBox/Machines/jira/Snapshots/{e8bedcaa-278b-4b06-a825-1dddc9e4fdb3}.vdi (UUID: e8bedcaa-278b-4b06-a825-1dddc9e4fdb3)
NIC 1: MAC: 080027ABB6DD, Attachment: Bridged Interface 'eth0.100', Cable connected: on, Trace: off (file: none), Type: Am79C973, Reported speed: 0 Mbps, Boot priority: 0
NIC 2: disabled
NIC 3: disabled
NIC 4: disabled
NIC 5: disabled
NIC 6: disabled
NIC 7: disabled
NIC 8: disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1: disabled
UART 2: disabled
Audio: disabled
Clipboard Mode: Bidirectional
Video mode: 720x400x0
VRDE: enabled (Address 0.0.0.0, Ports 3389, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
Video redirection: disabled
USB: disabled
USB Device Filters:
<none>
Available remote USB devices:
<none>
Currently Attached USB Devices:
<none>
Shared folders: <none>
VRDE Connection: not active
Clients so far: 0
Guest:
OS type: Other
Additions run level: 0
Configured memory balloon size: 0 MB
Snapshots:
Name: beforeGRML (UUID: 70949bb5-985a-4ae6-ba28-3d0475434cf0) *
As you can see, snapshot is named beforeGRML. Actually I suspect that this snapshot is current state, and disk image is a state before we have recovered the machine with GRML iso.
My questions:
- is it correct that beforeGRML snapshot is actually a current state?
- whatever a 'current state' is, I want to merge it with VM disk and have no snapshots - how to do that?
Please note that VM is hosted at a remote Debian server and I use VBoxManage command line interface. (I've tried reading documentation but still can't figure out what all those 'snapshot delete' and 'snapshot restore' would do.)
No beforeGRML is not the current state. It is the machine state of the point in time when you made the snapshot.
VirtualBox is really unintuitive with snapshot command naming, if you want to merge the current state you have to
delete
the snapshot.From their manual (http://www.virtualbox.org/manual/ch08.html#idp15412176):
To revert to the state of the snapshot you use the
restore
operation:Another way to get a virtual disk in the state of a specific snapshot is to clone that virtual disk with VBoxManage.
To be sure what virtual disk you clone, open for read the .vbox file or use the GUI to get the disk path (i prefer to use full paths rather than hard disk IDs).
Cloning a ...TheNameOfVirtualDisk... gives you all previous states merged onto the new one, while letting untouched all the snapshots.
Then you can test in a new machine this new disk and see if it is what you want it to be and if it works.
So, that way if something goes wrong, you lose nothing except only some time.
Not to mention, if you want to get rid of only a snapshot in the middle of the tree of snapshots... it is a PAIN, the terminology VBox uses make a lot people to get confused.
But, thinking this way you will FIX the terminology: Deleting a Snapshot does not lose anything else except that point in time (internally it merges that State into all of the childs).
Let me explain with a more complex example. You have a Top level, with two childs, one of that child has also two childs while the other has three childs. Top level is A (one node), second level is B (two nodes), third level is C (five nodes), so tree is as follows:
Imagine now you want to get rid of B1, then when you delete B1 the differencing disk need to be merged onto C1 and C2, so C1 & C2 will be childs of A1; it is not as simple as deleting a single file; this VirtualBOX call it DELETE the B1 snapshot.
Now comes the other way of wish: Want to lose the states after a point, let me saw for that tree, i want to get rid of B2 and all its childs, so there is no more B2 part on the tree (implies eliminating all levels of its childs), so it will be very fast to do, it is only to delete some files (C3, C4, C5 & B2); this is not possible to be done in VirtualBOX, what VirtualBOX call RESTORE is to get rid of C1, C2 & C3, but not B2... you need to manually edit the .VBOX file and do that work manually. If you restore A1 to get rid of B2, you will also loose B1, C1 & C2 in the process.
So be sure what you do!
Yes, VirtualBOX allows you to get rid of B2 and all its childs, but not in one step, you need two steps:
Hope now it can be a little bit clear... a lot of people on internet talk about losing all their work because they RESTORE A1, trying to REMOVE B2.
If terms had been REMOVE and DESTROY it would not caused so much confusion.
REMOVE a node is to get rid of that node without touching the rest (if it has childs merge the state on all of them, if not just delete the state). DESTROY a node is to get rid of a node and all its childs (just delete the state and all child states).
I do not understand why VBox talks about RESTORE when talking about Snapshots, that introduces a lot of misunderstanding.