Bug 1899 - Invalid data on used disk space with NTFS
Summary: Invalid data on used disk space with NTFS
Status: CLOSED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: Other (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Anton Altaparmakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-17 16:49 UTC by Haakon Riiser
Modified: 2004-01-19 06:20 UTC (History)
0 users

See Also:
Kernel Version: 2.6.1
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Haakon Riiser 2004-01-17 16:49:50 UTC
Distribution: Slackware 9.1
Hardware Environment: Athlon XP2500+, nForce2
Software Environment:
Problem Description:
Reported disk usage under NTFS is often different from what
is returned under 2.4, and by Windows itself.  The number of
allocated blocks is especially far off on the directory containing
the Windows operating system (i.e., C:\WINDOWS).  In my case,
Linux 2.6.1 reports the disk space used by C:\WINDOWS to be 20%
larger than the total size of the file system!

Here's an example (du is run in the root of what is my C: drive):

  0       AUTOEXEC.BAT
  0       CONFIG.SYS
  43M     Documents and Settings
  0       IO.SYS
  0       MSDOS.SYS
  48K     NTDETECT.COM
  366M    Program Files
  0       RECYCLER
  20K     System Volume Information
  12G     WINDOWS
  0       boot.ini
  232K    ntldr
  768M    pagefile.sys

Same command under 2.4:

  0       AUTOEXEC.BAT
  0       CONFIG.SYS
  41M     Documents and Settings
  0       IO.SYS
  0       MSDOS.SYS
  48K     NTDETECT.COM
  366M    Program Files
  2.0K    RECYCLER
  21K     System Volume Information
  1.4G    WINDOWS
  1.0K    boot.ini
  230K    ntldr
  770M    pagefile.sys

Steps to reproduce:
Mount the parition containing C:\WINDOWS and run "du -s".
Compare with what is reported under 2.4 or by Windows itself.
(Note that I am using Windows XP;  I don't know if this is
reproducible with other versions of Windows.)
Comment 1 Anton Altaparmakov 2004-01-19 06:20:58 UTC
Hi,

Thanks for the bug report.  I have fixed this in NTFS 2.1.6 release which I just
submitted to Linus.  Until it is accepted, you can fix it in your source tree by
editing fs/ntfs/inode.c and changing line 1049 from:

if (!NInoCompressed(ni))
       vi->i_blocks = ni->allocated_size >> 9;
...

to

if (S_ISDIR(vi->i_mode) || !NInoCompressed(ni))
       vi->i_blocks = ni->allocated_size >> 9;
...

Best regards,

Anton Altaparmakov
NTFS maintainer

Note You need to log in before you can comment on or make changes to this bug.