NTFS Directory Corruption with Frequent File Creation

Last reviewed: January 6, 1998
Article ID: Q169404
The information in this article applies to:
  • Microsoft Windows NT Workstation versions 3.51 and 4.0
  • Microsoft Windows NT Server versions 3.51 and 4.0

SYMPTOMS

A directory in which files are repeatedly created and deleted eventually becomes corrupt. Subsequent attempts to access files in the directory or to create or delete files in the directory yield pop-up window indicating that the directory is corrupt and instructing the user to run CHKDSK.

When CHKDSK is run, it generates output like the following (although the specific file record segments affected will vary):

   Deleting corrupt attribute record (16, "")
   from file record segment 286.
   Deleting corrupt attribute record (32, "")
   from file record segment 286.
   Deleting corrupt attribute record (48, "")
   from file record segment 286.
   Deleting corrupt attribute record (80, "")
   from file record segment 286.
   Deleting corrupt attribute record (144, $I30)
   from file record segment 286.
   Deleting corrupt file record segment 286.
   Deleting orphan file record segment 8628.
   Deleting index entry DirectoryName in index $I30 of file 244.
   CHKDSK is recovering lost files.

CAUSE

Multiple attributes associated with a given file have the same attribute instance tag value. This is only likely to happen in directories where many files are repeatedly added and deleted in an "unbalanced" way.

RESOLUTION

To resolve this problem, you can do one of the following:

  • Run CHKDSK. By running CHKDSK, all files contained in a directory that is corrupted in this way should be recovered. CHKDSK is also capable of detecting when instance counts are exceptionally large and will proactively renumber attribute instance values. Specifically, if an attribute instance tag is larger than 0xF000, CHKDSK will send the following message (file number will vary):

          Adjusting instance tags to prevent rollover on file 252.
    

    Thus, by periodically running read-only CHKDSK, it is possible to detect problem directories before they become corrupt. If the above message is encountered while running CHKDSK in read-only mode, you should schedule a full CHKDSK to correct the problem.

    -or-

  • Obtain the fix mentioned below or wait for the next Windows NT service pack.

STATUS

Microsoft has confirmed this to be a problem in Windows NT version 3.51. A supported fix is now available, but has not been fully regression tested and should be applied only to systems experiencing this specific problem. Unless you are severely impacted by this specific problem, Microsoft recommends that you wait for the next Service Pack that contains this fix. Contact Microsoft Technical Support for more information.

Microsoft has confirmed this to be a problem in Windows NT version 4.0. A supported fix is now available, but has not been fully regression tested and should be applied only to systems experiencing this specific problem. Unless you are severely impacted by this specific problem, Microsoft recommends that you wait for the next Service Pack that contains this fix. Contact Microsoft Technical Support for more information.

MORE INFORMATION

Attribute entries within an NTFS File Record Segment (FRS) are labeled with an "instance tag" that must be unique for the attributes in a given FRS. The value for an attribute instance tag is generated when an attribute is created. Thus, typical instance tag values range from 0 to about 10 on most files.

If an attribute is deleted and recreated, it receives a new instance tag. Each time a new instance tag is needed, NTFS increments a counter associated with the FRS in question and uses the next previously unused value. Thus, instance tags can grow without bound if attributes are repeatedly destroyed and recreated.

For the vast majority of files and directories, the scheme described above does not result in any problems because, once created, FRS attributes tend not to be deleted and recreated. There is one scenario that is known to be an exception. If many files are repeatedly added to a directory and then deleted from the directory in such a way that the "binary tree" that indexes the directory becomes unbalanced, the "index root" attribute for the directory is repeatedly destroyed and re-created. Because instance tags are only 16 bits in size, this means that instance tags can be duplicated after a directory index has been rebalanced 65,535 times. Note that even if instance tags are duplicated, the directory will not be considered corrupt unless, at some point, it contained a sufficiently large enough number of files. Therefore this problem may be difficult to reproduce except in directories containing large numbers of files.


Additional query words: chkdisk autochk autocheck
Keywords : kbbug3.51 kbbug4.00 kbfix3.51 kbfix4.00 ntfilesys NTSrvWkst
Version : WinNT: 3.51,4.00
Platform : winnt
Issue type : kbbug
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 6, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.