Turn On Windows 10 NTFS Case Sensitivity
Now that Windows 10 supports running several different Linux distros, Microsoft has added a flag to NTFS that forces the file system to recognize files and folders that are only different by case differently. In this Ask the Admin, I’ll show you how to enable the flag on a folder and explain why you might need this feature.
Recently, I have been doing a lot of work with Linux. But not because I’m abandoning Windows. Quite the opposite. I’ve been using Linux because Puppet Enterprise uses it for its master server. If you are not familiar with Puppet, it is a configuration management system popular for managing servers in DevOps environments.
The main reason to look at Puppet instead of PowerShell DSC is that Puppet is a more mature solution and has better support for managing Linux. Many environments use Windows Server and Linux, so a configuration management product that can manage both equally well is a bonus.
If you missed my two-part article on configuring Puppet Enterprise in Red Hat Linux running in a Hyper-V virtual machine, you can read both parts here:
Install and Configure Puppet Enterprise Part 1: Set Up Red Hat Linux in Hyper-V
Install and Configure Puppet Enterprise Part 2: Set Up Puppet Enterprise 5
If you are interested in learning how to manage Windows Server using Puppet, here are links to the seven parts published so far:
Managing Windows Server with Puppet Part 1: Configure Puppet Master and Bootstrap the Puppet Agent in Windows Server
Managing Windows Server with Puppet Part 2: Log in to Puppet Master, Accept Node Certificate, and Test Connectivity
Managing Windows Server with Puppet Part 3: Install Modules and Edit the Site Manifest
Managing Windows Server with Puppet Part 4: Working with Files and ACLs
Managing Windows Server with Puppet Part 5: Managing Local Users and Groups
Managing Windows Server with Puppet Part 6: Installing, Updating, and Removing Software
Managing Windows Server with Puppet Part 7: Installing Active Directory
Linux is Case Sensitive
One of the frustrating aspects for Windows sysadmins working with Linux is that unlike Windows, Linux is case sensitive. For example, code in a Puppet manifest might not work if you don’t use the correct case for the first letter of a parameter. More fundamentally, when working with files and directories in Linux, puppet.conf is not the same as Puppet.conf. Linux sees these as two different files.
This difference in behavior can cause problems when using the Windows Subsystem for Linux (WSL) in Windows 10. WSL provides a layer for mapping Windows kernel system calls to Linux kernel system calls, allowing Linux binaries to run in Windows unmodified. WSL also maps Windows services, like the filesystem and networking, as devices that Linux can access.
For more information on the Windows Subsystem for Linux, see How Does the Windows 10 Subsystem for Linux Work and What Is It For? on Petri.
Enable Case Sensitivity Support
To help address the issue with WSL, Microsoft enabled support for NTFS case sensitivity in the Windows 10 April 2018 Update. It’s important to note that NTFS case sensitivity can only be enabled on systems that have the Windows Subsystem for Linux installed. To install WSL, open a PowerShell prompt with administrative privileges and run the command below:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Reboot the computer to complete the installation. Once the PC has rebooted, you can enable case sensitivity. In this example, I’ll enable case sensitivity for a folder in the root of the system drive, called ‘sensitive’.
- Open a command prompt with administrative privileges. Type cmd in the search box in the taskbar, right-click Command Prompt in the results and select Run as administrator from the menu. You might be required to enter an administrator username and password or give consent to run the program with elevated rights.
- In the command prompt, create a folder using the mkdir command:
- Now use the fsutil command as shown below to enable case sensitivity support on the folder:
fsutil.exe file SetCaseSensitiveInfo C:\sensitive enable
- Let’s create two text files in the ‘sensitive’ folder. Both files have the same name but use upper case letters in different places:
type NUL > c:\sensitive\helloworld.txt type NUL > c:\sensitive\HelloWorld.txt
- If you list the directory contents of the ‘sensitive’ folder, you’ll see two files exist with the same name. This wouldn’t usually be possible on an NTFS-formatted disk:
That’s it! If you want to disable case sensitivity support, run the fsutil command again, replacing enable with disable.
fsutil.exe file SetCaseSensitiveInfo C:\sensitive disable
In this Ask the Admin, I showed you how to enable NTFS case sensitivity support for use with the Windows Subsystem for Linux.