"VMWare failed to lock the file" partitioning images solved

  • Moderator

    Maybe this is already known, and maybe it’s the wrong section, please move if so.


    So I thought I’d share a problem and solution I came across, well it’s not really a fault with Fog, the problem is unknown to me but seems to be VMware related, but it caused by a process that is really nessecary when making an image for many computers. OK, so here is the scenario, you are happy with your image (win 7), and you want to cut the size down as much as possible of C:, before before finalizing it for upload.

    So you can PXE boot and select a disk management tool, in my case I use “parted magic” from menu.

    You cut the size down for example, the original VM disk was 60GB, and you cut it down to 30GB. You then reboot. The drive is now 30GB on C and 30GB unallocated.

    So now you can finish and upload the image to Fog. But what if something doesnt work during the sysprep? What if it prompts you for time settings because your unattend file is wrong? So you try to revert snapshot right? Well if you do the machine will just BSOD constantly. I think because you have changed the disk in windows but the reverted snapshot can’t tell this. It still thinks it has 60GB 😄 partition.

    I also tried re sizing the partition again to it’s old size but the drive tools wouldn’t load.

    So what you can do? Well, you would think the best thing to do would be that, after you have resized the partition, you should create a snapshot right? Well you can’t! At least with VMware, I haven’t tested other virtual software. You will constantly get “VMWare failed to lock the file”. Bummer!

    So what can you do? Well, power off the virtual machine, then simply clone it! You will now have a perfectly working clone with a small partition, ready for further deployment testing, and you can start making snapshots again!

    Thanks and I hope maybe this can help someone else that might find themselves in my situation!