Debian Codegraph @

upstream/opensuse-leap-16-1/man1/mtools.1

raw
1 '\" t
2 .TH mtools 1 "28Sep24" mtools-4.0.45
3 .SH Name
4 mtools - utilities to access DOS disks in Unix.
5 '\" t
6 .de TQ
7 .br
8 .ns
9 .TP \\$1
10 ..
11
12 .tr \(is'
13 .tr \(if`
14 .tr \(pd"
15
16 .PP
17 .SH Introduction
18 Mtools is a collection of tools to allow Unix systems to manipulate
19 MS-DOS files: read, write, and move around files on an MS-DOS
20 file system (typically a floppy disk). Where reasonable, each program
21 attempts to emulate the MS-DOS equivalent command. However,
22 unnecessary restrictions and oddities of DOS are not emulated. For
23 instance, it is possible to move subdirectories from one subdirectory
24 to another.
25 .PP
26 Mtools is sufficient to give access to MS-DOS file systems. For
27 instance, commands such as \fR\&\f(CWmdir a:\fR work on the \fR\&\f(CWa:\fR floppy
28 without any preliminary mounting or initialization (assuming the default
29 \&\fR\&\f(CW\(if/etc/mtools.conf\(is\fR works on your machine). With mtools, one can
30 change floppies too without unmounting and mounting.
31 .PP
32 .SH Where\ to\ get\ mtools
33 .PP
34 Mtools can be found at the following places (and their mirrors):
35
36 .nf
37 .ft 3
38 .in +0.3i
39 http://ftp.gnu.org/gnu/mtools/mtools-4.0.45.tar.gz
40 .fi
41 .in -0.3i
42 .ft R
43 .PP
44
45 \&\fR
46 .PP
47 These patches are named
48 \&\fR\&\f(CWmtools-\fR\fIversion\fR\fR\&\f(CW-\fR\fIddmm\fR\fR\&\f(CW.taz\fR, where version
49 stands for the base version, \fIdd\fR for the day and \fImm\fR for the
50 month. Due to a lack of space, I usually leave only the most recent
51 patch.
52 .PP
53 There is an mtools mailing list at info-mtools @ gnu.org . Please
54 send all bug reports to this list. You may subscribe to the list at
55 https://lists.gnu.org/mailman/listinfo/info-mtools. (N.B. Please
56 remove the spaces around the "@". I left them there in order to fool
57 spambots.) Announcements of new mtools versions will also be sent to
58 the list, in addition to the Linux announce newsgroups. The mailing
59 list is archived at http://lists.gnu.org/pipermail/info-mtools/
60 .PP
61 .SH Common\ features\ of\ all\ mtools\ commands
62 .PP
63 .SS Options\ and\ filenames
64 MS-DOS filenames are composed of a drive letter followed by a colon, a
65 subdirectory, and a filename. Only the filename part is mandatory, the
66 drive letter and the subdirectory are optional. Filenames without a
67 drive letter refer to Unix files. Subdirectory names can use either the
68 \&'\fR\&\f(CW/\fR' or '\fR\&\f(CW\e\fR' separator. The use of the '\fR\&\f(CW\e\fR' separator
69 or wildcards requires the names to be enclosed in quotes to protect them
70 from the shell. However, wildcards in Unix filenames should not be
71 enclosed in quotes, because here we \fBwant\fR the shell to expand
72 them.
73 .PP
74 The regular expression "pattern matching" routines follow the Unix-style
75 rules. For example, `\fR\&\f(CW*\fR' matches all MS-DOS files in lieu of
76 `\fR\&\f(CW*.*\fR'. The archive, hidden, read-only and system attribute bits
77 are ignored during pattern matching.
78 .PP
79 All options use the \fR\&\f(CW-\fR (minus) as their first character, not
80 \&\fR\&\f(CW/\fR as you'd expect in MS-DOS.
81 .PP
82 Most mtools commands allow multiple filename parameters, which
83 doesn't follow MS-DOS conventions, but which is more user-friendly.
84 .PP
85 Most mtools commands allow options that instruct them how to handle
86 file name clashes. See section name clashes, for more details on these.
87 .PP
88 All commands accept the \fR\&\f(CW-i\fR flag which allows to specify an
89 image file (See section drive letters).
90 .PP
91 All commands accept the \fR\&\f(CW-V\fR flag which prints the version, and
92 most accept the \fR\&\f(CW-v\fR flag, which switches on verbose mode. In
93 verbose mode, these commands print out the name of the MS-DOS files
94 upon which they act, unless stated otherwise. See section Commands, for a
95 description of the options which are specific to each command.
96 .PP
97 .SS Drive\ letters
98 .PP
99 The meaning of the drive letters depends on the target architectures.
100 However, on most target architectures, drive A is the first floppy
101 drive, drive B is the second floppy drive (if available), drive J is a
102 Jaz drive (if available), and drive Z is a Zip drive (if available). On
103 those systems where the device name is derived from the SCSI id, the Jaz
104 drive is assumed to be at SCSI target 4, and the Zip at SCSI target 5
105 (factory default settings). On Linux, both drives are assumed to be the
106 second drive on the SCSI bus (/dev/sdb). The default settings can be
107 changes using a configuration file (see section Configuration).
108 .PP
109 The drive letter : (colon) has a special meaning. It is used to access
110 image files which are directly specified on the command line using the
111 \&\fR\&\f(CW-i\fR options.
112 .PP
113 Example:
114
115 .nf
116 .ft 3
117 .in +0.3i
118 mcopy -i my-image-file.bin ::file1 ::file2 .
119 .fi
120 .in -0.3i
121 .ft R
122 .PP
123
124 \&\fR
125 .PP
126 This copies \fR\&\f(CWfile1\fR and \fR\&\f(CWfile2\fR from the image file
127 (\fR\&\f(CWmy-image-file.bin\fR) to the \fR\&\f(CW/tmp\fR directory.
128 .PP
129 You can also supply an offset within the image file by including
130 \&\fR\&\f(CW@@\fR\fIoffset\fR into the file name.
131 .PP
132 Example:
133
134 .nf
135 .ft 3
136 .in +0.3i
137 mcopy -i my-image-file.bin@@1M ::file1 ::file2 .
138 .fi
139 .in -0.3i
140 .ft R
141 .PP
142
143 \&\fR
144 .PP
145 This looks for the image at the offset of 1M in the file, rather than
146 at its beginning.
147 .PP
148 .SS Sizes\ and\ offsets
149 .PP
150 Certain commands, such as \fR\&\f(CWmformat\fR, allow you to specify a hard
151 disk size.
152 .PP
153 The size is a number, followed by an optional unit suffix.
154 .PP
155 The number is interpreted as a hexadecimal number if it starts with
156 \&\fR\&\f(CW0x\fR, as an octal number if it starts with the digit \fR\&\f(CW0\fR, or
157 as a decimal number if it starts with any other digit.
158 .PP
159 The following units are supported:
160 .TP
161 * \ \
162 \&\fR\&\f(CWS\fR sectors (of 512 bytes)
163 .TP
164 * \ \
165 \&\fR\&\f(CWK\fR Kilobytes
166 .TP
167 * \ \
168 \&\fR\&\f(CWM\fR Megabytes
169 .TP
170 * \ \
171 \&\fR\&\f(CWG\fR Gigabytes
172 .TP
173 * \ \
174 \&\fR\&\f(CWT\fR Terabytes
175 .PP
176 If no unit is specified, the default depends on context. Mformat's
177 \&\fR\&\f(CWT\fR option, and mpartition's \fR\&\f(CWl\fR option assume sectors,
178 whereas all other places (mshowfat's \fR\&\f(CWo\fR option, \fR\&\f(CWoffset\fR
179 drive config option and \fR\&\f(CWdata_map\fR drive config option) assume
180 bytes.
181 .PP
182 .SS Current\ working\ directory
183 .PP
184 The \fR\&\f(CWmcd\fR command (\(ifmcd\(is) is used to establish the device and
185 the current working directory (relative to the MS-DOS file system),
186 otherwise the default is assumed to be \fR\&\f(CWA:/\fR. However, unlike
187 MS-DOS, there is only one working directory for all drives, and not one
188 per drive.
189 .PP
190 .SS VFAT-style\ long\ file\ names
191 .PP
192 This version of mtools supports VFAT style long filenames. If a Unix
193 filename is too long to fit in a short DOS name, it is stored as a
194 VFAT long name, and a companion short name is generated. This short
195 name is what you see when you examine the disk with a pre-7.0 version
196 of DOS.
197 The following table shows some examples of short names:
198 .PP
199
200 .nf
201 .ft 3
202 .in +0.3i
203 Long name MS-DOS name Reason for the change
204 --------- ---------- ---------------------
205 thisisatest THISIS~1 filename too long
206 alain.knaff ALAIN~1.KNA extension too long
207 prn.txt PRN~1.TXT PRN is a device name
208 \&\&.abc ABC~1 null filename
209 hot+cold HOT_CO~1 illegal character
210 .fi
211 .in -0.3i
212 .ft R
213 .PP
214
215 \&\fR
216 .PP
217 As you see, the following transformations happen to derive a short
218 name:
219 .TP
220 * \ \
221 Illegal characters are replaced by underscores. The illegal characters
222 are \fR\&\f(CW;+=[]',\e"*\e\e<>/?:|\fR.
223 .TP
224 * \ \
225 Extra dots, which cannot be interpreted as a main name/extension
226 separator are removed
227 .TP
228 * \ \
229 A \fR\&\f(CW~\fR\fIn\fR number is generated,
230 .TP
231 * \ \
232 The name is shortened so as to fit in the 8+3 limitation
233 .PP
234 The initial Unix-style file name (whether long or short) is also called
235 the \fIprimary\fR name, and the derived short name is also called the
236 \&\fIsecondary\fR name.
237 .PP
238 Example:
239
240 .nf
241 .ft 3
242 .in +0.3i
243 mcopy /etc/motd a:Reallylongname
244 .fi
245 .in -0.3i
246 .ft R
247 .PP
248
249 \&\fR Mtools creates a VFAT entry for Reallylongname, and uses REALLYLO as
250 a short name. Reallylongname is the primary name, and REALLYLO is the
251 secondary name.
252
253 .nf
254 .ft 3
255 .in +0.3i
256 mcopy /etc/motd a:motd
257 .fi
258 .in -0.3i
259 .ft R
260 .PP
261
262 \&\fR Motd fits into the DOS filename limits. Mtools doesn't need to
263 derivate another name. Motd is the primary name, and there is no
264 secondary name.
265 .PP
266 In a nutshell: The primary name is the long name, if one exists, or
267 the short name if there is no long name.
268 .PP
269 Although VFAT is much more flexible than FAT, there are still names
270 that are not acceptable, even in VFAT. There are still some illegal
271 characters left (\fR\&\f(CW\e"*\e\e<>/?:|\fR), and device names are still
272 reserved.
273 .PP
274
275 .nf
276 .ft 3
277 .in +0.3i
278 Unix name Long name Reason for the change
279 --------- ---------- ---------------------
280 prn prn-1 PRN is a device name
281 ab:c ab_c-1 illegal character
282 .fi
283 .in -0.3i
284 .ft R
285 .PP
286
287 \&\fR
288 .PP
289 As you see, the following transformations happen if a long name is
290 illegal:
291 .TP
292 * \ \
293 Illegal characters are replaces by underscores,
294 .TP
295 * \ \
296 A \fR\&\f(CW-\fR\fIn\fR number is generated,
297 .PP
298 .SS Name\ clashes
299 .PP
300 When writing a file to disk, its long name or short name may collide
301 with an already existing file or directory. This may happen for all
302 commands which create new directory entries, such as \fR\&\f(CWmcopy\fR,
303 \&\fR\&\f(CWmmd\fR, \fR\&\f(CWmren\fR, \fR\&\f(CWmmove\fR. When a name clash happens, mtools
304 asks you what it should do. It offers several choices:
305 .TP
306 \&\fR\&\f(CWoverwrite\fR\
307 Overwrites the existing file. It is not possible to overwrite a
308 directory with a file.
309 .TP
310 \&\fR\&\f(CWrename\fR\
311 Renames the newly created file. Mtools prompts for the new filename
312 .TP
313 \&\fR\&\f(CWautorename\fR\
314 Renames the newly created file. Mtools chooses a name by itself, without
315 prompting
316 .TP
317 \&\fR\&\f(CWskip\fR\
318 Gives up on this file, and moves on to the next (if any)
319 .PP
320 To chose one of these actions, type its first letter at the prompt. If
321 you use a lower case letter, the action only applies for this file only,
322 if you use an upper case letter, the action applies to all files, and
323 you won't be prompted again.
324 .PP
325 You may also chose actions (for all files) on the command line, when
326 invoking mtools:
327 .TP
328 \&\fR\&\f(CW-D\ o\fR\
329 Overwrites primary names by default.
330 .TP
331 \&\fR\&\f(CW-D\ O\fR\
332 Overwrites secondary names by default.
333 .TP
334 \&\fR\&\f(CW-D\ r\fR\
335 Renames primary name by default.
336 .TP
337 \&\fR\&\f(CW-D\ R\fR\
338 Renames secondary name by default.
339 .TP
340 \&\fR\&\f(CW-D\ a\fR\
341 Autorenames primary name by default.
342 .TP
343 \&\fR\&\f(CW-D\ A\fR\
344 Autorenames secondary name by default.
345 .TP
346 \&\fR\&\f(CW-D\ s\fR\
347 Skip primary name by default.
348 .TP
349 \&\fR\&\f(CW-D\ S\fR\
350 Skip secondary name by default.
351 .TP
352 \&\fR\&\f(CW-D\ m\fR\
353 Ask user what to do with primary name.
354 .TP
355 \&\fR\&\f(CW-D\ M\fR\
356 Ask user what to do with secondary name.
357 .PP
358 Note that for command line switches lower/upper differentiates between
359 primary/secondary name whereas for interactive choices, lower/upper
360 differentiates between just-this-time/always.
361 .PP
362 The primary name is the name as displayed in Windows 95 or Windows NT:
363 i.e. the long name if it exists, and the short name otherwise. The
364 secondary name is the "hidden" name, i.e. the short name if a long name
365 exists.
366 .PP
367 By default, the user is prompted if the primary name clashes, and the
368 secondary name is autorenamed.
369 .PP
370 If a name clash occurs in a Unix directory, mtools only asks whether
371 to overwrite the file, or to skip it.
372 .PP
373 .SS Case\ sensitivity\ of\ the\ VFAT\ file\ system
374 .PP
375 The VFAT file system is able to remember the case of the
376 filenames. However, filenames which differ only in case are not allowed
377 to coexist in the same directory. For example if you store a file called
378 LongFileName on a VFAT file system, mdir shows this file as LongFileName,
379 and not as Longfilename. However, if you then try to add LongFilename to
380 the same directory, it is refused, because case is ignored for clash
381 checks.
382 .PP
383 The VFAT file system allows you to store the case of a filename in the
384 attribute byte, if all letters of the filename are the same case, and if
385 all letters of the extension are the same case too. Mtools uses this
386 information when displaying the files, and also to generate the Unix
387 filename when mcopying to a Unix directory. This may have unexpected
388 results when applied to files written using an pre-7.0 version of DOS:
389 Indeed, the old style filenames map to all upper case. This is different
390 from the behavior of the old version of mtools which used to generate
391 lower case Unix filenames.
392 .PP
393 .SS high\ capacity\ formats
394 .PP
395 Mtools supports a number of formats which allow storage of more data on
396 disk than usual. Due to different operating system abilities, these
397 formats are not supported on all operating systems. Mtools recognizes
398 these formats transparently where supported.
399 .PP
400 In order to format these disks, you need to use an operating system
401 specific tool. For Linux, suitable floppy tools can be found in the
402 \&\fR\&\f(CWfdutils\fR package at the following locations~:
403
404 .nf
405 .ft 3
406 .in +0.3i
407 \&\fR\&\f(CWhttp://www.fdutils.linux.lu/.
408 .fi
409 .in -0.3i
410 .ft R
411 .PP
412
413 \&\fR
414 .PP
415 See the manual pages included in that package for further detail: Use
416 \&\fR\&\f(CWsuperformat\fR to format all formats except XDF, and use
417 \&\fR\&\f(CWxdfcopy\fR to format XDF.
418 .PP
419 .SS \ \ More\ sectors
420 .PP
421 The oldest method of fitting more data on a disk is to use more sectors
422 and more cylinders. Although the standard format uses 80 cylinders and
423 18 sectors (on a 3 1/2 high density disk), it is possible to use up to
424 83 cylinders (on most drives) and up to 21 sectors. This method allows
425 to store up to 1743K on a 3 1/2 HD disk. However, 21 sector disks are
426 twice as slow as the standard 18 sector disks because the sectors are
427 packed so close together that we need to interleave them. This problem
428 doesn't exist for 20 sector formats.
429 .PP
430 These formats are supported by numerous DOS shareware utilities such as
431 \&\fR\&\f(CWfdformat\fR and \fR\&\f(CWvgacopy\fR. In his infinite hubris, Bill Gate$
432 believed that he invented this, and called it \fR\&\f(CW\(ifDMF disks\(is\fR, or
433 \&\fR\&\f(CW\(ifWindows formatted disks\(is\fR. But in reality, it has already existed
434 years before! Mtools supports these formats on Linux, on SunOS and on
435 the DELL Unix PC.
436 .PP
437 .SS \ \ Bigger\ sectors
438 By using bigger sectors it is possible to go beyond the capacity which
439 can be obtained by the standard 512-byte sectors. This is because of the
440 sector header. The sector header has the same size, regardless of how
441 many data bytes are in the sector. Thus, we save some space by using
442 \&\fIfewer\fR, but bigger sectors. For example, 1 sector of 4K only takes
443 up header space once, whereas 8 sectors of 512 bytes have also 8
444 headers, for the same amount of useful data.
445 .PP
446 This method permits storage of up to 1992K on a 3 1/2 HD disk.
447 .PP
448 Mtools supports these formats only on Linux.
449 .PP
450 .SS \ \ 2m
451 .PP
452 The 2m format was originally invented by Ciriaco Garcia de Celis. It
453 also uses bigger sectors than usual in order to fit more data on the
454 disk. However, it uses the standard format (18 sectors of 512 bytes
455 each) on the first cylinder, in order to make these disks easier to
456 handle by DOS. Indeed this method allows you to have a standard sized
457 boot sector, which contains a description of how the rest of the disk
458 should be read.
459 .PP
460 However, the drawback of this is that the first cylinder can hold less
461 data than the others. Unfortunately, DOS can only handle disks where
462 each track contains the same amount of data. Thus 2m hides the fact that
463 the first track contains less data by using a \fIshadow
464 FAT\fR. (Usually, DOS stores the FAT in two identical copies, for
465 additional safety. XDF stores only one copy, but tells DOS that it
466 stores two. Thus the space that would be taken up by the second FAT copy
467 is saved.) This also means that you should \fBnever use a 2m disk
468 to store anything else than a DOS file system\fR.
469 .PP
470 Mtools supports these formats only on Linux.
471 .PP
472 .SS \ \ XDF
473 .PP
474 XDF is a high capacity format used by OS/2. It can hold 1840 K per
475 disk. That's lower than the best 2m formats, but its main advantage is
476 that it is fast: 600 milliseconds per track. That's faster than the 21
477 sector format, and almost as fast as the standard 18 sector format. In
478 order to access these disks, make sure mtools has been compiled with XDF
479 support, and set the \fR\&\f(CWuse_xdf\fR variable for the drive in the
480 configuration file. See section Compiling mtools, and \(ifmiscellaneous variables\(is,
481 for details on how to do this. Fast XDF access is only available for
482 Linux kernels which are more recent than 1.1.34.
483 .PP
484 Mtools supports this format only on Linux.
485 .PP
486 \&\fBCaution / Attention distributors\fR: If mtools is compiled on a
487 Linux kernel more recent than 1.3.34, it won't run on an older
488 kernel. However, if it has been compiled on an older kernel, it still
489 runs on a newer kernel, except that XDF access is slower. It is
490 recommended that distribution authors only include mtools binaries
491 compiled on kernels older than 1.3.34 until 2.0 comes out. When 2.0 will
492 be out, mtools binaries compiled on newer kernels may (and should) be
493 distributed. Mtools binaries compiled on kernels older than 1.3.34 won't
494 run on any 2.1 kernel or later.
495 .PP
496 .SS Exit\ codes
497 All the Mtools commands return 0 on success, 1 on utter failure, or 2
498 on partial failure. All the Mtools commands perform a few sanity
499 checks before going ahead, to make sure that the disk is indeed an
500 MS-DOS disk (as opposed to, say an ext2 or MINIX disk). These checks
501 may reject partially corrupted disks, which might otherwise still be
502 readable. To avoid these checks, set the MTOOLS_SKIP_CHECK
503 environmental variable or the corresponding configuration file variable
504 (see section global variables)
505 .SS Bugs
506 An unfortunate side effect of not guessing the proper device (when
507 multiple disk capacities are supported) is an occasional error message
508 from the device driver. These can be safely ignored.
509 .PP
510 The fat checking code chokes on 1.72 Mb disks mformatted with pre-2.0.7
511 mtools. Set the environmental variable MTOOLS_FAT_COMPATIBILITY (or the
512 corresponding configuration file variable, \(ifglobal variables\(is) to
513 bypass the fat checking.
514 .PP
515 .SH See also
516 floppyd_installtest
517 mattrib
518 mbadblocks
519 mcd
520 mcopy
521 mdel
522 mdeltree
523 mdir
524 mdu
525 mformat
526 minfo
527 mkmanifest
528 mlabel
529 mmd
530 mmount
531 mmove
532 mrd
533 mren
534 mshortname
535 mshowfat
536 mtoolstest
537 mtype