Skip to content
  • Vangelis Koukis's avatar
    Make mounting NTFS more robust · 8a9f78eb
    Vangelis Koukis authored
    Use lowntfs-3g with appropriate options when mounting NTFS-based Images:
        * ensure path lookup is case-insensitive,
        * prevent the creation of files with names which are not allowed
          under Windows,
        * complain loudly if the filesystem is dirty or needs recovery.
    
    Mounting the filesystem in a case-insensitive way can simplify task code
    significantly; there is no reason to perform case-insensitive lookups
    explicitly ("Unattend.xml" vs. "unattend.xml"). It also ensures
    attempting to inject "filea" in the image will overwrite "fileA", if it
    already exists, as it would under Windows, instead of leading to a
    situation where both "fileA" and "filea" exist, causing all sorts of
    problems later on.
    
    Finally, complain loudly when attempting to mount an NTFS marked dirty
    (requiring a disk check on next boot), or with an unclean journal.
    NTFS-3G code seems to wipe the NTFS journal instead of replaying it, and
    may lead to data corruption. Images should not contain dirty
    filesystems.
    
    See
    http://tuxera.com/forum/viewtopic.php?f=2&t=30562:
    "Actually the journal is simply wiped out. This is to prevent the
    journal to be applied at next mounting on Windows to data which may have
    been changed in the meantime.", and
    "So far, nobody has been able to understand how the journal is
    organized, so there is no real recovery in ntfs-3g, just wiping the
    journal."
    
    Also:
    http://www.tuxera.com/community/ntfs-3g-manual/
    "recover: Recover and try to mount a partition which was not unmounted
    properly by Windows. The Windows logfile is cleared, which may cause
    inconsistencies. Currently this is the default option."
    
    In the future, it would be best to reject the Image outright,
    instead of continuing.
    8a9f78eb