Question about free size in TC folder header

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
spacefreek
Junior Member
Junior Member
Posts: 2
Joined: 2013-12-30, 10:33 UTC
Location: Netherlands

Question about free size in TC folder header

Post by *spacefreek »

Hi all,

My question regards the used space which is displayed just on top of a folder. I'm working on network drives (e.g. p:\) which currently states: 2.109.448.345.600 b of 19.791.209.299.968 b free (b = bytes).

When deleting a file of say, 2.432.260.196 bytes (shown by both TC and explorer), one would expect a new free space of 2.111.880.605.796 b, though TC displayes a new free space of 2.109.967.773.696 bytes after deleting this file (there are no other activities on the drive).

I've noticed this when TC showed free space on a different network drive of around 260 GB, where I needed more space, so I started deleting files. But after deleting over 1 TB (!) of data, it showed a free space of approx. 580 GB (577.853.028.352 b), which got my attention as I've deleted much more files. (I've checked the filesizes while deleting them, and they were indeed in total over 1 TB, I've used both explorer and TC to check this).

Can anyone carify some things here? Am I missing something? How could I check the actual free space of the drive? What is displayed on top of the folder?

Thanks,

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

Post by *ghisler(Author) »

It's possible that some of the files were compressed with the NTFS compression:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363848%28v=vs.85%29.aspx
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Some NTFS files can be also "sparse" - when they contain large blocks of zeros, these zeros may be not physically allocated on disk (see picture). So if you have a 1 GB file with 900 MB of zeros and 100 MB of real data, sparse file occupies only 100 MB of disk space. When you'll delete it, you will receive only 100 MB back, not the whole 1 GB.

Regards
spacefreek
Junior Member
Junior Member
Posts: 2
Joined: 2013-12-30, 10:33 UTC
Location: Netherlands

Post by *spacefreek »

Hmm, I'm not an expert on this, but a sparse file does look like an explanation for this. We're using our own software that writes output data from large computations into so called NEFIS files (ftp://ftp.hamburg.baw.de/pub/Kfki/WTZ-Brasilien/CorelabDelft3d/docu/NEFIS_User_Manual.pdf), which stores data on a curvylinear grid (stored as matrices, though parts of these grids can be inactive (e.g. NaN's or zeros indeed)). These output files easily go into the 10's of GB a piece. I do know that a near-future update of our software will go and use netCDF output data structures instead (along with changes in the computational core), which might be more efficiënt in this respect (and hence support that decision)

Just a quick question for my understanding of the 'free space functionality': say that I only have non-sparse files, and no compressions etc., if my free space would be 1000 k and I delete 100 k of data, my free space becomes 1100 k right? So what could it possibly be (apart from being a sparse file)?

Cheers!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

No, not necessarily - files take a multiple of the disk cluster size, which is usually 8 kBytes on NTFS, but can be different depending on how the disk was formatted. So a 1 byte file would take the minimum cluster size (8k in this example).
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

In most cases, after deleting 100 kB of data, you will get about 100 kB of free disk space. I see the following possibilities:

Situations, when you get significantly LESS free disk space when deleting:
1) You deleted a compressed file.
2) You deleted a sparse file.

Situations, when you get a bit MORE free disk space when deleting:
1) Disk space is divided into so-called clusters, each cluster has for example 4096 bytes. You can imagine this as pages in a book. When some chapter is 12.25 pages long, it occupies 13 pages in fact. When size of your file is 5000 bytes, it occupies 8192 bytes of disk space (assuming 4096-bytes cluster size). So when you delete 5000-bytes file, you will get 8192 bytes of free disk space.
2) Each directory is in fact also a special file, which contains records that describe each file in this directory. So when you delete a lot of files from some directory, you may get a bit of additional free disk space, because the file, that represents the directory, will become smaller.

You can also get INVALID value of free disk space, when there are errors in your file system - use "chkdsk /f" command to repair this. When some application asks about free disk space, operating system doesn't read and sum sizes of all files, this would be very slow. Each disk has stored "free space" value, which is updated along with changes in files. There may be situations, when size of some file changed, but "free space" value hasn't been modified (due to a power outage for example).

Possibilities described above may occur together, so it's hard to precisely say what free disk space will be after deleting a file.

Regards
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

I had this phenomena too sometimes, but only with network drives.
It seems the files are marked as deleted, but the "free space counter" is not updated instantly but with a kind of delay.
I never found a value for this delay, sometimes a few seconds, then some minutes up to an hour.
Same with TC and Windows Explorer ...
#5767 Personal license
Post Reply