Ticket #8498 (closed defect: fixed)
Taking a snapshot can revert recent disk writes in the running VM
|Reported by:||eric97||Owned by:|
Taking a snapshot with the VM running can revert recent disk writes in the VM. The snapshot itself does contain the changes, but the still-running VM does not. (Rather than trying to explain in this detail in running text, let me refer you to the The problem section below.)
The guest is System Rescue CD 2.0.1 (can be downloaded from http://www.sysresccd.org/). For this test, it suffices to boot from the CD image; one does not need to install a guest O/S in the VM.
This first part is setup, which should all go as expected:
- Create a VM:
- System is Linux/Ubuntu
- Accept all further defaults
- Attach systemrescuecd-x86-2.0.1.iso to the virtual CD-ROM
- Boot, accepting all defaults
- Use cfdisk to create a single 5-MB primary partition, /dev/sda1
- Reboot (probably no longer necessary these days, but for the sake of eliminating extraneous variables, it can't hurt)
- Take a snapshot, using Machine > Take Snapshot... menu item
Here's where things get interesting. I'm attaching a screen capture, annotated to show the point where I take the snapshot.
- od -c /dev/sda1 to verify that it contains all '\0' bytes
- echo hello >/dev/sda1 (It's not often do you do *that* on purpose :-) )
- od -c /dev/sda1 again to verify that the "hello" was written
- Take a second snapshot, again using Machine > Take Snapshot...
- od -c /dev/sda1 yet again. It should still say "hello\n\0...", as it did at step (9), but in fact it's back to all '\0' bytes!
- The incorrect state survives a reboot:
- Reboot the VM from the virtual CD
- od -c /dev/sda1; still all '\0's
- But the snapshot we just took has the correct data:
- Power off the VM, and restore it to the most recent snapshot (the second one, taken at step (10)
- od -c /dev/sda1; the "hello" is back where it should be