Hi Dennis,
Dennis Schridde wrote:
> Hello!
>
> I just ran Windows 7 SP1's chkdsk on an NTFS partition that I usually work on
> from Linux using NTFS-3G 2011.4.12.
>
> chkdsk decided to delete a lot of filenames because they were "invalid" (that
> seems to mean they contain characters like : or ? which Windows does not
> like). Now I am in a state where I have a few dozen file1234.chk filenames and
> dir1234.chk directories, have to figure out what they contain and properly
> rename them. (At least it did not entirely delete the files...)
>
The chkdsk for Windows 7 creates a log in
"/System Volume Information/Chkdsk/Chkdsk*.log"
which contains the old name and the inode number,
such as :
"Deleted invalid filename foo:bar (83) in directory 30."
You can query the inode number of "file1234.chk"
with stat or option -i of ls ("ls -li file1234.chk"), and
associate the old name according to inode number.
> The NTFS-3G manual says about this in the "Windows Filename Compatibility"
> section: "[ntfs-3g] always creates new files in the POSIX namespace for
> maximum portability and interoperability reasons. [...] This is perfectly
> legal on Windows, [...]"
>
But of course what is legal on Windows may be changed
by Microsoft without prior notice...
Deletion of file names containing some reserved characters
is new to chkdsk for Windows 7. Older variants did not
delete the file names which were legal in the Posix
name space.
> Now my questions/ideas to prevent such mess in the future:
> * Is it possible to instruct ntfs-3g to create both, a Windows and a POSIX
> filename?
>
This is probably possible in general, using hard links,
but it would be complex :
- when deleting such a file, a search for a possible
alternate name would have to be done.
- when doing a directory list, returning both names
would have to be avoided.
In such a case, the Posix name is deleted by chkdsk
and the Windows name is kept (no file1234.chk is
created), so there is no real improvement.
> * Can it map "invalid" characters of the POSIX filename to e.g. underscores _
> in the Windows filename? Does "windows_names" do this?
>
Replacing reserved characters by underscores would
create duplicates.
The option "windows_names" forbids the creation of
file names not compatible with Windows (reserved
characters, names ending with a space or a dot).
> * Is it possible to put the whole partition into POSIX mode, so that Windows
> and tools like chkdsk would let those filenames alone?
>
Not possible. My opinion is that the deletion of such file
names has been added intentionally by Microsoft.
> * Is it possible that there are filenames on my disk, which are not in the
> POSIX namespace, but not conforming to the Windows namespace, either? How
> could I fix this?
>
That would be a bug in chkdsk for Windows 7.
> * Is there a free (preferably FOSS) chkdsk tool that behaves more sane, e.g.
> by renaming the filenames to such with invalid characters replaced by
> underscores _?
>
None that I know of.
A possible way is to build a shell script based on find(1),
but you will have to deal with duplicates.
> * Is there any other way I can prevent the problem in the future?
>
Currently the only way is to use the option "windows_names".
This has no effect on existing files.
Regards
Jean-Pierre
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel