|FILE_ID_BOTH_DIR_INFORMATION| fields |ShortName|+|ShortNameLength| mandatory for Cygwin and Window 10 ?

Brian Inglis Brian.Inglis@SystematicSW.ab.ca
Sat Apr 27 15:03:21 GMT 2024


On 2024-04-27 07:08, Roland Mainz via Cygwin wrote:
> Are the |FILE_ID_BOTH_DIR_INFORMATION| fields
> |ShortName|+|ShortNameLength| mandatory these days, e.g. is it legal
> to set |ShortNameLength = 0;| for Cygwin 3.4/3.5 in Windows 10 ?

MS Windows 8/Server 2012+ disabled 8.3 short name generation on new 
volumes/partitions, for example see:

	https://ss64.com/nt/syntax-filenames.html

	https://archive.techarp.com/showarticle53b4.html?artno=827

https://learn.microsoft.com/en-ca/archive/blogs/josebda/windows-server-2012-file-server-tip-disable-8-3-naming-and-strip-those-short-names-too

https://learn.microsoft.com/en-ca/windows-server/administration/windows-commands/fsutil-8dot3name

This really makes a big difference on directories like /var/log/ and /tmp/ if 
apps create a lot of files with similar name prefixes there, for example, 
date/time suffixed long file names from multiple hourly cron jobs, as long names 
can be queried via the B-tree but short names have to be scanned sequentially.

> Is there anything else for a filesystem driver to do to indicate that
> |ShortName| support is not available ?

Also see fsutil behavior query|set disable8dot3 [[<volumepath> [{1|0}]]|<value>]

% fsutil 8dot3name set /?
usage : fsutil 8dot3name set [0 through 3] | [<Volume Path> 1 | 0]

When a volume is not specified the operation updates the registry value:

     0 - Enable 8dot3 name creation on all volumes on the system
     1 - Disable 8dot3 name creation on all volumes on the system
     2 - Set 8dot3 name creation on a per volume basis
     3 - Disable 8dot3 name creation on all volumes except the
               system volume

     When a volume is specified the operation updates the individual
         volume's on disk flag.  This operation is only meaningful
         if the registry value is set to 2.

     0 - Enable 8dot3 name creation on this volume
     1 - Disable 8dot3 name creation on this volume

This operation takes effect immediately (no reboot required).

Sample commands:
   "fsutil 8dot3name set 1"      - disable 8dot3 name creation on all volumes
   "fsutil 8dot3name set C: 1"   - disable 8dot3 name creation on c:

% regtool get -v 
/proc/registry/HKEY_LOCAL_MACHINE/System/CurrentControlSet/Control/FileSystem/NtfsDisable8dot3NameCreation
2

% fsutil 8dot3name query c:
The volume state is: 0 (8dot3 name creation is enabled).
The registry state is: 2 (Per volume setting - the default).

Based on the above settings, 8dot3 name creation is enabled on c:

% fsutil 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 settings, 8dot3 name creation is enabled on d:

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry


More information about the Cygwin mailing list