Export-VMsnapshot command creates disk with dirty bit set.

Hi,
I know my question is not exactly related to powershell issue, but I appreciate any help if possible…
Our script creates disk from Microsoft VMM virtual machine snapshot which is used by the deployment team to create virtual machines. The disk created by export-VMsnapshot command sets the dirty bit on the disk. When a new virtual machine is created from that disk it boots to trigger check disks.
Thanks,
Kishor

Yeah, unfortunately that’s something “inside” that command, not PowerShell per se. You’d probably need to contact MS support if you feel this is a bug condition.

You could probably post this query at
https://social.technet.microsoft.com/Forums/en-US/home?forum=winserverhyperv

Not an answer but it’s most likely down to how the snapshot is created and what the tool do with the snapshot afterwards.

E.g. if the tool creates a VSS snapshot and then make the snapshot write-able, then when creating a new drive from that snapshot, it will be seen as a “crash” state version of the drive.

Hi Fredrik,

To add to my question this issue is with only one virtual machine whereas other machine whose snapshot is used are working fine with same process.

Thanks,

kishor

Then I would start checking if the snapshot fails/logs errors for that virtual machine for some reason.

A quick test would be to shutdown the vm, take snapshot, then create a new VM from that snapshot.

Hi Fredrik,

Yes, I have already tried this option of creating a new VM from snapshot but in vain. This VM was clean but as our SCO workflow runs a export-vmsnapshot on another checkpoint from this machine the output vhdx we again got was also with dirty bit set.

Kishor

Hi Fredrik,

I observed situation which matches to what you mentioned in your previous post ‘it will be seen as a “crash” state version of the drive’.

On the new VM which I create using the vhdx , if I skip chkdsk it loads OS and shows ‘unexpected shutdown’ box to me…

Kishor

Yes, then that is the reason why you get a dirty disk since it apparently is in a crash state rather than a graceful state.

In Windows Server 2016 they introduced “Production” checkpoints which basically leverages VSS in the VM to make sure it’s in a application consistent state when doing the checkpoints.

You can read more about it here:

https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/choose-between-standard-or-production-checkpoints-in-hyper-v