Git corrupting Hyper-V VHDX [closed]

Hi I have created some Hyper-V machines (2 Ubuntu and one windows), exported them, and added them to a remote git repository.

When I clone the repo on another machine, I can import and run the Linux VMs fine, but the windows machine will not run, giving me an error:

Microsoft Emulated IDE Controller (instance ID ….) Failed to power on with Error ‘The File or Directory is corrupted and unreadable’

Does anyone know why this is happening, or have any suggestions? I have merged my differencing disk to the parent, and deleted all snapshots too.

Answer

Git’s really not appropriate for virtual machine disk images – GitHub has even written a storage service that will act as a sort of proxy for large files, just to keep them out of your git repo, because git is so bad for big binary files. The fact that git’s delta mechanism focuses on plaintext content, and git repos contain full history (with each version of the binary, generally without any delta compression), make them get out of hand quickly when they’re storing big binaries.

Instead, you should be using a filesystem that supports snapshotting your disk images (where only changed blocks will consume storage), such as ZFS or LVM with snapshots underneath something else – or, as mentioned in comments above, using a snapshotting mechanism built into your virtualization solution.

Attribution
Source : Link , Question Author : Mark Jones , Answer Author : Shane Madden

Leave a Comment