Snapshotting single disk of running Hyper-V VM

Posted by modelnine on Server Fault See other posts from Server Fault or by modelnine
Published on 2013-11-11T13:06:21Z Indexed on 2013/11/11 15:58 UTC
Read the original article Hit count: 187

I'm currently somewhat at a loss of how to create a snapshot of a single virtual hard-disk of a running Hyper-V VM. Generally, creating a differential disk while a server is shut down is no problem (i.e., call the new-vhd cmdlet and pass a ParentPath, then update the VHD-binding of the respective VM-device), but while the host is running, all I can find is checkpointing the VM as a whole (which creates snapshots of all attached disks), and leaves the VM-state in a form which isn't easily processable by external tools (i.e., it requires reading additional meta-data from the VM).

Generally, what'd I'd like to happen for a single-disk snapshot (in my understanding) is:

  1. Pause the VM
  2. Rename current disk to some other name which specifies it as a base-snapshot
  3. Create a new VHD which has the renamed VHD as parent path and is marked as "current"
  4. Swap the VHD for the VM for the snapshotted hard-disk to the newly created differential VHD
  5. Resume the VM

Is there any means to do this programatically?

Update: I've seen that this is actually possible with SCSI-disks, i.e. pause the VM, remove the SCSI disk, make the snapshot, reattach the SCSI disk at the same position, resume the VM. And, the VM resumes properly. But: is something similar also possible with G1 machines for the boot disk which is always IDE?

© Server Fault or respective owner

Related posts about hyper-v

Related posts about windows-server-2012