To generate a checkpoint for a virtual machine (VM), first, while the VM
is still running, a copy-on-write (COW) disk file is created pointing to
a parent disk file that the VM is using. Next, the VM is stopped, the
VM's memory is marked COW, the device state of the VM is saved to memory,
the VM is switched to use the COW disk file, and the VM begins running
again for substantially the remainder of the checkpoint generation. Next,
the device state that was stored in memory and the unmodified VM memory
pages are saved to a checkpoint file. Also, a copy may be made of the
parent disk file for retention as part of the checkpoint, or the original
parent disk file may be retained as part of the checkpoint. If a copy of
the parent disk file was made, then the COW disk file may be committed to
the original parent disk file.