Windows Server 2012 File Server Tip: Disable 8.3 Naming (and strip those short names too)
This has been a performance tip for File Servers for some time now: disable short names. There are big performance savings in disabling 8.3 naming and also for removing existing short names on a volume. Here’s a diagram from a presentation I delivered last year:
The old “8dot3 naming” convention has been obsolete for a while and most people can’t even remember the time when 8 characters in the name was the limit. In fact, recent versions of Windows Server don’t even enable 8.3 naming when you format new data volumes. However, as you can see in the chart above, it takes time to generate them and enumerate them.
But, if these short names are no longer enabled on data volumes, why even talking 8dot3 naming anymore? Well, the main problem is that most people upgrade to the new versions of Windows Server without reformatting their data volumes. In fact, a very common case of upgrade is to simply install a new server with Windows Server 2012 and reconfigure your SAN to expose those old LUNs to the new server. When you do that, if the volume was formatted back in Windows Server 2003 days, they carry over the short name setting.
You can use the FSUTIL.EXE tool to query the state of a volume. Just use “FSUTIL.EXE 8dot3name query D:”.
PS C:\Windows\system32> FSUTIL.EXE 8dot3name query D:
The volume state is: 0 (8dot3 name creation is enabled).
The registry state is: 2 (Per volume setting - the default).Based on the above two settings, 8dot3 name creation is enabled on D:
As you can see on the output above, there is a per-volume setting and a system wide setting. While the default for new volumes is to disable short names, the default system wide setting is to let you control 8.3 naming for each volume individually. In the example above, you have a volume configured for 8.3 naming. You can easily disable it using FSUTIL. Here’s an example:
PS C:\Windows\system32> FSUTIL.EXE 8dot3name set D: 1
Successfully disabled 8dot3name generation on D:PS C:\Windows\system32> FSUTIL.EXE 8dot3name query D:
The volume state is: 1 (8dot3 name creation is disabled).
The registry state is: 2 (Per volume setting - the default).Based on the above two settings, 8dot3 name creation is disabled on D:
Simple, huh? But you’re not quite done yet. New files and folders won’t get a short name anymore, but you could have tons of old files and folders that were created with both the short name and the long name versions stored in the volume. You could also go ahead and strip the existing short names using a specific FSUTIL option. The only potential problem is that you might have some old software that still has references to those old 8.3 names (some old installers, for instance, do that). However, the FSUTIL tool is careful enough to actually check in the registry for any such issues. Here’s a full example of a series of commands that let you enable, disable and then strip short file names from a volume.
1. Volume is empty
C:\Users\jose>dir K:\
Volume in drive K is TestVHD
Volume Serial Number is F8F8-0E8DDirectory of K:\
File Not Found
2. Enable 8.3 name creation (default for Windows Server 2008 R2 and Windows Server 2012 is off)
C:\Users\jose>fsutil 8dot3name set K: 0
Successfully set 8dot3name behavior.C:\Users\jose>fsutil 8dot3name query K:
The volume state for Disable8dot3 is 0 (8dot3 name creation is enabled).
The registry state of NtfsDisable8dot3NameCreation is 2, the default (Volume level setting).
Based on the above two settings, 8dot3 name creation is enabled on K:.
3. Create some files using both short names and long names.
C:\Users\jose>echo Test data 1>K:\Small.TXT
C:\Users\jose>for /L %a in (1 1 10) do copy K:\Small.TXT "K:\File Number %a.TXT"
C:\Users\jose>copy K:\Small.TXT "K:\File Number 1.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 2.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 3.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 4.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 5.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 6.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 7.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 8.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 9.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 10.TXT"
1 file(s) copied.
4. Use “DIR /X” to view both short names and long names. Note that Small.TXT does not get a short name, since its name is already short.
C:\Users\jose>dir K:\ /x
Volume in drive K is TestVHD
Volume Serial Number is F8F8-0E8DDirectory of K:\
02/26/2011 04:37 PM 12 FILENU~1.TXT File Number 1.TXT
02/26/2011 04:37 PM 12 FI8FE5~1.TXT File Number 10.TXT
02/26/2011 04:37 PM 12 FILENU~2.TXT File Number 2.TXT
02/26/2011 04:37 PM 12 FILENU~3.TXT File Number 3.TXT
02/26/2011 04:37 PM 12 FILENU~4.TXT File Number 4.TXT
02/26/2011 04:37 PM 12 FICD2E~1.TXT File Number 5.TXT
02/26/2011 04:37 PM 12 FI9706~1.TXT File Number 6.TXT
02/26/2011 04:37 PM 12 FI7C9D~1.TXT File Number 7.TXT
02/26/2011 04:37 PM 12 FIC1D1~1.TXT File Number 8.TXT
02/26/2011 04:37 PM 12 FI1706~1.TXT File Number 9.TXT
02/26/2011 04:37 PM 12 Small.TXT11 File(s) 132 bytes
0 Dir(s) 10,649,354,240 bytes free
5. We now disable short names for the volume
C:\Users\jose>fsutil 8dot3name set K: 1
Successfully set 8dot3name behavior.C:\Users\jose>fsutil 8dot3name query K:
The volume state for Disable8dot3 is 1 (8dot3 name creation is disabled).
The registry state of NtfsDisable8dot3NameCreation is 2, the default (Volume level setting).
Based on the above two settings, 8dot3 name creation is disabled on K:.
6. Next, we create a few more files with long names.
C:\Users\jose>for /L %a in (11 1 20) do copy K:\Small.TXT "K:\File Number %a.TXT"
C:\Users\jose>copy K:\Small.TXT "K:\File Number 11.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 12.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 13.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 14.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 15.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 16.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 17.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 18.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 19.TXT"
1 file(s) copied.C:\Users\jose>copy K:\Small.TXT "K:\File Number 20.TXT"
1 file(s) copied.
7. The volume now has a mix of files where short names are generated or not generated.
C:\Users\jose>dir K:\ /x
Volume in drive K is TestVHD
Volume Serial Number is F8F8-0E8DDirectory of K:\
02/26/2011 04:37 PM 12 FILENU~1.TXT File Number 1.TXT
02/26/2011 04:37 PM 12 FI8FE5~1.TXT File Number 10.TXT
02/26/2011 04:37 PM 12 File Number 11.TXT
02/26/2011 04:37 PM 12 File Number 12.TXT
02/26/2011 04:37 PM 12 File Number 13.TXT
02/26/2011 04:37 PM 12 File Number 14.TXT
02/26/2011 04:37 PM 12 File Number 15.TXT
02/26/2011 04:37 PM 12 File Number 16.TXT
02/26/2011 04:37 PM 12 File Number 17.TXT
02/26/2011 04:37 PM 12 File Number 18.TXT
02/26/2011 04:37 PM 12 File Number 19.TXT
02/26/2011 04:37 PM 12 FILENU~2.TXT File Number 2.TXT
02/26/2011 04:37 PM 12 File Number 20.TXT
02/26/2011 04:37 PM 12 FILENU~3.TXT File Number 3.TXT
02/26/2011 04:37 PM 12 FILENU~4.TXT File Number 4.TXT
02/26/2011 04:37 PM 12 FICD2E~1.TXT File Number 5.TXT
02/26/2011 04:37 PM 12 FI9706~1.TXT File Number 6.TXT
02/26/2011 04:37 PM 12 FI7C9D~1.TXT File Number 7.TXT
02/26/2011 04:37 PM 12 FIC1D1~1.TXT File Number 8.TXT
02/26/2011 04:37 PM 12 FI1706~1.TXT File Number 9.TXT
02/26/2011 04:37 PM 12 Small.TXT21 File(s) 252 bytes
0 Dir(s) 10,649,354,240 bytes free
8. We now use the command to strip the short names on the volume
C:\Users\jose>fsutil 8dot3name strip /s /v K:\
Scanning registry...
Registry DataRegistry Key Path
-----------------------------------------------------------------------
Total affected registry keys: 0Stripping 8dot3 names...
8dot3 Name FileId Full Path
------------- ------------------- ---------------------------------
FILENU~1.TXT 0x7000000000024 "K:\File Number 1.TXT"
FI8FE5~1.TXT 0xa00000000002d "K:\File Number 10.TXT"
FILENU~2.TXT 0xb000000000025 "K:\File Number 2.TXT"
FILENU~3.TXT 0xa000000000026 "K:\File Number 3.TXT"
FILENU~4.TXT 0xa000000000027 "K:\File Number 4.TXT"
FICD2E~1.TXT 0xa000000000028 "K:\File Number 5.TXT"
FI9706~1.TXT 0xa000000000029 "K:\File Number 6.TXT"
FI7C9D~1.TXT 0xa00000000002a "K:\File Number 7.TXT"
FIC1D1~1.TXT 0xa00000000002b "K:\File Number 8.TXT"
FI1706~1.TXT 0xa00000000002c "K:\File Number 9.TXT"Total files and directories scanned: 21
Total 8dot3 names found: 10
Total 8dot3 names stripped: 10For details on the operations performed please see the log:
"C:\Users\jose\AppData\Local\Temp\8dot3_removal_log @(GMT 2011-02-27 00-37-34).log"
9. Finally, all short names are gone…
C:\Users\jose>dir K:\ /x
Volume in drive K is TestVHD
Volume Serial Number is F8F8-0E8DDirectory of K:\
02/26/2011 04:37 PM 12 File Number 1.TXT
02/26/2011 04:37 PM 12 File Number 10.TXT
02/26/2011 04:37 PM 12 File Number 11.TXT
02/26/2011 04:37 PM 12 File Number 12.TXT
02/26/2011 04:37 PM 12 File Number 13.TXT
02/26/2011 04:37 PM 12 File Number 14.TXT
02/26/2011 04:37 PM 12 File Number 15.TXT
02/26/2011 04:37 PM 12 File Number 16.TXT
02/26/2011 04:37 PM 12 File Number 17.TXT
02/26/2011 04:37 PM 12 File Number 18.TXT
02/26/2011 04:37 PM 12 File Number 19.TXT
02/26/2011 04:37 PM 12 File Number 2.TXT
02/26/2011 04:37 PM 12 File Number 20.TXT
02/26/2011 04:37 PM 12 File Number 3.TXT
02/26/2011 04:37 PM 12 File Number 4.TXT
02/26/2011 04:37 PM 12 File Number 5.TXT
02/26/2011 04:37 PM 12 File Number 6.TXT
02/26/2011 04:37 PM 12 File Number 7.TXT
02/26/2011 04:37 PM 12 File Number 8.TXT
02/26/2011 04:37 PM 12 File Number 9.TXT
02/26/2011 04:37 PM 12 Small.TXT21 File(s) 252 bytes
0 Dir(s) 10,649,354,240 bytes freeC:\Users\jose>
Lastly, some references that might be useful:
- KB Article on short names: https://support.microsoft.com/kb/121007
- TechNet article with a reference for FSUTIL.EXE 8dot3name: https://technet.microsoft.com/en-us/library/ff621566.aspx
- TechNet article on the registry setting to disable 8.3 names system wide: https://technet.microsoft.com/en-us/library/cc778996.aspx
Comments
- Anonymous
April 04, 2014
While testing exports of SQL Server tables to files, one thing led to another and I started investigating - Anonymous
July 07, 2014
In this post, I'm providing a reference to the most relevant content related to Windows Server 2012 - Anonymous
August 16, 2016
The comment has been removed - Anonymous
October 03, 2016
Excellent post! - Anonymous
March 07, 2017
Good information!!! - Anonymous
June 29, 2017
The comment has been removed