1

(I'm using the built-in Hyper-V that comes with Windows Server 2012 R2)

I want to play with my snapshots while I have a separate disk that would not be affected by those snapshots, thus I can store separately installation files etc. (I could do this easily on VMWare)

How can I define such disk on Hyper-v?

1

Snapshots in Hyper-V include, in addition to the virtual disks, the state of memory and the virtual processors (along with sundry other stuff.) So when you apply the snapshot, anything that was in the virtual machines memory related to the file systems on the virtual disks is still there, and still coherent. The file systems on the virtual disks don't get corrupted specifically because they are in sync with the in-memory state of the OS running in the VM.

If you were to exclude a VHD from the snapshot, and then you applied the snapshot, the file system on the VHD would immediately be corrupted, because the in-memory file system state would assume that the virtual disk was in the same state as the moment the snapshot was taken. It would flush out pending writes, which would then be written to the VHD. And since the VHD wasn't part of the snapshot, the on-disk structures would have changed and now it's garbage.

If you really want a file system that doesn't come along with the snapshot, one which will be coherent when the snapshot is applied, you need to make that file system external to the VM itself, or you need to make it read-only. The easiest answer, of course, would be to put the files you want to keep constant on a file share on a file server somewhere. You could also make an ISO image -- they're read-only.

| improve this answer | |
  • Thank you, is the "in-memory state" still saved even I take the snapshot while the machine is powered off? – elady Mar 24 '14 at 18:47
  • No. While the VM is powered off, there is no memory assigned to it. Of course, if your VM is powered off, then the file systems have been shut down cleanly and there's no danger of corruption. If you wanted to exclude a VHD from a snapshot while the VM was powered off, you could remove it, take the snapshot, and re-add it. (I know that you'd like that to be one step, but I don't have a better suggestion. It would be a single line of PowerShell code if that's any condolence.) – Jake Oshins Mar 24 '14 at 20:05
  • 1
    It's very weird that Hyper-V doesn't support disk independence in the case that the snapshot was taken while the machine is powered off (like VMWare), anyway thank you. – elady Mar 25 '14 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.