^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) VFAT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) USING VFAT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) To use the vfat filesystem, use the filesystem type 'vfat'. i.e.::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) mount -t vfat /dev/fd0 /mnt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) No special partition formatter is required,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 'mkdosfs' will work fine if you want to format from within Linux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) VFAT MOUNT OPTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) ==================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) **uid=###**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) Set the owner of all files on this filesystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) The default is the uid of current process.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) **gid=###**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) Set the group of all files on this filesystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) The default is the gid of current process.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) **umask=###**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) The permission mask (for files and directories, see *umask(1)*).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) The default is the umask of current process.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) **dmask=###**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) The permission mask for the directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) The default is the umask of current process.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) **fmask=###**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) The permission mask for files.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) The default is the umask of current process.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) **allow_utime=###**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) This option controls the permission check of mtime/atime.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) **-20**: If current process is in group of file's group ID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) you can change timestamp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) **-2**: Other users can change timestamp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) The default is set from dmask option. If the directory is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) writable, utime(2) is also allowed. i.e. ~dmask & 022.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) Normally utime(2) checks current process is owner of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) the file, or it has CAP_FOWNER capability. But FAT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) filesystem doesn't have uid/gid on disk, so normal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) check is too unflexible. With this option you can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) relax it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) **codepage=###**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) Sets the codepage number for converting to shortname
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) characters on FAT filesystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) By default, FAT_DEFAULT_CODEPAGE setting is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) **iocharset=<name>**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) Character set to use for converting between the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) encoding is used for user visible filename and 16 bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) Unicode characters. Long filenames are stored on disk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) in Unicode format, but Unix for the most part doesn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) know how to deal with Unicode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) By default, FAT_DEFAULT_IOCHARSET setting is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) There is also an option of doing UTF-8 translations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) with the utf8 option.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) .. note:: ``iocharset=utf8`` is not recommended. If unsure, you should consider
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) the utf8 option instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) **utf8=<bool>**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) UTF-8 is the filesystem safe version of Unicode that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) is used by the console. It can be enabled or disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) for the filesystem with this option.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) If 'uni_xlate' gets set, UTF-8 gets disabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) By default, FAT_DEFAULT_UTF8 setting is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) **uni_xlate=<bool>**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) Translate unhandled Unicode characters to special
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) escaped sequences. This would let you backup and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) restore filenames that are created with any Unicode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) characters. Until Linux supports Unicode for real,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) this gives you an alternative. Without this option,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) a '?' is used when no translation is possible. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) escape character is ':' because it is otherwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) illegal on the vfat filesystem. The escape sequence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) that gets used is ':' and the four digits of hexadecimal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) unicode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) **nonumtail=<bool>**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) When creating 8.3 aliases, normally the alias will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) end in '~1' or tilde followed by some number. If this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) option is set, then if the filename is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) "longfilename.txt" and "longfile.txt" does not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) currently exist in the directory, longfile.txt will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) be the short alias instead of longfi~1.txt.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) **usefree**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) Use the "free clusters" value stored on FSINFO. It will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) be used to determine number of free clusters without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) scanning disk. But it's not used by default, because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) recent Windows don't update it correctly in some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) case. If you are sure the "free clusters" on FSINFO is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) correct, by this option you can avoid scanning disk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) **quiet**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) Stops printing certain warning messages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) **check=s|r|n**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) Case sensitivity checking setting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) **s**: strict, case sensitive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) **r**: relaxed, case insensitive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) **n**: normal, default setting, currently case insensitive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) **nocase**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) This was deprecated for vfat. Use ``shortname=win95`` instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) **shortname=lower|win95|winnt|mixed**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) Shortname display/create setting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) **lower**: convert to lowercase for display,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) emulate the Windows 95 rule for create.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) **win95**: emulate the Windows 95 rule for display/create.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) **winnt**: emulate the Windows NT rule for display/create.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) **mixed**: emulate the Windows NT rule for display,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) emulate the Windows 95 rule for create.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) Default setting is `mixed`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) **tz=UTC**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) Interpret timestamps as UTC rather than local time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) This option disables the conversion of timestamps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) between local time (as used by Windows on FAT) and UTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) (which Linux uses internally). This is particularly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) useful when mounting devices (like digital cameras)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) that are set to UTC in order to avoid the pitfalls of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) local time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) **time_offset=minutes**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) Set offset for conversion of timestamps from local time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) used by FAT to UTC. I.e. <minutes> minutes will be subtracted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) from each timestamp to convert it to UTC used internally by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) Linux. This is useful when time zone set in ``sys_tz`` is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) not the time zone used by the filesystem. Note that this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) option still does not provide correct time stamps in all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) cases in presence of DST - time stamps in a different DST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) setting will be off by one hour.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) **showexec**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) If set, the execute permission bits of the file will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) allowed only if the extension part of the name is .EXE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) .COM, or .BAT. Not set by default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) **debug**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) Can be set, but unused by the current implementation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) **sys_immutable**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) If set, ATTR_SYS attribute on FAT is handled as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) IMMUTABLE flag on Linux. Not set by default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) **flush**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) If set, the filesystem will try to flush to disk more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) early than normal. Not set by default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) **rodir**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) FAT has the ATTR_RO (read-only) attribute. On Windows,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) the ATTR_RO of the directory will just be ignored,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) and is used only by applications as a flag (e.g. it's set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) for the customized folder).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) If you want to use ATTR_RO as read-only flag even for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) the directory, set this option.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) **errors=panic|continue|remount-ro**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) specify FAT behavior on critical errors: panic, continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) without doing anything or remount the partition in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) read-only mode (default behavior).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) **discard**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) If set, issues discard/TRIM commands to the block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) device when blocks are freed. This is useful for SSD devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) and sparse/thinly-provisoned LUNs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) **nfs=stale_rw|nostale_ro**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) Enable this only if you want to export the FAT filesystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) over NFS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) **stale_rw**: This option maintains an index (cache) of directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) *inodes* by *i_logstart* which is used by the nfs-related code to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) improve look-ups. Full file operations (read/write) over NFS is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) supported but with cache eviction at NFS server, this could
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) result in ESTALE issues.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) **nostale_ro**: This option bases the *inode* number and filehandle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) on the on-disk location of a file in the MS-DOS directory entry.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) This ensures that ESTALE will not be returned after a file is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) evicted from the inode cache. However, it means that operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) such as rename, create and unlink could cause filehandles that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) previously pointed at one file to point at a different file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) potentially causing data corruption. For this reason, this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) option also mounts the filesystem readonly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) To maintain backward compatibility, ``'-o nfs'`` is also accepted,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) defaulting to "stale_rw".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) **dos1xfloppy <bool>: 0,1,yes,no,true,false**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) If set, use a fallback default BIOS Parameter Block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) configuration, determined by backing device size. These static
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) parameters match defaults assumed by DOS 1.x for 160 kiB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 180 kiB, 320 kiB, and 360 kiB floppies and floppy images.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) LIMITATION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) The fallocated region of file is discarded at umount/evict time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) when using fallocate with FALLOC_FL_KEEP_SIZE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) So, User should assume that fallocated region can be discarded at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) last close if there is memory pressure resulting in eviction of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) the inode from the memory. As a result, for any dependency on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) the fallocated region, user should make sure to recheck fallocate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) after reopening the file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) TODO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) Need to get rid of the raw scanning stuff. Instead, always use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) a get next directory entry approach. The only thing left that uses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) raw scanning is the directory renaming code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) POSSIBLE PROBLEMS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) - vfat_valid_longname does not properly checked reserved names.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) - When a volume name is the same as a directory name in the root
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) directory of the filesystem, the directory name sometimes shows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) up as an empty file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) - autoconv option does not work correctly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) TEST SUITE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) If you plan to make any modifications to the vfat filesystem, please
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) get the test suite that comes with the vfat distribution at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) `<http://web.archive.org/web/*/http://bmrc.berkeley.edu/people/chaffee/vfat.html>`_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) This tests quite a few parts of the vfat filesystem and additional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) tests for new features or untested features would be appreciated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) NOTES ON THE STRUCTURE OF THE VFAT FILESYSTEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) =============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) This documentation was provided by Galen C. Hunt gchunt@cs.rochester.edu and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) lightly annotated by Gordon Chaffee.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) This document presents a very rough, technical overview of my
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) knowledge of the extended FAT file system used in Windows NT 3.5 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) Windows 95. I don't guarantee that any of the following is correct,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) but it appears to be so.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) The extended FAT file system is almost identical to the FAT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) file system used in DOS versions up to and including *6.223410239847*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) :-). The significant change has been the addition of long file names.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) These names support up to 255 characters including spaces and lower
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) case characters as opposed to the traditional 8.3 short names.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) Here is the description of the traditional FAT entry in the current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) Windows 95 filesystem::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) struct directory { // Short 8.3 names
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) unsigned char name[8]; // file name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) unsigned char ext[3]; // file extension
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) unsigned char attr; // attribute byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) unsigned char lcase; // Case for base and extension
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) unsigned char ctime_ms; // Creation time, milliseconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) unsigned char ctime[2]; // Creation time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) unsigned char cdate[2]; // Creation date
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) unsigned char adate[2]; // Last access date
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) unsigned char reserved[2]; // reserved values (ignored)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) unsigned char time[2]; // time stamp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) unsigned char date[2]; // date stamp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) unsigned char start[2]; // starting cluster number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) unsigned char size[4]; // size of the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) The lcase field specifies if the base and/or the extension of an 8.3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) name should be capitalized. This field does not seem to be used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) Windows 95 but it is used by Windows NT. The case of filenames is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) completely compatible from Windows NT to Windows 95. It is not completely
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) compatible in the reverse direction, however. Filenames that fit in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) the 8.3 namespace and are written on Windows NT to be lowercase will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) show up as uppercase on Windows 95.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) .. note:: Note that the ``start`` and ``size`` values are actually little
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) endian integer values. The descriptions of the fields in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) structure are public knowledge and can be found elsewhere.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) With the extended FAT system, Microsoft has inserted extra
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) directory entries for any files with extended names. (Any name which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) legally fits within the old 8.3 encoding scheme does not have extra
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) entries.) I call these extra entries slots. Basically, a slot is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) specially formatted directory entry which holds up to 13 characters of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) a file's extended name. Think of slots as additional labeling for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) directory entry of the file to which they correspond. Microsoft
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) prefers to refer to the 8.3 entry for a file as its alias and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) extended slot directory entries as the file name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) The C structure for a slot directory entry follows::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) struct slot { // Up to 13 characters of a long name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) unsigned char id; // sequence number for slot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) unsigned char name0_4[10]; // first 5 characters in name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) unsigned char attr; // attribute byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) unsigned char reserved; // always 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) unsigned char alias_checksum; // checksum for 8.3 alias
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) unsigned char name5_10[12]; // 6 more characters in name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) unsigned char start[2]; // starting cluster number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) unsigned char name11_12[4]; // last 2 characters in name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) If the layout of the slots looks a little odd, it's only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) because of Microsoft's efforts to maintain compatibility with old
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) software. The slots must be disguised to prevent old software from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) panicking. To this end, a number of measures are taken:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 1) The attribute byte for a slot directory entry is always set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) to 0x0f. This corresponds to an old directory entry with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) attributes of "hidden", "system", "read-only", and "volume
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) label". Most old software will ignore any directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) entries with the "volume label" bit set. Real volume label
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) entries don't have the other three bits set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 2) The starting cluster is always set to 0, an impossible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) value for a DOS file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) Because the extended FAT system is backward compatible, it is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) possible for old software to modify directory entries. Measures must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) be taken to ensure the validity of slots. An extended FAT system can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) verify that a slot does in fact belong to an 8.3 directory entry by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 1) Positioning. Slots for a file always immediately proceed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) their corresponding 8.3 directory entry. In addition, each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) slot has an id which marks its order in the extended file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) name. Here is a very abbreviated view of an 8.3 directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) entry and its corresponding long name slots for the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) "My Big File.Extension which is long"::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) <proceeding files...>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) <slot #3, id = 0x43, characters = "h is long">
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) <slot #2, id = 0x02, characters = "xtension whic">
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) <slot #1, id = 0x01, characters = "My Big File.E">
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) <directory entry, name = "MYBIGFIL.EXT">
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) .. note:: Note that the slots are stored from last to first. Slots
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) are numbered from 1 to N. The Nth slot is ``or'ed`` with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 0x40 to mark it as the last one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 2) Checksum. Each slot has an alias_checksum value. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) checksum is calculated from the 8.3 name using the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) following algorithm::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) for (sum = i = 0; i < 11; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) sum = (((sum&1)<<7)|((sum&0xfe)>>1)) + name[i]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 3) If there is free space in the final slot, a Unicode ``NULL (0x0000)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) is stored after the final character. After that, all unused
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) characters in the final slot are set to Unicode 0xFFFF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) Finally, note that the extended name is stored in Unicode. Each Unicode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) character takes either two or four bytes, UTF-16LE encoded.