Why is NTFS case sensitive?

12,841

Solution 1

The case sensitivity of a file system is a separate issue from that of an operating system. Latest Windows releases are based on the NT kernel, which inherits a lot of properties of the non-NT Windows 95 and even MS-DOS. Along with the NT kernel the file system, NTFS, was designed to be case sensitive -- to be POSIX compliant.

Although the Win32 subsystem does not support file names that only differ by case sensitivity, it is possible to create those files with lower level system calls.

Solution 2

It actually isn't NTFS that you are inquiring about.

NTFS is the filesystem. Your question is really about the case-sensitivity of the Windows command shell. They're completely different. Windows Explorer is a graphical command shell. By entring cmd (in Start | Run for example) you're telling the Windows command shell to execute the command cmd (which itself is actually another command shell, but command line based rather than graphical).

Similarly, CHKDSK is not doing any kind of check on whether you used CMD or cmd. All CHKDSK knows about are the parameters you pass to it, which in this case are x:, /f and /r.

As for CHKDSK "fixing capitalization", I'm not really sure what you mean there.

Solution 3

I suspect the question asker's claim that chkdsk.exe is "fixing capitalization in some files" is actually prompted by the message from CHKDSK that occurs under some circumstances:

correcting errors in the uppercase file

Basically, this results from a Windows XP version of chkdsk.exe running against an NTFS volume that has been formatted in a later version of Windows, as described in Error message when you run Chkdsk.exe on a Windows XP-based or on a Windows Server 2003-based computer: “Correcting errors in the uppercase file”. The upshot is that this is really not an error, and has nothing to do with case sensitivity.

Share:
12,841

Related videos on Youtube

Canadian Luke
Author by

Canadian Luke

Updated on September 18, 2022

Comments

  • Canadian Luke
    Canadian Luke almost 2 years

    I personally thought that NTFS was case insensitive, since you can type cmd, CMD, cMd or even CmD and still get the command prompt. However, why is it that during a CHKDSK x: /f /r, sometimes it fixes capitalization in some files? If it didn't care about the case, it shouldn't matter about that, and CHKDSK shouldn't be checking if it's actually CMD or cmd. Am I right? Where does it actually matter in the file system?

    • user1686
      user1686 over 12 years
      Note that "case-sensitive" and "case-preserving" are two separate things. NTFS is case-preserving but case-insensitive in the Win32 namespace, but can be case-sensitive in POSIX namespace.
  • Frank
    Frank over 12 years
    The NTFS is case-sensitive. According to MS KB article 100625: In NTFS, you can create unique file names, stored in the same directory, that differ only in case. For example, the following filenames can coexist in one directory on an NTFS volume: CASE.TXT case.txt case.TXT However, if you attempt to open one of these files in a Win32 application, such as Notepad, you would only have access to one of the files, regardless of the case of the filename you type in the Open File dialog box.
  • Canadian Luke
    Canadian Luke over 12 years
    Good find! I wouldn't mind learning then how to create those same 3 files in one folder
  • Frank
    Frank over 12 years
    I'm not aware of an easy way to create such files in Windows. However, calling CreateFile() API with FILE_FLAG_POSIX_SEMANTICS bit should do the job programmatically.
  • surfasb
    surfasb over 12 years
    @Luke: Win32 does not support case sensitive files. YOu'll have to make API calls into the OS subsystem. osronline.com/article.cfm?id=91
  • Dillawes0me
    Dillawes0me over 12 years
    @Luke: One easy way would be to mount the NTFS drive from a Linux system and create the files you wish there :)
  • JdeBP
    JdeBP over 12 years
    Just make sure that you have the right version of Windows NT and install the Subsystem for UNIX-based Applications utilities, people.
  • Synetech
    Synetech over 12 years
    > However, if you attempt to open one of these files in a Win32 application, such as Notepad, you would only have access to one of the files, regardless of the case of the filename you type in the Open File dialog box Which one?
  • user1686
    user1686 over 12 years
    @Synetech: The first one, perhaps? Depends on the file order in the directory, and possibly the moon phase.
  • Canadian Luke
    Canadian Luke over 12 years
    @JdeBP Just for the sake of curiosity... What different versions of NTFS are there?
  • afrazier
    afrazier over 12 years
    @Luke: As usual, Wikipedia to the rescue. :-)