Page 1 of 1

Not a bug: Saving to NTFS compressed folder

Posted: 27 Jun 2010 21:12
by pTd
HxD won't allow a disk image to be saved to an NTFS compressed folder. The free space containing the folder is less than the disk size, but the expectation is that the image will compress 'on the fly' to fit. I can save with a different tool, which provides the option to proceed despite not fitting.

I mentioned this in passing in another thread but thought it better to highlight it here.

Re: Saving to NTFS compressed folder

Posted: 02 Nov 2017 23:08
by Maƫl
The only special thing that is done is setting the final file size before actually writing the file. HxD does not check the free disk space.
The failure is due to Windows' file API SetEndOfFile(), which immediately returns with an error when there is not enough free space on a disk. It might also be because of the implementation of compressed folders/files under NTFS, that SetEndOfFile() relies on.

Writing a file progessively to implicitly extend its file size could work, but this wont guarantee it works in other cases, where there are scattered edits.
In other words, it would require to make the code more complicated for rare cases.

Just for documentation purposes, here is an explanation for when NTFS commits disk space and zeros out yet unwritten file parts. Among other topics it discusses sparse files and SetEndOfFile().
https://blogs.msdn.microsoft.com/oldnew ... 0/?p=9573/