Virtualbox: How to merge current state (snapshot) with disk image

virtualbox

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.)

Best Answer

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):

The delete operation deletes a snapshot (specified by name or by UUID). This can take a while to finish since the differencing images associated with the snapshot might need to be merged with their child differencing images.

To revert to the state of the snapshot you use the restore operation:

The restore operation will restore the given snapshot (specified by name or by UUID) by resetting the virtual machine's settings and current state to that of the snapshot. The previous current state of the machine will be lost. After this, the given snapshot becomes the new "current" snapshot so that subsequent snapshots are inserted under the snapshot from which was restored.