Fixed free reports negative used amount

May 20, 2008
450
2
#1
My J: drive is an network file store. I ran out of quota space copying to it from my 2008 R2 64-bit VM and, after removing the partial copy, checked the drive space. Here is what was reported.

D:\free j:

Volume in drive J is Transfer Serial number is ...
2,147,483,648 bytes total disk space
-70,969,159,680 bytes used
73,116,643,328 bytes free
-3304.8 % in use

D:\>ver /r
TCC LE 13.03.39 x64 Windows 2008 [Version 6.0.6001]
TCC LE Build 39 Windows 2008 Build 6001 Service Pack 1

That was checked from the VM. Just in case the error was version specific, I also checked from my Win7 laptop.

D:\>free j:

Volume in drive J is Transfer Serial number is ...
2,147,483,648 bytes total disk space
-70,969,163,776 bytes used
73,116,647,424 bytes free
-3304.8 % in use

D:\>ver /r

TCC 13.03.39 Windows 7 [Version 6.1.7600]
TCC Build 39 Windows 7 Build 7600

Volume data as reported by Windows Explorer properties:
Type: Network Drive
File system: NTFS
Used: 19.6GB (21,091,037,184 bytes)
Free: 19.4GB (20,851,998,720 bytes)
Capacity: 39.0GB (41,943,035,904 bytes)
The free command appears to be using max_long + 1 for this drive size.
 
Jan 19, 2011
581
10
Norman, OK
#2
Glad to see that I'm not the only one.
Code:
[C:\temp]
14:49:26 $ free s:
 
Volume in drive S is Storage        Serial number is 3887:3b0f
  375,809,638,400 bytes total disk space
-1,554,979,155,968 bytes used
1,930,788,794,368 bytes free
            -413.8 % in use
DIR has the same issues of wrong results.

Here's DIR from CMD (trimmed to show header and footer only.
Code:
C:\temp>dir s:
Volume in drive S is Storage
Volume Serial Number is 3887-3B0F
 
Directory of S:\
 
8< ---------------- snip ------------------- >8
 
              0 File(s)              0 bytes
              67 Dir(s)  59,992,186,880 bytes free
and here's DIR from TCC.
Code:
[C:\temp]
14:57:25 $ *dir /u s:
 
Volume in drive S is Storage        Serial number is 3887:3b0f
Directory of  S:\*
 
                0 bytes in 0 files and 67 dirs
1,930,684,080,128 bytes free
The results from the CMD version of DIR match the results of right-clicking on the drive and viewing properties in Windows.
 

rconn

Administrator
Staff member
May 14, 2008
10,551
97
#4
I still can't reproduce this here (tried it on 5 systems and 3 different networks). I did trace the code, and the only way this can happen is if you have a bug in your redirector -- all TCC is doing is calling the Windows GetDiskFreeSpaceEx API.

I added some code in 13.03.42 to suppress the output if it's obviously wrong. (There's not much I can do to get the "right" output if Windows won't return it.)
 

rconn

Administrator
Staff member
May 14, 2008
10,551
97
#5
Jan 19, 2011
581
10
Norman, OK
#6
That looks to have corrected the problem with both DIR and FREE. Here are a couple FREEs that reference the same storage location but with different sizes allocated to the shares. From looking at the numbers, it appears there was some mixed information that was polluting the results.

Code:
[C:\temp]
09:47:13 $ free q:
 
 Volume in drive Q is Storage        Serial number is 3887:3b0f
    42,949,672,960 bytes total disk space
     3,299,635,200 bytes used
    39,650,037,760 bytes free
               7.7 % in use
 
[C:\temp]
09:47:23 $ free s:
 
 Volume in drive S is Storage        Serial number is 3887:3b0f
   375,809,638,400 bytes total disk space
   317,089,845,248 bytes used
    58,719,793,152 bytes free
              84.4 % in use
 
[C:\temp]
09:47:25 $ free u:
 
 Volume in drive U is Storage        Serial number is 3887:3b0f
 3,599,934,763,008 bytes total disk space
 1,668,437,012,480 bytes used
 1,931,497,750,528 bytes free
              46.3 % in use
 
May 20, 2008
450
2
#7
Thanks for testing the change, John. I was away for a long weekend with only Edge cell network data access and FTP access is blocked at the office where I am today.

Rex, If you want, I can download from FTP tonight and test it tomorrow.