1mtools(1) General Commands Manual mtools(1)
2
3
4
6 mtools - utilities to access DOS disks in Unix.
7
8
9
11 Mtools is a collection of tools to allow Unix systems to manipulate MS-
12 DOS files: read, write, and move around files on an MS-DOS file system
13 (typically a floppy disk). Where reasonable, each program attempts to
14 emulate the MS-DOS equivalent command. However, unnecessary restric‐
15 tions and oddities of DOS are not emulated. For instance, it is possi‐
16 ble to move subdirectories from one subdirectory to another.
17
18 Mtools is sufficient to give access to MS-DOS file systems. For
19 instance, commands such as mdir a: work on the a: floppy without any
20 preliminary mounting or initialization (assuming the default
21 `/etc/mtools.conf' works on your machine). With mtools, one can change
22 floppies too without unmounting and mounting.
23
25 Mtools can be found at the following places (and their mirrors):
26
27 http://ftp.gnu.org/gnu/mtools/mtools-4.0.13.tar.gz
28 http://mtools.linux.lu/mtools-4.0.13.tar.gz
29 ftp://www.tux.org/pub/knaff/mtools/mtools-4.0.13.tar.gz
30 ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-4.0.13.tar.gz
31
32
33
34 Before reporting a bug, make sure that it has not yet been fixed in the
35 Alpha patches which can be found at:
36
37 http://ftp.gnu.org/gnu/mtools/
38 http://mtools.linux.lu/
39 ftp://www.tux.org/pub/knaff/mtools
40
41
42
43 These patches are named mtools-version-ddmm.taz, where version stands
44 for the base version, dd for the day and mm for the month. Due to a
45 lack of space, I usually leave only the most recent patch.
46
47 There is an mtools mailing list at mtools @ tux.org . Please send all
48 bug reports to this list. You may subscribe to the list by sending a
49 message with 'subscribe mtools @ tux.org' in its body to majordomo @
50 tux.org . (N.B. Please remove the spaces around the "@" both times. I
51 left them there in order to fool spambots.) Announcements of new
52 mtools versions will also be sent to the list, in addition to the Linux
53 announce newsgroups. The mailing list is archived at
54 http://lists.gnu.org/pipermail/info-mtools/
55
57 Options and filenames
58 MS-DOS filenames are composed of a drive letter followed by a colon, a
59 subdirectory, and a filename. Only the filename part is mandatory, the
60 drive letter and the subdirectory are optional. Filenames without a
61 drive letter refer to Unix files. Subdirectory names can use either the
62 '/' or '\' separator. The use of the '\' separator or wildcards
63 requires the names to be enclosed in quotes to protect them from the
64 shell. However, wildcards in Unix filenames should not be enclosed in
65 quotes, because here we want the shell to expand them.
66
67 The regular expression "pattern matching" routines follow the Unix-
68 style rules. For example, `*' matches all MS-DOS files in lieu of
69 `*.*'. The archive, hidden, read-only and system attribute bits are
70 ignored during pattern matching.
71
72 All options use the - (minus) as their first character, not / as you'd
73 expect in MS-DOS.
74
75 Most mtools commands allow multiple filename parameters, which doesn't
76 follow MS-DOS conventions, but which is more user-friendly.
77
78 Most mtools commands allow options that instruct them how to handle
79 file name clashes. See section name clashes, for more details on these.
80 All commands accept the -V flags which prints the version, and most
81 accept the -v flag, which switches on verbose mode. In verbose mode,
82 these commands print out the name of the MS-DOS files upon which they
83 act, unless stated otherwise. See section Commands, for a description
84 of the options which are specific to each command.
85
86 Drive letters
87 The meaning of the drive letters depends on the target architectures.
88 However, on most target architectures, drive A is the first floppy
89 drive, drive B is the second floppy drive (if available), drive J is a
90 Jaz drive (if available), and drive Z is a Zip drive (if available).
91 On those systems where the device name is derived from the SCSI id, the
92 Jaz drive is assumed to be at SCSI target 4, and the Zip at SCSI target
93 5 (factory default settings). On Linux, both drives are assumed to be
94 the second drive on the SCSI bus (/dev/sdb). The default settings can
95 be changes using a configuration file (see section Configuration).
96
97 The drive letter : (colon) has a special meaning. It is used to access
98 image files which are directly specified on the command line using the
99 -i options.
100
101 Example:
102
103 mcopy -i my-image-file.bin ::file1 ::file2 .
104
105
106
107 This copies file1 and file2 from the image file (my-image-file.bin) to
108 the /tmp directory.
109
110 You can also supply an offset within the image file by including @@off‐
111 set into the file name.
112
113 Example:
114
115 mcopy -i my-image-file.bin@@1M ::file1 ::file2 .
116
117
118
119 This looks for the image at the offset of 1M in the file, rather than
120 at its beginning.
121
122 Current working directory
123 The mcd command (`mcd') is used to establish the device and the current
124 working directory (relative to the MS-DOS file system), otherwise the
125 default is assumed to be A:/. However, unlike MS-DOS, there is only one
126 working directory for all drives, and not one per drive.
127
128 VFAT-style long file names
129 This version of mtools supports VFAT style long filenames. If a Unix
130 filename is too long to fit in a short DOS name, it is stored as a VFAT
131 long name, and a companion short name is generated. This short name is
132 what you see when you examine the disk with a pre-7.0 version of DOS.
133 The following table shows some examples of short names:
134
135 Long name MS-DOS name Reason for the change
136 --------- ---------- ---------------------
137 thisisatest THISIS~1 filename too long
138 alain.knaff ALAIN~1.KNA extension too long
139 prn.txt PRN~1.TXT PRN is a device name
140 .abc ABC~1 null filename
141 hot+cold HOT_CO~1 illegal character
142
143
144
145 As you see, the following transformations happen to derive a short
146 name:
147
148 * Illegal characters are replaced by underscores. The illegal
149 characters are ;+=[]',\"*\\<>/?:|.
150
151 * Extra dots, which cannot be interpreted as a main name/extension
152 separator are removed
153
154 * A ~n number is generated,
155
156 * The name is shortened so as to fit in the 8+3 limitation
157
158 The initial Unix-style file name (whether long or short) is also
159 called the primary name, and the derived short name is also called the
160 secondary name.
161
162 Example:
163
164 mcopy /etc/motd a:Reallylongname
165
166 Mtools creates a VFAT entry for Reallylongname, and uses REALLYLO as a
167 short name. Reallylongname is the primary name, and REALLYLO is the
168 secondary name.
169
170 mcopy /etc/motd a:motd
171
172 Motd fits into the DOS filename limits. Mtools doesn't need to
173 derivate another name. Motd is the primary name, and there is no sec‐
174 ondary name.
175
176 In a nutshell: The primary name is the long name, if one exists, or
177 the short name if there is no long name.
178
179 Although VFAT is much more flexible than FAT, there are still names
180 that are not acceptable, even in VFAT. There are still some illegal
181 characters left (\"*\\<>/?:|), and device names are still reserved.
182
183 Unix name Long name Reason for the change
184 --------- ---------- ---------------------
185 prn prn-1 PRN is a device name
186 ab:c ab_c-1 illegal character
187
188
189
190 As you see, the following transformations happen if a long name is
191 illegal:
192
193 * Illegal characters are replaces by underscores,
194
195 * A -n number is generated,
196
197 Name clashes
198 When writing a file to disk, its long name or short name may collide
199 with an already existing file or directory. This may happen for all
200 commands which create new directory entries, such as mcopy, mmd, mren,
201 mmove. When a name clash happens, mtools asks you what it should do. It
202 offers several choices:
203
204 overwrite
205 Overwrites the existing file. It is not possible to overwrite a
206 directory with a file.
207
208 rename
209 Renames the newly created file. Mtools prompts for the new file‐
210 name
211
212 autorename
213 Renames the newly created file. Mtools chooses a name by itself,
214 without prompting
215
216 skip Gives up on this file, and moves on to the next (if any)
217
218 To chose one of these actions, type its first letter at the prompt. If
219 you use a lower case letter, the action only applies for this file
220 only, if you use an upper case letter, the action applies to all files,
221 and you won't be prompted again.
222
223 You may also chose actions (for all files) on the command line, when
224 invoking mtools:
225
226 -D o Overwrites primary names by default.
227
228 -D O Overwrites secondary names by default.
229
230 -D r Renames primary name by default.
231
232 -D R Renames secondary name by default.
233
234 -D a Autorenames primary name by default.
235
236 -D A Autorenames secondary name by default.
237
238 -D s Skip primary name by default.
239
240 -D S Skip secondary name by default.
241
242 -D m Ask user what to do with primary name.
243
244 -D M Ask user what to do with secondary name.
245
246 Note that for command line switches lower/upper differentiates between
247 primary/secondary name whereas for interactive choices, lower/upper
248 differentiates between just-this-time/always.
249
250 The primary name is the name as displayed in Windows 95 or Windows NT:
251 i.e. the long name if it exists, and the short name otherwise. The
252 secondary name is the "hidden" name, i.e. the short name if a long name
253 exists.
254
255 By default, the user is prompted if the primary name clashes, and the
256 secondary name is autorenamed.
257
258 If a name clash occurs in a Unix directory, mtools only asks whether to
259 overwrite the file, or to skip it.
260
261 Case sensitivity of the VFAT file system
262 The VFAT file system is able to remember the case of the filenames.
263 However, filenames which differ only in case are not allowed to coexist
264 in the same directory. For example if you store a file called LongFile‐
265 Name on a VFAT file system, mdir shows this file as LongFileName, and
266 not as Longfilename. However, if you then try to add LongFilename to
267 the same directory, it is refused, because case is ignored for clash
268 checks.
269
270 The VFAT file system allows to store the case of a filename in the
271 attribute byte, if all letters of the filename are the same case, and
272 if all letters of the extension are the same case too. Mtools uses this
273 information when displaying the files, and also to generate the Unix
274 filename when mcopying to a Unix directory. This may have unexpected
275 results when applied to files written using an pre-7.0 version of DOS:
276 Indeed, the old style filenames map to all upper case. This is differ‐
277 ent from the behavior of the old version of mtools which used to gener‐
278 ate lower case Unix filenames.
279
280 high capacity formats
281 Mtools supports a number of formats which allow to store more data on
282 disk as usual. Due to different operating system abilities, these for‐
283 mats are not supported on all operating systems. Mtools recognizes
284 these formats transparently where supported.
285
286 In order to format these disks, you need to use an operating system
287 specific tool. For Linux, suitable floppy tools can be found in the
288 fdutils package at the following locations~:
289
290 ftp://www.tux.org/pub/knaff/fdutils/.
291 ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/fdutils-*
292
293
294
295 See the manual pages included in that package for further detail: Use
296 superformat to format all formats except XDF, and use xdfcopy to format
297 XDF.
298
299 More sectors
300 The oldest method of fitting more data on a disk is to use more sectors
301 and more cylinders. Although the standard format uses 80 cylinders and
302 18 sectors (on a 3 1/2 high density disk), it is possible to use up to
303 83 cylinders (on most drives) and up to 21 sectors. This method allows
304 to store up to 1743K on a 3 1/2 HD disk. However, 21 sector disks are
305 twice as slow as the standard 18 sector disks because the sectors are
306 packed so close together that we need to interleave them. This problem
307 doesn't exist for 20 sector formats.
308
309 These formats are supported by numerous DOS shareware utilities such as
310 fdformat and vgacopy. In his infinite hubris, Bill Gate$ believed that
311 he invented this, and called it `DMF disks', or `Windows formatted
312 disks'. But in reality, it has already existed years before! Mtools
313 supports these formats on Linux, on SunOS and on the DELL Unix PC.
314
315 Bigger sectors
316 By using bigger sectors it is possible to go beyond the capacity which
317 can be obtained by the standard 512-byte sectors. This is because of
318 the sector header. The sector header has the same size, regardless of
319 how many data bytes are in the sector. Thus, we save some space by
320 using fewer, but bigger sectors. For example, 1 sector of 4K only takes
321 up header space once, whereas 8 sectors of 512 bytes have also 8 head‐
322 ers, for the same amount of useful data.
323
324 This method allows to store up to 1992K on a 3 1/2 HD disk.
325
326 Mtools supports these formats only on Linux.
327
328 2m
329 The 2m format was originally invented by Ciriaco Garcia de Celis. It
330 also uses bigger sectors than usual in order to fit more data on the
331 disk. However, it uses the standard format (18 sectors of 512 bytes
332 each) on the first cylinder, in order to make these disks easier to
333 handle by DOS. Indeed this method allows to have a standard sized boot
334 sector, which contains a description of how the rest of the disk should
335 be read.
336
337 However, the drawback of this is that the first cylinder can hold less
338 data than the others. Unfortunately, DOS can only handle disks where
339 each track contains the same amount of data. Thus 2m hides the fact
340 that the first track contains less data by using a shadow FAT. (Usu‐
341 ally, DOS stores the FAT in two identical copies, for additional
342 safety. XDF stores only one copy, but tells DOS that it stores two.
343 Thus the space that would be taken up by the second FAT copy is saved.)
344 This also means that you should never use a 2m disk to store anything
345 else than a DOS file system.
346
347 Mtools supports these formats only on Linux.
348
349 XDF
350 XDF is a high capacity format used by OS/2. It can hold 1840 K per
351 disk. That's lower than the best 2m formats, but its main advantage is
352 that it is fast: 600 milliseconds per track. That's faster than the 21
353 sector format, and almost as fast as the standard 18 sector format. In
354 order to access these disks, make sure mtools has been compiled with
355 XDF support, and set the use_xdf variable for the drive in the configu‐
356 ration file. See section Compiling mtools, and `miscellaneous vari‐
357 ables', for details on how to do this. Fast XDF access is only avail‐
358 able for Linux kernels which are more recent than 1.1.34.
359
360 Mtools supports this format only on Linux.
361
362 Caution / Attention distributors: If mtools is compiled on a Linux ker‐
363 nel more recent than 1.3.34, it won't run on an older kernel. However,
364 if it has been compiled on an older kernel, it still runs on a newer
365 kernel, except that XDF access is slower. It is recommended that dis‐
366 tribution authors only include mtools binaries compiled on kernels
367 older than 1.3.34 until 2.0 comes out. When 2.0 will be out, mtools
368 binaries compiled on newer kernels may (and should) be distributed.
369 Mtools binaries compiled on kernels older than 1.3.34 won't run on any
370 2.1 kernel or later.
371
372 Exit codes
373 All the Mtools commands return 0 on success, 1 on utter failure, or 2
374 on partial failure. All the Mtools commands perform a few sanity
375 checks before going ahead, to make sure that the disk is indeed an MS-
376 DOS disk (as opposed to, say an ext2 or MINIX disk). These checks may
377 reject partially corrupted disks, which might otherwise still be read‐
378 able. To avoid these checks, set the MTOOLS_SKIP_CHECK environmental
379 variable or the corresponding configuration file variable (see section
380 global variables)
381
382 Bugs
383 An unfortunate side effect of not guessing the proper device (when mul‐
384 tiple disk capacities are supported) is an occasional error message
385 from the device driver. These can be safely ignored.
386
387 The fat checking code chokes on 1.72 Mb disks mformatted with pre-2.0.7
388 mtools. Set the environmental variable MTOOLS_FAT_COMPATIBILITY (or the
389 corresponding configuration file variable, `global variables') to
390 bypass the fat checking.
391
393 floppyd_installtest mattrib mbadblocks mcd mclasserase mcopy mdel mdel‐
394 tree mdir mdu mformat minfo mkmanifest mlabel mmd mmount mmove mrd mren
395 mtoolstest mtype
396
397
398
399mtools-4.0.13 28Feb10 mtools(1)