Sparse file support

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50703
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Sparse file support

Post by *ghisler(Author) »

This was suggested via e-mail, and I have implemented it now in TC 11.55 rc1. Therefore it would be great if someone could try it!

The NTFS file system supports so-called sparse files, there are files where not all the space has been allocated - instead, only blocks of data containing non-null bytes are allocated. This can save a lot of space, e.g. in large disk images which are mostly empty.

Windows 11 22H2 and newer now allows to copy such sparse files (preserving the allocated parts only) with function CopyFile2. On older versions of Windows, I'm copying the parts manually.

To experiment with sparse files, I have created a small tool to create them:
https://www.totalcommander.ch/win/tools/mksparse.zip

The upper part of the dialog allows to create one or more completely empty sparse files which take up 0 bytes on disk. You can see the allocated space with Alt+Enter in Total Commander.

The lower part allows to patch data in existing files, which would allocate the data in sparse files, so their size is then larger than 0. You will notice that Windows allocates an entire block of, for example, 64 kBytes.

When you copy such a file with older versions of Total Commander or with the Explorer, the target file will allocate the entire file size. With TC 11.55 rc1, however, the copied file will not occupy more space than the source file.
Author of Total Commander
https://www.ghisler.com
Post Reply