Not a bug: Saving to NTFS compressed folder

Bug reports concerning HxD.
Post Reply
pTd
Posts: 18
Joined: 22 Sep 2009 18:16

Not a bug: Saving to NTFS compressed folder

Post by pTd » 27 Jun 2010 21:12

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.

Maël
Site Admin
Posts: 1138
Joined: 12 Mar 2005 14:15

Re: Saving to NTFS compressed folder

Post by Maël » 02 Nov 2017 23:08

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/

Post Reply