-4

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.

10
  • 2
    Git isn't designed to deal with huge files like this. What problem are you trying to solve by doing this? Did you take before/after checksums and verify them? – EEAA Mar 8 '16 at 13:25
  • they are clearly different as the file size has dropped. I want to create a version controlled server image, so I can instantiate many versions of it (it is part of a cluster) consistently across many environments. – Mark Jones Mar 8 '16 at 13:26
  • Git isn't your tool here. Just store the image file somewhere along with a SHA2, then use that in your application. You can still create versions images using different file names. – EEAA Mar 8 '16 at 13:30
  • 1
    Let me guess, you're a software developer who is getting into sysadmin? When all you have is a hammer, everything looks like a nail. Git is great for version controlling clear-text, smallish files that can be diffed in a meaningful way. You can't do that with binary files. Every single system I've worked with keeps its disk images on the filesystem except for EC2, which keeps them in S3. – EEAA Mar 8 '16 at 13:43
  • 7
    This is the sort of thing you use snapshots for. But git? I can't comprehend how such an idea would arise to begin with. It's hardly an "obvious" tool for this. – Michael Hampton Mar 8 '16 at 16:08
3

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.

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