Chinese translated version of Documentation/vfat filesystem
If you have any comment or update to the content, please contact the
original document maintainer directly. However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help. Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.
Chinese maintainer: 406574655@qq.com---------------------------------------------------------------------
vfat filesystem 的中文翻译
如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。
中文版维护者: 王超 406574655@qq.com
中文版翻译者: 王超 406574655@qq.com
中文版校译者: 王超 406574655@qq.com
以下为正文
USING VFAT
2----------------------------------------------------------------------
3To use the vfat filesystem, use the filesystem type 'vfat'. i.e.
4 mount -t vfat /dev/fd0 /mnt
5
6No special partition formatter is required. mkdosfs will work fine
7if you want to format from within Linux.
8
9VFAT MOUNT OPTIONS
10----------------------------------------------------------------------
11uid=### -- Set the owner of all files on this filesystem.
12 The default is the uid of current process.
设置这个文件系统上的所有文件的所有者。
默认值是当前进程的uid。
13
14gid=### -- Set the group of all files on this filesystem.
15 The default is the gid of current process.
设置这个文件系统上的所有文件组。
默认为GID当前进程。
16
17umask=### -- The permission mask (for files and directories, see umask(1)).
18 The default is the umask of current process.
权限掩码(文件和目录,umask(1))。
默认值是当前进程的umask..
19
20dmask=### -- The permission mask for the directory.
21 The default is the umask of current process.
目录的权限掩码。
默认值是当前进程的umask
22
23fmask=### -- The permission mask for files.
24 The default is the umask of current process.
文件的权限掩码
默认值是当前进程的umask
25
26allow_utime=### -- This option controls the permission check of mtime/atime.
27 该选项控制的mtime/ atime的权限检查
28 20 - If current process is in group of file's group ID,
29 you can change timestamp.
如果当前的进程是在一组文件的组ID,你可以改变的时间戳。
30 2 - Other users can change timestamp.
31 其他用户可以更改时间戳
32 The default is set from `dmask' option. (If the directory is
33 writable, utime(2) is also allowed. I.e. ~dmask & 022)
34 从`DMASK'选项默认设置。 (如果该目录可写的,UTIME(2)也是允许的。即〜DMASK022)
35 Normally utime(2) checks current process is owner of
36 the file, or it has CAP_FOWNER capability. But FAT
37 filesystem doesn't have uid/gid on disk, so normal
38 check is too unflexible. With this option you can
39 relax it.
通常情况下,UTIME(2)检查当前进程的文件的所有者,或它有CAP_FOWNER能力。
但是,FAT文件系统不在UID / GID磁盘上,所以正常检查是太不易改变。
使用此选项,您可以改变它
40
41codepage=### -- Sets the codepage number for converting to shortname
42 characters on FAT filesystem.
43 By default, FAT_DEFAULT_CODEPAGE setting is used.
44 在FAT文件系统转换为短名称字符设置的代码页。
默认情况下,使用FAT_DEFAULT_CODEPAGE设置
45iocharset=<name> -- Character set to use for converting between the
46 encoding is used for user visible filename and 16 bit
47 Unicode characters. Long filenames are stored on disk
48 in Unicode format, but Unix for the most part doesn't
49 know how to deal with Unicode.
50 By default, FAT_DEFAULT_IOCHARSET setting is used.
51 字符设置用于编码之间的转换,用于用户可见的文件名和16位的Unicode字符。
长文件名的Unicode格式存储在磁盘中,但大部分的Unix不知道如何处理与Unicode。
默认情况下,使用FAT_DEFAULT_IOCHARSET设置。
52 There is also an option of doing UTF-8 translations
53 with the utf8 option.
还有一个选项做UTF-8的翻译用utf8选项
54
55 NOTE: "iocharset=utf8" is not recommended. If unsure,
56 you should consider the following option instead.
注:“iocharset= utf8的”不推荐使用。如果不确定的话,你应该考虑以下选项。
57
58utf8=<bool> -- UTF-8 is the filesystem safe version of Unicode that
59 is used by the console. It can be enabled for the
60 filesystem with this option. If 'uni_xlate' gets set,
61 UTF-8 gets disabled.
UTF-8是Unicode版本所使用的控制台文件系统的安全。它可以启用此选项的文件系统。如果'uni_xlate'被设置,UTF-8被禁用。
62
63uni_xlate=<bool> -- Translate unhandled Unicode characters to special
64 escaped sequences. This would let you backup and
65 restore filenames that are created with any Unicode
66 characters. Until Linux supports Unicode for real,
67 this gives you an alternative. Without this option,
68 a '?' is used when no translation is possible. The
69 escape character is ':' because it is otherwise
70 illegal on the vfat filesystem. The escape sequence
71 that gets used is ':' and the four digits of hexadecimal
72 unicode.
翻译未处理的Unicode字符特殊转义序列。这会让你备份和恢复所建立的任何Unicode文件名字符。直到Linux支持真实的Unicode,
这为您提供了一种替代方法。没有这样一种选项:一个'?'不可能转换时使用。该转义字符是':'否则在VFAT文件系统上是非法的。
转义序列通常是“:”和4位十六进制unicode的。
73
74nonumtail=<bool> -- When creating 8.3 aliases, normally the alias will
75 end in '~1' or tilde followed by some number. If this
76 option is set, then if the filename is
77 "longfilename.txt" and "longfile.txt" does not
78 currently exist in the directory, 'longfile.txt' will
79 be the short alias instead of 'longfi~1.txt'.
当创建8.3别名,通常是通过一些数字的别名在'~1'或波浪线结束。如果设置了此选项,那么如果文件名是“longfilename.txt”和
“longfile.txt的”目前不存在于目录中,“longfile.txt”将是简写的别名,而不是'LONGFI〜1.TXT。
80
81usefree -- Use the "free clusters" value stored on FSINFO. It'll
82 be used to determine number of free clusters without
83 scanning disk. But it's not used by default, because
84 recent Windows don't update it correctly in some
85 case. If you are sure the "free clusters" on FSINFO is
86 correct, by this option you can avoid scanning disk.
87 使用“集群”的数值存储在FSINFO上。它会被用来确定免费集群而不扫描磁盘数量。但它不是默认情况下使用,
因为最新的Windows在某些方面不会正确地改正它。如果你确保“自由集群”FSINFO是正确的,通过此选项,您可避免扫描磁盘。
88quiet -- Stops printing certain warning messages.
停止打印某些警告信息
89
90check=s|r|n -- Case sensitivity checking setting. 区分大小写检查设置
91 s: strict, case sensitive 严格区分大小写
92 r: relaxed, case insensitive 相对灵活的区分大小写
93 n: normal, default setting, currently case insensitive 正常,默认设置,目前不区分大小写
94
95nocase -- This was deprecated for vfat. Use shortname=win95 instead.
96 使用Use shortname=win95 instead,在vfat中是被废弃的。
97shortname=lower|win95|winnt|mixed 简写=更低级的系统|win95|winnt|混合系统
98 -- Shortname display/create setting.SHORTNAME显示/创建设置。
99 lower: convert to lowercase for display, 更低级操作系统:转换为小写显示
100 lower: emulate the Windows 95 rule for create.模仿Windows 95的创建规则。
101 win95: emulate the Windows 95 rule for display/create.模拟显示/创建Windows 95的规则
102 winnt: emulate the Windows NT rule for display/create.模拟Windows NT的规则来显示/创建
103 mixed: emulate the Windows NT rule for display,模拟Windows NT的规则来显示
104 emulate the Windows 95 rule for create.模仿Windows 95的规则来创建
105 Default setting is `mixed'.默认设置是“混合系统”
106
107tz=UTC -- Interpret timestamps as UTC rather than local time.解读时间戳为UTC而不是本地时间
108 This option disables the conversion of timestamps
109 between local time (as used by Windows on FAT) and UTC
110 (which Linux uses internally). This is particularly
111 useful when mounting devices (like digital cameras)
112 that are set to UTC in order to avoid the pitfalls of
113 local time.
此选项禁用时间戳本地时间(如Windows所使用的FAT)和UTC(Linux使用内部)之间的转换。
在安装设备(如数码相机)时避免缺陷的本地时间被设置为UTC时是特别有用的
114time_offset=minutes time_offset=分钟
115 -- Set offset for conversion of timestamps from local time
116 used by FAT to UTC. I.e. <minutes> minutes will be subtracted
117 from each timestamp to convert it to UTC used internally by
118 Linux. This is useful when time zone set in sys_tz is
119 not the time zone used by the filesystem. Note that this
120 option still does not provide correct time stamps in all
121 cases in presence of DST - time stamps in a different DST
122 setting will be off by one hour.
为FAT从本地时间为UTC时间戳的转换设置偏移,即每个时间戳<minutes>分钟将会被扣除,将其转换为Linux内部使用的UTC。
对于时区设置在sys_tz不是由文件系统使用的时区,这是非常有用的。请注意这个选项仍然没有在DST的所有情况下提供正确的时间戳记
时间戳在不同的DST设定将关闭一小时。
123
124showexec -- If set, the execute permission bits of the file will be
125 allowed only if the extension part of the name is .EXE,
126 .COM, or .BAT. Not set by default.
如果要设置,如果扩展名称的一部分将被允许执行权限位的文件是EXE,COM或.BAT。而不是默认设置.
127
128debug -- Can be set, but unused by the current implementation.
可以任意设置,但在当前的视线中未被使用。
129
130sys_immutable -- If set, ATTR_SYS attribute on FAT is handled as
131 IMMUTABLE flag on Linux. Not set by default.
在Linux下如果要设置,ATTR_SYS在FAT中的属性将被操作为不改变的标志,而不是默认设置。
132
133flush -- If set, the filesystem will try to flush to disk more
134 early than normal. Not set by default.
如果设置,文件系统将尝试写入到磁盘比正常更早期。而不是默认设置。
135
136rodir -- FAT has the ATTR_RO (read-only) attribute. On Windows,
137 the ATTR_RO of the directory will just be ignored,
138 and is used only by applications as a flag (e.g. it's set
139 for the customized folder).
FAT 有只读属性,在windows系统中目录的只读属性被忽略,而只是被用来作为应用程序的一个标志(例如,它被设置为自定义的文件夹)
140
141 If you want to use ATTR_RO as read-only flag even for
142 the directory, set this option.
143 如果你仅仅是为目录把ATTR_RO 设置只读属性,设置这个选项。
144errors=panic|continue|remount-ro
145 -- specify FAT behavior on critical errors: panic, continue
146 without doing anything or remount the partition in
147 read-only mode (default behavior).
148 指定FAT在关键错误时的行为:恐慌,不做任何事情或者重新安装分区在只读模式(默认行为)而继续。
149discard -- If set, issues discard/TRIM commands to the block
150 device when blocks are freed. This is useful for SSD devices
151 and sparse/thinly-provisoned LUNs.
152 如果设置,在数据块被释放后发布对块的丢弃/修剪命令,这对于SSD设备和稀疏/ thinly-provisoned LUNs是很有用的
153nfs=stale_rw|nostale_ro
154 Enable this only if you want to export the FAT filesystem
155 over NFS.
如果你想通过NFS导出FAT文件系统,启用这项。
156
157 stale_rw: This option maintains an index (cache) of directory
158 inodes by i_logstart which is used by the nfs-related code to
159 improve look-ups. Full file operations (read/write) over NFS is
160 supported but with cache eviction at NFS server, this could
161 result in ESTALE issues.
这个选项通过i_logstart用来维护目录的索引节点,具体是使用nfs相关代码来提高查询。完整的文件操作(读/写)通过NFS是支持的,
但缓存回收在NFS服务器,这可能导致ESTALE问题。
162
163 nostale_ro: This option bases the inode number and filehandle
164 on the on-disk location of a file in the MS-DOS directory entry.
165 This ensures that ESTALE will not be returned after a file is
166 evicted from the inode cache. However, it means that operations
167 such as rename, create and unlink could cause filehandles that
168 previously pointed at one file to point at a different file,
169 potentially causing data corruption. For this reason, this
170 option also mounts the filesystem readonly.
这个选项基于inode编号和文件句柄在磁盘上的一个文件在ms - dos目录条目的位置。这将确保ESTALE不会返回一个文件后清空inode缓存。
然而,这意味着操作,如重命名,创建和分离可能导致文件以前指着一个文件指向一个不同的文件,这可能导致数据丢失。由于这个原因,这个选项也只读文件系统挂载。
171
172 To maintain backward compatibility, is also accepted,
173 defaulting to stale_rw
174 为了保持向后兼容性,'-o nfs'也被接受 ,默认为陈旧rw
175
176<bool>: 0,1,yes,no,true,false
177
178TODO
179----------------------------------------------------------------------
180* Need to get rid of the raw scanning stuff. Instead, always use
181 a get next directory entry approach. The only thing left that uses
182 raw scanning is the directory renaming code.
183 需要摆脱原始扫描的东西。相反,通常使用一个得到下一个目录条目的方法。留下的唯一的是使用原始扫描目录重命名代码。
184
185POSSIBLE PROBLEMS
186----------------------------------------------------------------------
187* vfat_valid_longname does not properly checked reserved names.
188* When a volume name is the same as a directory name in the root
189 directory of the filesystem, the directory name sometimes shows
190 up as an empty file.
191* autoconv option does not work correctly.
vfat_valid_longname不正确检查保留名称。
当一个真实的名字和文件系统的根目录的名称是一样的时候目录名有时显示作为一个空文件。
autoconv选项不正确工作。
192
193BUG REPORTS
194----------------------------------------------------------------------
195 If you have trouble with the VFAT filesystem, mail bug reports to
196 chaffee@bmrc.cs.berkeley.edu. Please specify the filename
197 and the operation that gave you trouble.
如果你的VFAT文件系统有问题,邮件错误向chaffee@bmrc.cs.berkeley.edu报告。请指定给你带来麻烦的文件名和操作,。
198
199 TEST SUITE
200----------------------------------------------------------------------
201 If you plan to make any modifications to the vfat filesystem, please
202 get the test suite that comes with the vfat distribution at
203
204 http://web.archive.org/web/*/http://bmrc.berkeley.edu/
205 people/chaffee/vfat.html
如果您打算进行任何修改的VFAT文件系统,请获得来自分配在http://web.archive.org/web/*/http://bmrc.berkeley.edu/people/chaffee/vfat.html的测试套件
206
207 This tests quite a few parts of the vfat filesystem and additional
208 tests for new features or untested features would be appreciated.
这个测试相当一部分的VFAT文件系统的新功能或未经测试的功能和额外的测试是比较好的。
209
210NOTES ON THE STRUCTURE OF THE VFAT FILESYSTEM
附注VFAT文件系统的结构
211----------------------------------------------------------------------
212(This documentation was provided by Galen C. Hunt <gchunt@cs.rochester.edu>
213 and lightly annotated by Gordon Chaffee).
214
215 This document presents a very rough, technical overview of my
216 knowledge of the extended FAT file system used in Windows NT 3.5 and
217 Windows 95. I don't guarantee that any of the following is correct,
218 but it appears to be so.
这个文档提供了一个很粗糙的和一个关于在Windows NT 3.5 和Windows 95下的拓展的FAT文件系统的技术概述.
219
220 The extended FAT file system is almost identical to the FAT
221 file system used in DOS versions up to and including 6.223410239847
222 The significant change has been the addition of long file names.
223 These names support up to 255 characters including spaces and lower
224 case characters as opposed to the traditional 8.3 short names.
225 扩展FAT文件系统几乎是相同的FAT文件系统的DOS版本,包括6.223410239847
222 显著的变化已经增加了长文件名。这些名字,最多支持255个字符,包括空格和小写字符,而不是传统的8.3短名称。
226 Here is the description of the traditional FAT entry in the current
227 Windows 95 filesystem:
下面是传统的在目前的Windows95的文件系统的FAT条目的描述:
228
229 struct directory { // Short 8.3 names
230 unsigned char name[8]; // file name
231 unsigned char ext[3]; // file extension
232 unsigned char attr; // attribute byte
233 unsigned char lcase; // Case for base and extension
234 unsigned char ctime_ms; // Creation time, milliseconds
235 unsigned char ctime[2]; // Creation time
236 unsigned char cdate[2]; // Creation date
237 unsigned char adate[2]; // Last access date
238 unsigned char reserved[2]; // reserved values (ignored)
239 unsigned char time[2]; // time stamp
240 unsigned char date[2]; // date stamp
241 unsigned char start[2]; // starting cluster number
242 unsigned char size[4]; // size of the file
243 };
244
245 The lcase field specifies if the base and/or the extension of an 8.3
246 name should be capitalized. This field does not seem to be used by
247 Windows 95 but it is used by Windows NT. The case of filenames is not
248 completely compatible from Windows NT to Windows 95. It is not completely
249 compatible in the reverse direction, however. Filenames that fit in
250 the 8.3 namespace and are written on Windows NT to be lowercase will
251 show up as uppercase on Windows 95.
如果基和/或延长8.3LCASE字段指定应予大写。此字段似乎并不由Windows 95中使用,
但使用它的Windows NT。文件名的情况下,从Windows NT到Windows 95不完全兼容。
在相反的方向不完全兼容的,但是,8.3命名空间和适合在Windows NT上写小写的文件名会显示为大写:在Windows 95中。
252
253 Note that the "start" and "size" values are actually little
254 endian integer values. The descriptions of the fields in this
255 structure are public knowledge and can be found elsewhere.
请注意,在“开始”和“大小”值实际上是little endian的整数值。该结构中的描述是公共知识,并可以在别处找到。
256
257 With the extended FAT system, Microsoft has inserted extra
258 directory entries for any files with extended names. (Any name which
259 legally fits within the old 8.3 encoding scheme does not have extra
260 entries.) I call these extra entries slots. Basically, a slot is a
261 specially formatted directory entry which holds up to 13 characters of
262 a file's extended name. Think of slots as additional labeling for the
263 directory entry of the file to which they correspond. Microsoft
264 prefers to refer to the 8.3 entry for a file as its alias and the
265 extended slot directory entries as the file name.
使用的扩展FAT系统,微软已经插入额外的目录条目的任何文件扩展名。
(合法适合于旧的8.3的编码方案的任何名称,没有额外的条目。)
我把这些额外的条目插槽。基本上,一个槽是一个特殊格式的目录条目,最多可容纳13个字符的文件的扩展名。
试想插槽作为额外的标签文件,它们对应的目录条目。微软喜欢参阅8.3作为其别名,扩展槽作为文件名的目录条目的文件条目。
266
267The C structure for a slot directory entry follows:
268
269 struct slot { // Up to 13 characters of a long name
270 unsigned char id; // sequence number for slot
271 unsigned char name0_4[10]; // first 5 characters in name
272 unsigned char attr; // attribute byte
273 unsigned char reserved; // always 0
274 unsigned char alias_checksum; // checksum for 8.3 alias
275 unsigned char name5_10[12]; // 6 more characters in name
276 unsigned char start[2]; // starting cluster number
277 unsigned char name11_12[4]; // last 2 characters in name
278 };
279
280 If the layout of the slots looks a little odd, it's only
281 because of Microsoft's efforts to maintain compatibility with old
282 software. The slots must be disguised to prevent old software from
283 panicking. To this end, a number of measures are taken:
284 如果插槽的布局看起来有点古怪,它只是因为微软的努力以保持与旧软件的兼容性。插槽必须伪装以防止在旧的软件恐慌。为此,采取了若干措施
285 1) The attribute byte for a slot directory entry is always set
286 to 0x0f. This corresponds to an old directory entry with
287 attributes of "hidden", "system", "read-only", and "volume
288 label". Most old software will ignore any directory
289 entries with the "volume label" bit set. Real volume label
290 entries don't have the other three bits set.
换一个插槽目录条目属性字节总是被设置为0x0F。这相当于旧目录条目属性的“隐藏”,“系统”,“只读”和“卷标”。
最早的软件将忽略任何目录条目“卷标”位设置。实际卷拉贝条目没有其他三个位设置。
291
292 2) The starting cluster is always set to 0, an impossible
293 value for a DOS file.
总是被设置为0,不可能是一个DOS文件的起始簇
294
295 Because the extended FAT system is backward compatible, it is
296 possible for old software to modify directory entries. Measures must
297 be taken to ensure the validity of slots. An extended FAT system can
298 verify that a slot does in fact belong to an 8.3 directory entry by
299 the following:
因为扩展的FAT系统是向后兼容的,它有可能为旧的软件来修改目录项。必须采取措施以确保槽的有效性。
扩展FAT系统可以验证某个插槽确实属于为8.3目录条目由以下:
300
301 1) Positioning. Slots for a file always immediately proceed
302 their corresponding 8.3 directory entry. In addition, each
303 slot has an id which marks its order in the extended file
304 name. Here is a very abbreviated view of an 8.3 directory
305 entry and its corresponding long name slots for the file
306 "My Big File.Extension which is long":
定位。插槽的文件总是立即进行相应的8.3目录条目。此外,每个插槽都有一个id,这标志着其扩展文件名的顺序。
这里是一个非常缩略视图8.3目录条目及其相应的文件“My Big File.Extension which is long”长名称插槽
307
308 <proceeding files...>
309 <slot #3, id = 0x43, characters = "h is long">
310 <slot #2, id = 0x02, characters = "xtension which">
311 <slot #1, id = 0x01, characters = "My Big File.E">
312 <directory entry, name = "MYBIGFIL.EXT">
313
314 Note that the slots are stored from last to first. Slots
315 are numbered from 1 to N. The Nth slot is or'ed with 0x40
316 to mark it as the last one.
需要注意的是插槽的存储从最后到第一。插槽编号从1到N,或者与0x40第n个插槽将其标记为最后一个。
317
318 2) Checksum. Each slot has an "alias_checksum" value. The
319 checksum is calculated from the 8.3 name using the
320 following algorithm:
321 校验。每个插槽一个的“alias_checksum”值。校验和计算的8.3名使用下面的算法
322 for (sum = i = 0; i < 11; i++) {
323 sum = (((sum&1)<<7)|((sum&0xfe)>>1)) + name[i]
324 }
325
326 3) If there is free space in the final slot, a Unicode NULL (0x0000)
327 is stored after the final character. After that, all unused
328 characters in the final slot are set to Unicode 0xFFFF.
在最后的插槽,如果有免费的空间,一个Unicode空(0x0000)存储后的最后一个字符。
在那之后,所有未使用的字符在最后的插槽设置为Unicode0XFFFF
329
330 Finally, note that the extended name is stored in Unicode. Each Unicode
331 character takes two bytes.
最后,注意扩展名中以Unicode存储。每个Unicode字符需要两个字节。
332