Make Linux forbid colons in file names on NTFS partitions
In case of NTFS-3G check out the ntfs-3g man page and search for "windows_names".
excerpt
windows_names
This option prevents files, directories and extended attributes to be created with a name not allowed by windows, either because it contains some not allowed character (which are the nine characters ” * / : < > ? \ | and those whose code is less than 0×20) or because the last character is a space or a dot. Existing such files can still be read (and renamed).
even on NTFS partitions? Why is that?
In addition to Win32 filenames, NTFS supports also DOS and POSIX ones by the mechanism of filename namespaces. This way, a file not only can have colons or backslashes in its name, but it may even have multiple names.
You may have seen the DOS filenames e.g. on the command line, like the MICROS~1
below (or the commonly seen PROGRA~1
name for Program Files
in the root directory of C:
):
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\User>cd c:\Program Files
c:\Program Files>dir /x
Volume in drive C has no label.
Volume Serial Number is E4FC-4AD7
Directory of c:\Program Files
01/16/2020 10:13 PM <DIR> .
01/16/2020 10:13 PM <DIR> ..
05/26/2020 04:39 PM <DIR> 7-Zip
07/14/2009 06:20 AM <DIR> COMMON~1 Common Files
11/21/2010 10:16 AM <DIR> DVDMAK~1 DVD Maker
11/21/2010 10:06 AM <DIR> INTERN~1 Internet Explorer
11/21/2010 10:16 AM <DIR> MICROS~1 Microsoft Games
01/16/2020 10:14 PM <DIR> MINGW-~1 mingw-w64
07/14/2009 08:32 AM <DIR> MSBuild
07/14/2009 08:32 AM <DIR> REFERE~1 Reference Assemblies
11/21/2010 10:06 AM <DIR> WINDOW~3 Windows Defender
11/21/2010 10:16 AM <DIR> WI0FCF~1 Windows Journal
11/21/2010 10:06 AM <DIR> WINDOW~1 Windows Mail
11/21/2010 10:06 AM <DIR> WI54FB~1 Windows Media Player
07/14/2009 08:32 AM <DIR> WINDOW~2 Windows NT
11/21/2010 10:06 AM <DIR> WINDOW~4 Windows Photo Viewer
11/21/2010 06:31 AM <DIR> WIBFE5~1 Windows Portable Devices
11/21/2010 10:06 AM <DIR> WI4223~1 Windows Sidebar
0 File(s) 0 bytes
18 Dir(s) 5,582,016,512 bytes free
c:\Program Files>
In the above directory listing, the two namespaces of files are listed next to each other. The entries whose Win32 names which don't conflict with DOS, don't have a DOS name.
Without the windows_names
option mentioned in another answer, the Linux NTFS driver ntfs-3g
uses the POSIX namespace to name the files it creates.