Interrupted trims
A trim that failed or was stopped cleans up after itself. This chapter is about the rare occurrences when the application could not do the cleanup, for example when the computer lost power or the program was ended by force.
What can be left behind
While an image is being replaced, the trimmed image is first written beside the original under the original’s name with .vdtrim-tmp added. Once it is verified, the original is moved aside as .vdtrim-old, the new image takes its name, and the old image is then deleted. For a disk made of several files, such as a split VMware disk, the two names are folders that hold the files.
Regardless of when the interruption happens, one complete disk exists: the original until the last moment, the trimmed one after it.
A trim in place keeps a journal beside the image, named .vdtrim-inplace after it. Before the commit the image is unchanged, and after it the journal finishes the trim.
Cleaning up
When such an image is added to the list, the application notices the leftover files and asks whether to clean up. Clean Up brings the disk in order. If the original is still in place, the unfinished result is removed. If it had been moved aside, it is put back. Only when a disk was already wholly aside and checked, the verified trimmed disk is put in place instead. After a trim in place, Clean Up finishes the trim if it had committed, and otherwise leaves the image as it was. An image with leftovers cannot be trimmed until they are cleared.
The same is done from the command line with vdtrim recover image, which requires no licence. It never overwrites a file and deletes nothing but the leftovers.