1 This is mtools.info, produced by makeinfo version 6.5 from mtools.texi.
3 This manual is for Mtools (version 4.0.24, March 2020), which is a
4 collection of tools to allow Unix systems to manipulate MS-DOS files.
6 Copyright (C) 2007, 2009 Free Software Foundation, Inc. Copyright
7 (C) 1996-2005,2007-2011,2013 Alain Knaff.
9 Permission is granted to copy, distribute and/or modify this
10 document under the terms of the GNU Free Documentation License,
11 Version 1.3 or any later version published by the Free Software
12 Foundation; with no Invariant Sections, with no Front-Cover Texts,
13 and with no Back-Cover Texts. A copy of the license is included in
14 the section entitled "GNU Free Documentation License".
17 * Mtools: (mtools). Mtools: utilities to access DOS disks in Unix.
21 File: mtools.info, Node: Top, Next: Location, Prev: (dir), Up: (dir)
26 This is mtools' documentation.
43 Mtools is a collection of tools to allow Unix systems to manipulate
44 MS-DOS files: read, write, and move around files on an MS-DOS file
45 system (typically a floppy disk). Where reasonable, each program
46 attempts to emulate the MS-DOS equivalent command. However, unnecessary
47 restrictions and oddities of DOS are not emulated. For instance, it is
48 possible to move subdirectories from one subdirectory to another.
50 Mtools is sufficient to give access to MS-DOS file systems. For
51 instance, commands such as 'mdir a:' work on the 'a:' floppy without any
52 preliminary mounting or initialization (assuming the default
53 '/etc/mtools.conf' works on your machine). With mtools, one can change
54 floppies too without unmounting and mounting.
56 This manual is for Mtools (version 4.0.24, March 2020), which is a
57 collection of tools to allow Unix systems to manipulate MS-DOS files.
59 Copyright (C) 2007, 2009 Free Software Foundation, Inc. Copyright
60 (C) 1996-2005,2007-2011,2013 Alain Knaff.
62 Permission is granted to copy, distribute and/or modify this
63 document under the terms of the GNU Free Documentation License,
64 Version 1.3 or any later version published by the Free Software
65 Foundation; with no Invariant Sections, with no Front-Cover Texts,
66 and with no Back-Cover Texts. A copy of the license is included in
67 the section entitled "GNU Free Documentation License".
71 * Location:: Where to find mtools and early bug fixes
72 * Common features:: Common features of all mtools commands
73 * Configuration:: How to configure mtools for your environment
74 * Commands:: The available mtools commands
75 * Compiling mtools:: Architecture specific compilation flags
76 * Porting mtools:: Porting mtools to architectures which are not
79 * Command Index:: Command Index
80 * Variable Index:: Variable Index
81 * Concept Index:: Concept Index
84 File: mtools.info, Node: Location, Next: Common features, Prev: Top, Up: Top
89 Mtools can be found at the following places (and their mirrors):
90 http://ftp.gnu.org/gnu/mtools/mtools-4.0.24.tar.gz
91 http://mtools.linux.lu/mtools-4.0.24.tar.gz
92 ftp://www.tux.org/pub/knaff/mtools/mtools-4.0.24.tar.gz
93 ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-4.0.24.tar.gz
95 Before reporting a bug, make sure that it has not yet been fixed in
96 the Alpha patches which can be found at:
97 http://ftp.gnu.org/gnu/mtools/
98 http://mtools.linux.lu/
99 ftp://www.tux.org/pub/knaff/mtools
101 These patches are named 'mtools-'VERSION'-'DDMM'.taz', where version
102 stands for the base version, DD for the day and MM for the month. Due
103 to a lack of space, I usually leave only the most recent patch.
105 There is an mtools mailing list at mtools @ tux.org . Please send
106 all bug reports to this list. You may subscribe to the list by sending
107 a message with 'subscribe mtools @ tux.org' in its body to majordomo @
108 tux.org . (N.B. Please remove the spaces around the "@" both times. I
109 left them there in order to fool spambots.) Announcements of new mtools
110 versions will also be sent to the list, in addition to the Linux
111 announce newsgroups. The mailing list is archived at
112 http://lists.gnu.org/pipermail/info-mtools/
115 File: mtools.info, Node: Common features, Next: Configuration, Prev: Location, Up: Top
117 2 Common features of all mtools commands
118 ****************************************
122 * arguments:: What the command line parameters of mtools
124 * drive letters:: Which drives are defined by default
125 * directory:: Current working directory
126 * long names:: VFAT-style long filenames
127 * name clashes:: Name clash handling, and associated command
129 * case sensitivity:: Case sensitivity
130 * high capacity formats:: How to fit more data on your floppies
131 * exit codes:: Exit codes
132 * bugs:: Happens to everybody
135 File: mtools.info, Node: arguments, Next: drive letters, Prev: Common features, Up: Common features
137 2.1 Options and filenames
138 =========================
140 MS-DOS filenames are composed of a drive letter followed by a colon, a
141 subdirectory, and a filename. Only the filename part is mandatory, the
142 drive letter and the subdirectory are optional. Filenames without a
143 drive letter refer to Unix files. Subdirectory names can use either the
144 ''/'' or ''\'' separator. The use of the ''\'' separator or wildcards
145 requires the names to be enclosed in quotes to protect them from the
146 shell. However, wildcards in Unix filenames should not be enclosed in
147 quotes, because here we *want* the shell to expand them.
149 The regular expression "pattern matching" routines follow the
150 Unix-style rules. For example, ''*'' matches all MS-DOS files in lieu
151 of ''*.*''. The archive, hidden, read-only and system attribute bits
152 are ignored during pattern matching.
154 All options use the '-' (minus) as their first character, not '/' as
155 you'd expect in MS-DOS.
157 Most mtools commands allow multiple filename parameters, which
158 doesn't follow MS-DOS conventions, but which is more user-friendly.
160 Most mtools commands allow options that instruct them how to handle
161 file name clashes. *Note name clashes::, for more details on these.
162 All commands accept the '-V' flags which prints the version, and most
163 accept the '-v' flag, which switches on verbose mode. In verbose mode,
164 these commands print out the name of the MS-DOS files upon which they
165 act, unless stated otherwise. *Note Commands::, for a description of
166 the options which are specific to each command.
169 File: mtools.info, Node: drive letters, Next: directory, Prev: arguments, Up: Common features
174 The meaning of the drive letters depends on the target architectures.
175 However, on most target architectures, drive A is the first floppy
176 drive, drive B is the second floppy drive (if available), drive J is a
177 Jaz drive (if available), and drive Z is a Zip drive (if available). On
178 those systems where the device name is derived from the SCSI id, the Jaz
179 drive is assumed to be at SCSI target 4, and the Zip at SCSI target 5
180 (factory default settings). On Linux, both drives are assumed to be the
181 second drive on the SCSI bus (/dev/sdb). The default settings can be
182 changes using a configuration file (*note Configuration::).
184 The drive letter : (colon) has a special meaning. It is used to
185 access image files which are directly specified on the command line
186 using the '-i' options.
189 mcopy -i my-image-file.bin ::file1 ::file2 .
191 This copies 'file1' and 'file2' from the image file
192 ('my-image-file.bin') to the '/tmp' directory.
194 You can also supply an offset within the image file by including
195 '@@'OFFSET into the file name.
198 mcopy -i my-image-file.bin@@1M ::file1 ::file2 .
200 This looks for the image at the offset of 1M in the file, rather than
204 File: mtools.info, Node: directory, Next: long names, Prev: drive letters, Up: Common features
206 2.3 Current working directory
207 =============================
209 The 'mcd' command (*note mcd::) is used to establish the device and the
210 current working directory (relative to the MS-DOS file system),
211 otherwise the default is assumed to be 'A:/'. However, unlike MS-DOS,
212 there is only one working directory for all drives, and not one per
216 File: mtools.info, Node: long names, Next: name clashes, Prev: directory, Up: Common features
218 2.4 VFAT-style long file names
219 ==============================
221 This version of mtools supports VFAT style long filenames. If a Unix
222 filename is too long to fit in a short DOS name, it is stored as a VFAT
223 long name, and a companion short name is generated. This short name is
224 what you see when you examine the disk with a pre-7.0 version of DOS.
225 The following table shows some examples of short names:
227 Long name MS-DOS name Reason for the change
228 --------- ---------- ---------------------
229 thisisatest THISIS~1 filename too long
230 alain.knaff ALAIN~1.KNA extension too long
231 prn.txt PRN~1.TXT PRN is a device name
232 .abc ABC~1 null filename
233 hot+cold HOT_CO~1 illegal character
235 As you see, the following transformations happen to derive a short
237 * Illegal characters are replaced by underscores. The illegal
238 characters are ';+=[]',\"*\\<>/?:|'.
239 * Extra dots, which cannot be interpreted as a main name/extension
240 separator are removed
241 * A '~'N number is generated,
242 * The name is shortened so as to fit in the 8+3 limitation
244 The initial Unix-style file name (whether long or short) is also
245 called the "primary" name, and the derived short name is also called the
249 mcopy /etc/motd a:Reallylongname
250 Mtools creates a VFAT entry for Reallylongname, and uses REALLYLO as
251 a short name. Reallylongname is the primary name, and REALLYLO is the
253 mcopy /etc/motd a:motd
254 Motd fits into the DOS filename limits. Mtools doesn't need to
255 derivate another name. Motd is the primary name, and there is no
258 In a nutshell: The primary name is the long name, if one exists, or
259 the short name if there is no long name.
261 Although VFAT is much more flexible than FAT, there are still names
262 that are not acceptable, even in VFAT. There are still some illegal
263 characters left ('\"*\\<>/?:|'), and device names are still reserved.
265 Unix name Long name Reason for the change
266 --------- ---------- ---------------------
267 prn prn-1 PRN is a device name
268 ab:c ab_c-1 illegal character
270 As you see, the following transformations happen if a long name is
272 * Illegal characters are replaces by underscores,
273 * A '-'N number is generated,
276 File: mtools.info, Node: name clashes, Next: case sensitivity, Prev: long names, Up: Common features
281 When writing a file to disk, its long name or short name may collide
282 with an already existing file or directory. This may happen for all
283 commands which create new directory entries, such as 'mcopy', 'mmd',
284 'mren', 'mmove'. When a name clash happens, mtools asks you what it
285 should do. It offers several choices:
288 Overwrites the existing file. It is not possible to overwrite a
289 directory with a file.
291 Renames the newly created file. Mtools prompts for the new
294 Renames the newly created file. Mtools chooses a name by itself,
297 Gives up on this file, and moves on to the next (if any)
299 To chose one of these actions, type its first letter at the prompt.
300 If you use a lower case letter, the action only applies for this file
301 only, if you use an upper case letter, the action applies to all files,
302 and you won't be prompted again.
304 You may also chose actions (for all files) on the command line, when
308 Overwrites primary names by default.
310 Overwrites secondary names by default.
312 Renames primary name by default.
314 Renames secondary name by default.
316 Autorenames primary name by default.
318 Autorenames secondary name by default.
320 Skip primary name by default.
322 Skip secondary name by default.
324 Ask user what to do with primary name.
326 Ask user what to do with secondary name.
328 Note that for command line switches lower/upper differentiates
329 between primary/secondary name whereas for interactive choices,
330 lower/upper differentiates between just-this-time/always.
332 The primary name is the name as displayed in Windows 95 or Windows
333 NT: i.e. the long name if it exists, and the short name otherwise. The
334 secondary name is the "hidden" name, i.e. the short name if a long name
337 By default, the user is prompted if the primary name clashes, and the
338 secondary name is autorenamed.
340 If a name clash occurs in a Unix directory, mtools only asks whether
341 to overwrite the file, or to skip it.
344 File: mtools.info, Node: case sensitivity, Next: high capacity formats, Prev: name clashes, Up: Common features
346 2.6 Case sensitivity of the VFAT file system
347 ============================================
349 The VFAT file system is able to remember the case of the filenames.
350 However, filenames which differ only in case are not allowed to coexist
351 in the same directory. For example if you store a file called
352 LongFileName on a VFAT file system, mdir shows this file as
353 LongFileName, and not as Longfilename. However, if you then try to add
354 LongFilename to the same directory, it is refused, because case is
355 ignored for clash checks.
357 The VFAT file system allows you to store the case of a filename in
358 the attribute byte, if all letters of the filename are the same case,
359 and if all letters of the extension are the same case too. Mtools uses
360 this information when displaying the files, and also to generate the
361 Unix filename when mcopying to a Unix directory. This may have
362 unexpected results when applied to files written using an pre-7.0
363 version of DOS: Indeed, the old style filenames map to all upper case.
364 This is different from the behavior of the old version of mtools which
365 used to generate lower case Unix filenames.
368 File: mtools.info, Node: high capacity formats, Next: exit codes, Prev: case sensitivity, Up: Common features
370 2.7 high capacity formats
371 =========================
373 Mtools supports a number of formats which allow storage of more data on
374 disk than usual. Due to different operating system abilities, these
375 formats are not supported on all operating systems. Mtools recognizes
376 these formats transparently where supported.
378 In order to format these disks, you need to use an operating system
379 specific tool. For Linux, suitable floppy tools can be found in the
380 'fdutils' package at the following locations~:
381 ftp://www.tux.org/pub/knaff/fdutils/.
382 ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/fdutils-*
384 See the manual pages included in that package for further detail: Use
385 'superformat' to format all formats except XDF, and use 'xdfcopy' to
390 * more sectors:: Putting more sectors per track on the disk
391 * bigger sectors:: Use bigger sectors to save header space
392 * 2m:: Use a standard first track
393 * XDF:: OS/2's eXtended density format
396 File: mtools.info, Node: more sectors, Next: bigger sectors, Prev: high capacity formats, Up: high capacity formats
401 The oldest method of fitting more data on a disk is to use more sectors
402 and more cylinders. Although the standard format uses 80 cylinders and
403 18 sectors (on a 3 1/2 high density disk), it is possible to use up to
404 83 cylinders (on most drives) and up to 21 sectors. This method allows
405 to store up to 1743K on a 3 1/2 HD disk. However, 21 sector disks are
406 twice as slow as the standard 18 sector disks because the sectors are
407 packed so close together that we need to interleave them. This problem
408 doesn't exist for 20 sector formats.
410 These formats are supported by numerous DOS shareware utilities such
411 as 'fdformat' and 'vgacopy'. In his infinite hubris, Bill Gate$
412 believed that he invented this, and called it 'DMF disks', or 'Windows
413 formatted disks'. But in reality, it has already existed years before!
414 Mtools supports these formats on Linux, on SunOS and on the DELL Unix
418 File: mtools.info, Node: bigger sectors, Next: 2m, Prev: more sectors, Up: high capacity formats
423 By using bigger sectors it is possible to go beyond the capacity which
424 can be obtained by the standard 512-byte sectors. This is because of
425 the sector header. The sector header has the same size, regardless of
426 how many data bytes are in the sector. Thus, we save some space by
427 using _fewer_, but bigger sectors. For example, 1 sector of 4K only
428 takes up header space once, whereas 8 sectors of 512 bytes have also 8
429 headers, for the same amount of useful data.
431 This method permits storage of up to 1992K on a 3 1/2 HD disk.
433 Mtools supports these formats only on Linux.
436 File: mtools.info, Node: 2m, Next: XDF, Prev: bigger sectors, Up: high capacity formats
441 The 2m format was originally invented by Ciriaco Garcia de Celis. It
442 also uses bigger sectors than usual in order to fit more data on the
443 disk. However, it uses the standard format (18 sectors of 512 bytes
444 each) on the first cylinder, in order to make these disks easier to
445 handle by DOS. Indeed this method allows you to have a standard sized
446 boot sector, which contains a description of how the rest of the disk
449 However, the drawback of this is that the first cylinder can hold
450 less data than the others. Unfortunately, DOS can only handle disks
451 where each track contains the same amount of data. Thus 2m hides the
452 fact that the first track contains less data by using a "shadow FAT".
453 (Usually, DOS stores the FAT in two identical copies, for additional
454 safety. XDF stores only one copy, but tells DOS that it stores two.
455 Thus the space that would be taken up by the second FAT copy is saved.)
456 This also means that you should *never use a 2m disk to store anything
457 else than a DOS file system*.
459 Mtools supports these formats only on Linux.
462 File: mtools.info, Node: XDF, Prev: 2m, Up: high capacity formats
467 XDF is a high capacity format used by OS/2. It can hold 1840 K per
468 disk. That's lower than the best 2m formats, but its main advantage is
469 that it is fast: 600 milliseconds per track. That's faster than the 21
470 sector format, and almost as fast as the standard 18 sector format. In
471 order to access these disks, make sure mtools has been compiled with XDF
472 support, and set the 'use_xdf' variable for the drive in the
473 configuration file. *Note Compiling mtools::, and *note miscellaneous
474 variables::, for details on how to do this. Fast XDF access is only
475 available for Linux kernels which are more recent than 1.1.34.
477 Mtools supports this format only on Linux.
479 *Caution / Attention distributors*: If mtools is compiled on a Linux
480 kernel more recent than 1.3.34, it won't run on an older kernel.
481 However, if it has been compiled on an older kernel, it still runs on a
482 newer kernel, except that XDF access is slower. It is recommended that
483 distribution authors only include mtools binaries compiled on kernels
484 older than 1.3.34 until 2.0 comes out. When 2.0 will be out, mtools
485 binaries compiled on newer kernels may (and should) be distributed.
486 Mtools binaries compiled on kernels older than 1.3.34 won't run on any
490 File: mtools.info, Node: exit codes, Next: bugs, Prev: high capacity formats, Up: Common features
495 All the Mtools commands return 0 on success, 1 on utter failure, or 2 on
496 partial failure. All the Mtools commands perform a few sanity checks
497 before going ahead, to make sure that the disk is indeed an MS-DOS disk
498 (as opposed to, say an ext2 or MINIX disk). These checks may reject
499 partially corrupted disks, which might otherwise still be readable. To
500 avoid these checks, set the MTOOLS_SKIP_CHECK environmental variable or
501 the corresponding configuration file variable (*note global variables::)
504 File: mtools.info, Node: bugs, Prev: exit codes, Up: Common features
509 An unfortunate side effect of not guessing the proper device (when
510 multiple disk capacities are supported) is an occasional error message
511 from the device driver. These can be safely ignored.
513 The fat checking code chokes on 1.72 Mb disks mformatted with
514 pre-2.0.7 mtools. Set the environmental variable
515 MTOOLS_FAT_COMPATIBILITY (or the corresponding configuration file
516 variable, *note global variables::) to bypass the fat checking.
519 File: mtools.info, Node: Configuration, Next: Commands, Prev: Common features, Up: Top
521 3 How to configure mtools for your environment
522 **********************************************
526 * configuration file location::
529 * per drive variables::
531 * old style configuration::
536 This sections explains the syntax of the configurations files for
537 mtools. The configuration files are called '/etc/mtools.conf' and
538 '~/.mtoolsrc'. If the environmental variable 'MTOOLSRC' is set, its
539 contents is used as the filename for a third configuration file. These
540 configuration files describe the following items:
542 * Global configuration flags and variables
543 * Per drive flags and variables
547 * configuration file location:: Where mtools looks for its configuration files
548 * general syntax:: The layout of the configuration files
549 * default values:: Why you don't need a configuration file in most cases
550 * global variables:: Variables that are independent of the drive
551 * per drive variables:: Variables that are specific to a given drive
552 * parsing order:: Location of configuration files and parsing order
553 * old style configuration:: Backwards compatibility
556 File: mtools.info, Node: configuration file location, Next: general syntax, Prev: Configuration, Up: Configuration
558 3.2 Location of the configuration files
559 =======================================
561 '/etc/mtools.conf' is the system-wide configuration file, and
562 '~/.mtoolsrc' is the user's private configuration file.
564 On some systems, the system-wide configuration file is called
565 '/etc/default/mtools.conf' instead.
572 File: mtools.info, Node: general syntax, Next: default values, Prev: configuration file location, Up: Configuration
574 3.2.1 General configuration file syntax
575 ---------------------------------------
577 The configuration files is made up of sections. Each section starts
578 with a keyword identifying the section followed by a colon. Then follow
579 variable assignments and flags. Variable assignments take the following
582 Flags are lone keywords without an equal sign and value following
583 them. A section either ends at the end of the file or where the next
586 Lines starting with a hash ('#') are comments. Newline characters
587 are equivalent to whitespace (except where ending a comment). The
588 configuration file is case insensitive, except for item enclosed in
589 quotes (such as filenames).
592 File: mtools.info, Node: default values, Next: global variables, Prev: general syntax, Up: Configuration
597 For most platforms, mtools contains reasonable compiled-in defaults for
598 physical floppy drives. Thus, you usually don't need to bother with the
599 configuration file, if all you want to do with mtools is to access your
600 floppy drives. On the other hand, the configuration file is needed if
601 you also want to use mtools to access your hard disk partitions and
605 File: mtools.info, Node: global variables, Next: per drive variables, Prev: default values, Up: Configuration
610 Global flags may be set to 1 or to 0.
612 The following global flags are recognized:
615 If this is set to 1, mtools skips most of its sanity checks. This
616 is needed to read some Atari disks which have been made with the
617 earlier ROMs, and which would not be recognized otherwise.
618 'MTOOLS_FAT_COMPATIBILITY'
619 If this is set to 1, mtools skips the fat size checks. Some disks
620 have a bigger FAT than they really need to. These are rejected if
621 this option is not set.
623 If this is set to 1, mtools displays all-upper-case short filenames
624 as lowercase. This has been done to allow a behavior which is
625 consistent with older versions of mtools which didn't know about
628 If this is set to 1, mtools won't generate VFAT entries for
629 filenames which are mixed-case, but otherwise legal dos filenames.
630 This is useful when working with DOS versions which can't grok VFAT
631 long names, such as FreeDOS.
633 In a wide directory, prints the short name with a dot instead of
634 spaces separating the basename and the extension.
635 'MTOOLS_NAME_NUMERIC_TAIL'
636 If this is set to one (default), generate numeric tails for all
637 long names (~1). If set to zero, only generate numeric tails if
638 otherwise a clash would have happened.
639 'MTOOLS_TWENTY_FOUR_HOUR_CLOCK'
640 If 1, uses the European notation for times (twenty four hour
641 clock), else uses the UK/US notation (am/pm)
642 'MTOOLS_LOCK_TIMEOUT'
643 How long, in seconds, to wait for a locked device to become free.
646 Example: Inserting the following line into your configuration file
647 instructs mtools to skip the sanity checks:
650 Global variables may also be set via the environment:
651 export MTOOLS_SKIP_CHECK=1
653 Global string variables may be set to any value:
655 The format used for printing dates of files. By default, is
659 File: mtools.info, Node: per drive variables, Next: parsing order, Prev: global variables, Up: Configuration
661 3.5 Per drive flags and variables
662 =================================
666 * general information:: What a drive description looks like
667 * location information:: Where is the drive data physically stored
668 * geometry description:: Describes the physical characteristics of
670 * open flags:: Flags passed to the open system call when the
672 * miscellaneous variables:: Variables which don't fit in either category
673 * miscellaneous flags:: Switch variables, which can be enabled or disabled
674 * multiple descriptions:: How to supply several descriptions for a
675 drive, to be tried one after the other.
678 File: mtools.info, Node: general information, Next: location information, Prev: per drive variables, Up: per drive variables
680 3.5.1 General information
681 -------------------------
683 Per drive flags and values may be described in a drive section. A drive
684 section starts with 'drive' "DRIVELETTER" :
686 Then follow variable-value pairs and flags.
688 This is a sample drive description:
690 file="/dev/fd0" use_xdf=1
693 File: mtools.info, Node: location information, Next: geometry description, Prev: general information, Up: per drive variables
695 3.5.2 Location information
696 --------------------------
698 For each drive, you need to describe where its data is physically stored
699 (image file, physical device, partition, offset).
702 The name of the file or device holding the disk image. This is
703 mandatory. The file name should be enclosed in quotes.
706 Tells mtools to treat the drive as a partitioned device, and to use
707 the given partition. Only primary partitions are accessible using
708 this method, and they are numbered from 1 to 4. For logical
709 partitions, use the more general 'offset' variable. The
710 'partition' variable is intended for removable media such as
711 Syquest disks, ZIP drives, and magneto-optical disks. Although
712 traditional DOS sees Syquest disks and magneto-optical disks as
713 'giant floppy disks' which are unpartitioned, OS/2 and Windows NT
714 treat them like hard disks, i.e. partitioned devices. The
715 'partition' flag is also useful DOSEMU hdimages. It is not
716 recommended for hard disks for which direct access to partitions is
717 available through mounting.
720 Describes where in the file the MS-DOS file system starts. This is
721 useful for logical partitions in DOSEMU hdimages, and for ATARI ram
722 disks. By default, this is zero, meaning that the file system
723 starts right at the beginning of the device or file.
726 File: mtools.info, Node: geometry description, Next: open flags, Prev: location information, Up: per drive variables
728 3.5.3 Disk Geometry Configuration
729 ---------------------------------
731 Geometry information describes the physical characteristics about the
732 disk. Its has three purposes:
735 The geometry information is written into the boot sector of the
736 newly made disk. However, you may also describe the geometry
737 information on the command line. *Note mformat::, for details.
739 On some Unixes there are device nodes which only support one
740 physical geometry. For instance, you might need a different node
741 to access a disk as high density or as low density. The geometry
742 is compared to the actual geometry stored on the boot sector to
743 make sure that this device node is able to correctly read the disk.
744 If the geometry doesn't match, this drive entry fails, and the next
745 drive entry bearing the same drive letter is tried. *Note multiple
746 descriptions::, for more details on supplying several descriptions
747 for one drive letter.
749 If no geometry information is supplied in the configuration file,
750 all disks are accepted. On Linux (and on SPARC) there exist device
751 nodes with configurable geometry ('/dev/fd0', '/dev/fd1' etc), and
752 thus filtering is not needed (and ignored) for disk drives.
753 (Mtools still does do filtering on plain files (disk images) in
754 Linux: this is mainly intended for test purposes, as I don't have
755 access to a Unix which would actually need filtering).
757 If you do not need filtering, but want still a default geometry for
758 mformatting, you may switch off filtering using the 'mformat_only'
761 If you want filtering, you should supply the 'filter' flag. If you
762 supply a geometry, you must supply one of both flags.
765 On devices that support it (usually floppy devices), the geometry
766 information is also used to set the initial geometry. This initial
767 geometry is applied while reading the boot sector, which contains
768 the real geometry. If no geometry information is supplied in the
769 configuration file, or if the 'mformat_only' flag is supplied, no
770 initial configuration is done.
772 On Linux, initial geometry is not really needed, as the
773 configurable devices are able to auto-detect the disk type
774 accurately enough (for most common formats) to read the boot
777 Wrong geometry information may lead to very bizarre errors. That's
778 why I strongly recommend that you add the 'mformat_only' flag to your
779 drive description, unless you really need filtering or initial geometry.
781 The following geometry related variables are available:
785 The number of cylinders. ('cylinders' is the preferred form,
786 'tracks' is considered obsolete)
788 The number of heads (sides).
790 The number of sectors per track.
792 Example: the following drive section describes a 1.44M drive:
797 cylinders=80 heads=2 sectors=18
800 The following shorthand geometry descriptions are available:
803 high density 3 1/2 disk. Equivalent to: 'fat_bits=12 cylinders=80
806 high density 5 1/4 disk. Equivalent to: 'fat_bits=12 cylinders=80
809 double density 3 1/2 disk. Equivalent to: 'fat_bits=12
810 cylinders=80 heads=2 sectors=9'
812 double density 5 1/4 disk. Equivalent to: 'fat_bits=12
813 cylinders=40 heads=2 sectors=9'
815 The shorthand format descriptions may be amended. For example, '360k
816 sectors=8' describes a 320k disk and is equivalent to: 'fat_bits=12
817 cylinders=40 heads=2 sectors=8'
820 File: mtools.info, Node: open flags, Next: miscellaneous variables, Prev: geometry description, Up: per drive variables
825 Moreover, the following flags are available:
828 All i/o operations are done synchronously
830 The device or file is opened with the O_NDELAY flag. This is
831 needed on some non-Linux architectures.
833 The device or file is opened with the O_EXCL flag. On Linux, this
834 ensures exclusive access to the floppy drive. On most other
835 architectures, and for plain files it has no effect at all.
838 File: mtools.info, Node: miscellaneous variables, Next: miscellaneous flags, Prev: open flags, Up: per drive variables
840 3.5.5 General Purpose Drive Variables
841 -------------------------------------
843 The following general purpose drive variables are available. Depending
844 to their type, these variables can be set to a string (precmd) or an
848 The number of FAT bits. This may be 12 or 16. This is very rarely
849 needed, as it can almost always be deduced from information in the
850 boot sector. On the contrary, describing the number of fat bits
851 may actually be harmful if you get it wrong. You should only use
852 it if mtools gets the auto-detected number of fat bits wrong, or if
853 you want to mformat a disk with a weird number of fat bits.
855 Describes the DOS code page used for short filenames. This is a
856 number between 1 and 999. By default, code page 850 is used. The
857 reason for this is because this code page contains most of the
858 characters that are also available in ISO-Latin-1. You may also
859 specify a global code page for all drives by using the global
860 'default_codepage' parameter (outside of any drive description).
861 This parameters exists starting at version 4.0.0
863 On some variants of Solaris, it is necessary to call 'volcheck -v'
864 before opening a floppy device, in order for the system to notice
865 that there is indeed a disk in the drive. 'precmd="volcheck -v"'
866 in the drive clause establishes the desired behavior.
869 This parameter represents a default block size to be always used on
870 this device. All I/O is done with multiples of this block size,
871 independently of the sector size registered in the file system's
872 boot sector. This is useful for character devices whose sector
873 size is not 512, such as for example CD-ROM drives on Solaris.
875 Only the 'file' variable is mandatory. The other parameters may be
876 left out. In that case a default value or an auto-detected value is
880 File: mtools.info, Node: miscellaneous flags, Next: multiple descriptions, Prev: miscellaneous variables, Up: per drive variables
882 3.5.6 General Purpose Drive Flags
883 ---------------------------------
885 A flag can either be set to 1 (enabled) or 0 (disabled). If the value
886 is omitted, it is enabled. For example, 'scsi' is equivalent to
890 Instruct mtools to not use locking on this drive. This is needed
891 on systems with buggy locking semantics. However, enabling this
892 makes operation less safe in cases where several users may access
893 the same drive at the same time.
896 When set to 1, this option tells mtools to use raw SCSI I/O instead
897 of the standard read/write calls to access the device. Currently,
898 this is supported on HP-UX, Solaris and SunOS. This is needed
899 because on some architectures, such as SunOS or Solaris, PC media
900 can't be accessed using the 'read' and 'write' system calls,
901 because the OS expects them to contain a Sun specific "disk label".
903 As raw SCSI access always uses the whole device, you need to
904 specify the "partition" flag in addition
906 On some architectures, such as Solaris, mtools needs root
907 privileges to be able to use the 'scsi' option. Thus mtools should
908 be installed setuid root on Solaris if you want to access Zip/Jaz
909 drives. Thus, if the 'scsi' flag is given, 'privileged' is
910 automatically implied, unless explicitly disabled by 'privileged=0'
912 Mtools uses its root privileges to open the device, and to issue
913 the actual SCSI I/O calls. Moreover, root privileges are only used
914 for drives described in a system-wide configuration file such as
915 '/etc/mtools.conf', and not for those described in '~/.mtoolsrc' or
919 When set to 1, this instructs mtools to use its setuid and setgid
920 privileges for opening the given drive. This option is only valid
921 for drives described in the system-wide configuration files (such
922 as '/etc/mtools.conf', not '~/.mtoolsrc' or '$MTOOLSRC').
923 Obviously, this option is also a no op if mtools is not installed
924 setuid or setgid. This option is implied by 'scsi=1', but again
925 only for drives defined in system-wide configuration files.
926 Privileged may also be set explicitly to 0, in order to tell mtools
927 not to use its privileges for a given drive even if 'scsi=1' is
930 Mtools only needs to be installed setuid if you use the
931 'privileged' or 'scsi' drive variables. If you do not use these
932 options, mtools works perfectly well even when not installed setuid
937 Instructs mtools to interpret the device name as a vold identifier
938 rather than as a filename. The vold identifier is translated into
939 a real filename using the 'media_findname()' and
940 'media_oldaliases()' functions of the 'volmgt' library. This flag
941 is only available if you configured mtools with the
942 '--enable-new-vold' option before compilation.
946 Consider the media as a word-swapped Atari disk.
949 If this is set to a non-zero value, mtools also tries to access
950 this disk as an XDF disk. XDF is a high capacity format used by
951 OS/2. This is off by default. *Note XDF::, for more details.
953 Tells mtools to use the geometry for this drive only for
954 mformatting and not for filtering.
957 Tells mtools to use the geometry for this drive both for
958 mformatting and filtering.
961 Tells mtools to connect to floppyd (*note floppyd::).
964 File: mtools.info, Node: multiple descriptions, Prev: miscellaneous flags, Up: per drive variables
966 3.5.7 Supplying multiple descriptions for a drive
967 -------------------------------------------------
969 It is possible to supply multiple descriptions for a drive. In that
970 case, the descriptions are tried in order until one is found that fits.
971 Descriptions may fail for several reasons:
973 1. because the geometry is not appropriate,
974 2. because there is no disk in the drive,
975 3. or because of other problems.
977 Multiple definitions are useful when using physical devices which are
978 only able to support one single disk geometry. Example:
979 drive a: file="/dev/fd0H1440" 1.44m
980 drive a: file="/dev/fd0H720" 720k
982 This instructs mtools to use /dev/fd0H1440 for 1.44m (high density)
983 disks and /dev/fd0H720 for 720k (double density) disks. On Linux, this
984 feature is not really needed, as the /dev/fd0 device is able to handle
987 You may also use multiple drive descriptions to access both of your
988 physical drives through one drive letter:
990 drive z: file="/dev/fd0"
991 drive z: file="/dev/fd1"
993 With this description, 'mdir z:' accesses your first physical drive
994 if it contains a disk. If the first drive doesn't contain a disk,
995 mtools checks the second drive.
997 When using multiple configuration files, drive descriptions in the
998 files parsed last override descriptions for the same drive in earlier
999 files. In order to avoid this, use the 'drive+' or '+drive' keywords
1000 instead of 'drive'. The first adds a description to the end of the list
1001 (i.e. it will be tried last), and the first adds it to the start of the
1005 File: mtools.info, Node: parsing order, Next: old style configuration, Prev: per drive variables, Up: Configuration
1007 3.6 Location of configuration files and parsing order
1008 =====================================================
1010 The configuration files are parsed in the following order:
1011 1. compiled-in defaults
1012 2. '/etc/mtools.conf'
1014 4. '$MTOOLSRC' (file pointed by the 'MTOOLSRC' environmental variable)
1016 Options described in the later files override those described in the
1017 earlier files. Drives defined in earlier files persist if they are not
1018 overridden in the later files. For instance, drives A and B may be
1019 defined in '/etc/mtools.conf' and drives C and D may be defined in
1020 '~/.mtoolsrc' However, if '~/.mtoolsrc' also defines drive A, this new
1021 description would override the description of drive A in
1022 '/etc/mtools.conf' instead of adding to it. If you want to add a new
1023 description to a drive already described in an earlier file, you need to
1024 use either the '+drive' or 'drive+' keyword.
1027 File: mtools.info, Node: old style configuration, Prev: parsing order, Up: Configuration
1029 3.7 Backwards compatibility with old configuration file syntax
1030 ==============================================================
1032 The syntax described herein is new for version 'mtools-3.0'. The old
1033 line-oriented syntax is still supported. Each line beginning with a
1034 single letter is considered to be a drive description using the old
1035 syntax. Old style and new style drive sections may be mixed within the
1036 same configuration file, in order to make upgrading easier. Support for
1037 the old syntax will be phased out eventually, and in order to discourage
1038 its use, I purposefully omit its description here.
1041 File: mtools.info, Node: Commands, Next: Compiling mtools, Prev: Configuration, Up: Top
1046 This section describes the available mtools commands, and the command
1047 line parameters that each of them accepts. Options which are common to
1048 all mtools commands are not described here, *note arguments:: for a
1049 description of those.
1053 * floppyd:: floppy daemon to run on your X server box
1054 * floppyd_installtest:: small utility to check for the presence of floppyd
1055 * mattrib:: change MS-DOS file attribute flags
1056 * mbadblocks:: tests a floppy disk, and marks the bad blocks in the FAT
1057 * mcat:: same as cat. Only useful with floppyd.
1058 * mcd:: change MS-DOS directory
1059 * mclasserase:: erase memory card
1060 * mcopy:: copy MS-DOS files to/from Unix
1061 * mdel:: delete an MS-DOS file
1062 * mdeltree:: recursively delete an MS-DOS directory
1063 * mdir:: display an MS-DOS directory
1064 * mdu:: list space occupied by directory and its contents
1065 * mformat:: add an MS-DOS file system to a low-level formatted floppy disk
1066 * minfo:: get information about an MS-DOS file system.
1067 * mlabel:: make an MS-DOS volume label
1068 * mkmanifest:: makes a list of short name equivalents
1069 * mmd:: make an MS-DOS subdirectory
1070 * mmount:: mount an MS-DOS disk
1071 * mpartition:: create an MS-DOS as a partition
1072 * mrd:: remove an MS-DOS subdirectory
1073 * mmove:: move or rename an MS-DOS file or subdirectory
1074 * mren:: rename an existing MS-DOS file
1075 * mshortname:: shows the short name of a file
1076 * mshowfat:: shows the FAT map of a file
1077 * mtoolstest:: tests and displays the configuration
1078 * mtype:: display contents of an MS-DOS file
1079 * mzip:: zip disk specific commands
1082 File: mtools.info, Node: floppyd, Next: floppyd_installtest, Prev: Commands, Up: Commands
1087 'Floppyd' is used as a server to grant access to the floppy drive to
1088 clients running on a remote machine, just as an X server grants access
1089 to the display to remote clients. It has the following syntax:
1091 'floppyd' ['-d'] ['-l'] ['-s' PORT] ['-r' USER] ['-b' IPADDR] ['-x'
1092 DISPLAY] DEVICENAMES
1094 'floppyd' is always associated with an X server. It runs on the same
1095 machine as its X server, and listens on port 5703 and above.
1097 4.1.1 Authentication
1098 --------------------
1100 'floppyd' authenticates remote clients using the 'Xauthority' protocol.
1101 Xhost authentication is not supported. Each floppyd is associated with
1102 an X server. When a remote client attempts to connect to floppyd, it
1103 sends floppyd the X authority record corresponding to floppyd's X
1104 server. Floppyd in turn then tries to open up a connection to the X
1105 server in order to verify the authenticity of the xauth record. If the
1106 connection to the X server succeeds, the client is granted access.
1109 *Caution*: In order to make authentication work correctly, the local
1110 host should *not* be listed in the 'xhost' list of allowed hosts.
1111 Indeed, hosts listed in 'xhost' do not need a correct 'Xauthority'
1112 cookie to connect to the X server. As 'floppyd' runs on the same host
1113 as the X server, all its probe connection would succeed even for clients
1114 who supplied a bad cookie. This means that your floppy drive would be
1115 open to the world, i.e. a huge security hole. If your X server does
1116 not allow you to remove 'localhost:0' and ':0' from the 'xhost' list,
1117 you can prevent floppyd from probing those display names with the '-l'
1120 4.1.2 Command line options
1121 --------------------------
1124 Daemon mode. Floppyd runs its own server loop. Do not supply this
1125 if you start floppyd from 'inetd.conf'
1127 Port number for daemon mode. Default is 5703 + DISPLAYNUMBER.
1128 This flag implies daemon mode. For example, for display
1129 'hitchhiker:5', the port would be 5708.
1131 Bind address (for multi homed hosts). This flag implies daemon
1134 Run the server under as the given user
1136 X display to use for authentication. By default, this is taken
1137 from the 'DISPLAY' variable. If neither the 'x' attribute is
1138 present nor 'DISPLAY' is set, floppyd uses ':0.0'.
1140 DEVICENAMES is a list of device nodes to be opened. Default is
1141 '/dev/fd0'. Multiple devices are only supported on mtools versions
1144 4.1.3 Connecting to floppyd
1145 ---------------------------
1147 In order to use floppyd, add the flag 'remote' to the device description
1148 in your '~/.mtoolsrc' file. If the flag 'remote' is given, the 'file'
1149 parameter of the device description is taken to be a remote address.
1150 It's format is the following:
1151 HOSTNAME':'DISPLAYNUMBER['/'[BASEPORT]['/'DRIVE]]. When using this
1152 entry, mtools connects to port BASEPORT+DISPLAYNUMBER at HOSTNAME. By
1153 default BASEPORT is 5703. The drive parameter is to distinguish among
1154 multiple drives associated with a single display (only mtools versions
1155 more recent than 3.9.11)
1160 The following starts a floppy daemon giving access to '/dev/fd0',
1161 listening on the default port 5703, tied to the default X servers:
1165 Each of the following starts a floppy daemon giving access to
1166 '/dev/fd1', tied to the :1 local X servers, and listening on port 5704.
1167 We assume that the local host is named 'hitchhiker'.
1170 floppyd -d -x :1 -p 5704 /dev/fd0
1172 If you want to start floppyd by 'inetd' instead of running it as a
1173 daemon, insert the following lines into '/etc/services':
1175 floppyd-0 5703/tcp # floppy daemon for X server :0
1176 floppyd-1 5704/tcp # floppy daemon for X server :1
1178 And insert the following into '/etc/inetd.conf' (assuming that you
1179 have defined a user named floppy in your '/etc/passwd'):
1182 floppyd-0 stream tcp wait floppy /usr/sbin/floppyd floppyd /dev/fd0
1183 floppyd-1 stream tcp wait floppy /usr/sbin/floppyd floppyd -x :1 /dev/fd0
1185 Note that you need to supply the X display names for the second
1186 floppyd. This is because the port is opened by inetd.conf, and hence
1187 floppyd cannot know its number to interfere the display number.
1189 On the client side, insert the following into your '~/.mtoolsrc' to
1190 define a drive letter accessing floppy drive in your X terminal:
1191 drive x: file="$DISPLAY" remote
1193 If your X terminal has more than one drive, you may access the
1194 additional drives as follows:
1195 drive y: file="$DISPLAY//1" remote
1196 drive z: file="$DISPLAY//2" remote
1199 File: mtools.info, Node: floppyd_installtest, Next: mattrib, Prev: floppyd, Up: Commands
1201 4.2 Floppyd_installtest
1202 =======================
1204 'Floppyd_installtest' is used to check for the presence of a running
1205 floppyd daemon. This is useful, if you have a small front-end script to
1206 mtools, which decides whether to use floppyd or not.
1208 'floppyd_installtest' ['-f'] Connect-String
1210 If the '-f' option is specified, 'floppyd_installtest' does a full
1211 X-Cookie authentication and complains if this does not work.
1213 The connect-String has the format described in the floppyd-section:
1214 HOSTNAME':'DISPLAYNUMBER['/'BASEPORT]
1217 File: mtools.info, Node: mattrib, Next: mbadblocks, Prev: floppyd_installtest, Up: Commands
1222 'Mattrib' is used to change MS-DOS file attribute flags. It has the
1225 'mattrib' ['-a|+a'] ['-h|+h'] ['-r|+r'] ['-s|+s'] ['-/'] ['-p']
1226 ['-X'] MSDOSFILE [ MSDOSFILES ... ]
1228 'Mattrib' adds attribute flags to an MS-DOS file (with the ''+''
1229 operator) or remove attribute flags (with the ''-'' operator).
1231 'Mattrib' supports the following attribute bits:
1234 Archive bit. Used by some backup programs to indicate a new file.
1236 Read-only bit. Used to indicate a read-only file. Files with this
1237 bit set cannot be erased by 'DEL' nor modified.
1239 System bit. Used by MS-DOS to indicate a operating system file.
1241 Hidden bit. Used to make files hidden from 'DIR'.
1243 'Mattrib' supports the following command line flags:
1245 Recursive. Recursively list the attributes of the files in the
1248 Concise. Prints the attributes without any whitespace padding. If
1249 neither the "/" option is given, nor the MSDOSFILE contains a
1250 wildcard, and there is only one MS-DOS file parameter on the
1251 command line, only the attribute is printed, and not the filename.
1252 This option is convenient for scripts
1254 Replay mode. Outputs a series of mformat commands that will
1255 reproduce the current situation, starting from a situation as left
1256 by untarring the MS-DOS file system. Commands are only output for
1257 attribute settings that differ from the default (archive bit set
1258 for files, unset for directories). This option is intended to be
1259 used in addition to tar. The 'readonly' attribute is not taken
1260 into account, as tar can set that one itself.
1263 File: mtools.info, Node: mbadblocks, Next: mcat, Prev: mattrib, Up: Commands
1268 The 'mbadblocks' command is used to mark some clusters on an MS-DOS
1269 filesystem bad. It has the following syntax:
1271 'mbadblocks' ['-s' SECTORLIST|'-c' CLUSTERLIST|-w] DRIVE':'
1273 If no command line flags are supplied, 'Mbadblocks' scans an MS-DOS
1274 filesystem for bad blocks by simply trying to read them and flag them if
1275 read fails. All blocks that are unused are scanned, and if detected bad
1276 are marked as such in the FAT.
1278 This command is intended to be used right after 'mformat'. It is not
1279 intended to salvage data from bad disks.
1281 4.4.1 Command line options
1282 --------------------------
1285 Use a list of bad clusters, rather than scanning for bad clusters
1288 Use a list of bad sectors (counted from beginning of filesystem),
1289 rather than trying for bad clusters itself.
1291 Write a random pattern to each cluster, then read it back and flag
1292 cluster as bad if mismatch. Only free clusters are tested in such
1293 a way, so any file data is preserved.
1298 'Mbadblocks' should (but doesn't yet :-( ) also try to salvage bad
1299 blocks which are in use by reading them repeatedly, and then mark them
1303 File: mtools.info, Node: mcat, Next: mcd, Prev: mbadblocks, Up: Commands
1308 The 'mcat' command is used to copy an entire disk image from or to the
1309 floppy device. It uses the following syntax:
1311 'mcat' ['-w'] DRIVE':'
1313 'Mcat' performs the same task as the Unix 'cat' command. It is
1314 included into the mtools package, since 'cat' cannot access remote
1315 floppy devices offered by the mtools floppy daemon. Now it is possible
1316 to create boot floppies remotely.
1318 The default operation is reading. The output is written to stdout.
1320 If the '-w' option is specified, mcat reads a disk-image from stdin
1321 and writes it to the given device. *Use this carefully!* Because of
1322 the low-level nature of this command, it will happily destroy any data
1323 written before on the disk without warning!
1326 File: mtools.info, Node: mcd, Next: mclasserase, Prev: mcat, Up: Commands
1331 The 'mcd' command is used to change the mtools working directory on the
1332 MS-DOS disk. It uses the following syntax:
1334 mcd [MSDOSDIRECTORY]
1336 Without arguments, 'mcd' reports the current device and working
1337 directory. Otherwise, 'mcd' changes the current device and current
1338 working directory relative to an MS-DOS file system.
1340 The environmental variable 'MCWD' may be used to locate the file
1341 where the device and current working directory information is stored.
1342 The default is '$HOME/.mcwd'. Information in this file is ignored if
1343 the file is more than 6 hours old.
1345 'Mcd' returns 0 on success or 1 on failure.
1347 Unlike MS-DOS versions of 'CD', 'mcd' can be used to change to
1348 another device. It may be wise to remove old '.mcwd' files at logout.
1351 File: mtools.info, Node: mclasserase, Next: mcopy, Prev: mcd, Up: Commands
1356 The 'mclasserase' command is used to wipe memory cards by overwriting it
1357 three times: first with '0xff', then with '0x00', then with '0xff'
1358 again. The command uses the following syntax:
1360 mclasserase [-d] MSDOSDRIVE
1362 MS-DOS drive is optional, if none is specified, use 'A:'. If more
1363 than one drive are specified, all but the last are ignored.
1365 'Mclasserase' accepts the following command line options:
1368 Stop after each erase cycle, for testing purposes
1372 'Mclasserase' returns 0 on success or -1 on failure.
1375 File: mtools.info, Node: mcopy, Next: mdel, Prev: mclasserase, Up: Commands
1380 The 'mcopy' command is used to copy MS-DOS files to and from Unix. It
1381 uses the following syntax:
1383 mcopy [-bspanvmQT] [-D CLASH_OPTION] SOURCEFILE TARGETFILE
1384 mcopy [-bspanvmQT] [-D CLASH_OPTION] SOURCEFILE [ SOURCEFILES... ] TARGETDIRECTORY
1385 mcopy [-tnvm] MSDOSSOURCEFILE
1387 'Mcopy' copies the specified file to the named file, or copies
1388 multiple files to the named directory. The source and target can be
1389 either MS-DOS or Unix files.
1391 The use of a drive letter designation on the MS-DOS files, 'a:' for
1392 example, determines the direction of the transfer. A missing drive
1393 designation implies a Unix file whose path starts in the current
1394 directory. If a source drive letter is specified with no attached file
1395 name (e.g. 'mcopy a: .'), all files are copied from that drive.
1397 If only a single, MS-DOS source parameter is provided (e.g. "mcopy
1398 a:foo.exe"), an implied destination of the current directory (''.'') is
1401 A filename of ''-'' means standard input or standard output,
1402 depending on its position on the command line.
1404 'Mcopy' accepts the following command line options:
1407 Text file transfer. Mcopy translates incoming carriage return/line
1408 feeds to line feeds when copying from MS-DOS to Unix, and
1409 vice-versa when copying from Unix to MS-DOS.
1411 Batch mode. Optimized for huge recursive copies, but less secure
1412 if a crash happens during the copy.
1414 Recursive copy. Also copies directories and their contents
1416 Preserves the attributes of the copied files
1418 When mcopying multiple files, quits as soon as one copy fails (for
1419 example due to lacking storage space on the target disk)
1421 Text (ASCII) file transfer. 'ASCII' translates incoming carriage
1422 return/line feeds to line feeds.
1424 Text (ASCII) file transfer with character set conversion. Differs
1425 from '-a' in the 'ASCII' also translates incoming PC-8 characters
1426 to ISO-8859-1 equivalents as far as possible. When reading DOS
1427 files, untranslatable characters are replaced by ''#''; when
1428 writing DOS files, untranslatable characters are replaced by ''.''.
1430 No confirmation when overwriting Unix files. 'ASCII' doesn't warn
1431 the user when overwriting an existing Unix file. If the target
1432 file already exists, and the '-n' option is not in effect, 'mcopy'
1433 asks whether to overwrite the file or to rename the new file (*note
1434 name clashes::) for details). In order to switch off confirmation
1435 for DOS files, use '-o'.
1437 Preserve the file modification time.
1439 Verbose. Displays the name of each file as it is copied.
1444 Unlike MS-DOS, the '+' operator (append) from MS-DOS is not supported.
1445 However, you may use 'mtype' to produce the same effect:
1446 mtype a:file1 a:file2 a:file3 >unixfile
1447 mtype a:file1 a:file2 a:file3 | mcopy - a:msdosfile
1450 File: mtools.info, Node: mdel, Next: mdeltree, Prev: mcopy, Up: Commands
1455 The 'mdel' command is used to delete an MS-DOS file. Its syntax is:
1457 'mdel' ['-v'] MSDOSFILE [ MSDOSFILES ... ]
1459 'Mdel' deletes files on an MS-DOS file system.
1461 'Mdel' asks for verification prior to removing a read-only file.
1464 File: mtools.info, Node: mdeltree, Next: mdir, Prev: mdel, Up: Commands
1469 The 'mdeltree' command is used to delete an MS-DOS file. Its syntax is:
1471 'mdeltree' ['-v'] MSDOSDIRECTORY [MSDOSDIRECTORIES...]
1473 'Mdeltree' removes a directory and all the files and subdirectories
1474 it contains from an MS-DOS file system. An error occurs if the
1475 directory to be removed does not exist.
1478 File: mtools.info, Node: mdir, Next: mdu, Prev: mdeltree, Up: Commands
1483 The 'mdir' command is used to display an MS-DOS directory. Its syntax
1486 'mdir' ['-/'] ['-f'] ['-w'] ['-a'] ['-b'] MSDOSFILE [ MSDOSFILES...]
1488 'Mdir' displays the contents of MS-DOS directories, or the entries
1489 for some MS-DOS files.
1491 'Mdir' supports the following command line options:
1494 Recursive output, just like MS-DOS' '-s' option
1496 Wide output. With this option, 'mdir' prints the filenames across
1497 the page without displaying the file size or creation date.
1499 Also list hidden files.
1501 Fast. Do not try to find out free space. On larger disks, finding
1502 out the amount of free space takes up some non trivial amount of
1503 time, as the whole FAT must be read in and scanned. The '-f' flag
1504 bypasses this step. This flag is not needed on FAT32 file systems,
1505 which store the size explicitly.
1507 Concise listing. Lists each directory name or filename, one per
1508 line (including the filename extension). This switch displays no
1509 heading information and no summary. Only a newline separated list
1510 of pathnames is displayed.
1512 An error occurs if a component of the path is not a directory.
1515 File: mtools.info, Node: mdu, Next: mformat, Prev: mdir, Up: Commands
1520 'Mdu' is used to list the space occupied by a directory, its
1521 subdirectories and its files. It is similar to the 'du' command on
1522 Unix. The unit used are clusters. Use the minfo command to find out
1525 'mdu' ['-a'] [ MSDOSFILES ... ]
1528 All files. List also the space occupied for individual files.
1530 Only list the total space, don't give details for each
1534 File: mtools.info, Node: mformat, Next: mkmanifest, Prev: mdu, Up: Commands
1539 The 'mformat' command is used to add an MS-DOS file system to a
1540 low-level formatted diskette. Its syntax is:
1542 'mformat' ['-t' CYLINDERS|'-T' TOT_SECTORS] ['-h' HEADS] ['-s' SECTORS]
1543 ['-f' SIZE] ['-1'] ['-4'] ['-8']
1545 ['-F'] ['-S' SIZECODE]
1546 ['-M' SOFTWARE_SECTOR_SIZE]
1547 ['-N' SERIAL_NUMBER] ['-a']
1548 ['-C'] ['-H' HIDDEN_SECTORS] ['-I' FSVERSION]
1549 ['-r' ROOT_SECTORS] ['-L' FAT_LEN]
1550 ['-B' BOOT_SECTOR] ['-k']
1551 ['-m' MEDIA_DESCRIPTOR]
1553 ['-R' NB_RESERVED_SECTORS]
1554 ['-c' CLUSTERS_PER_SECTOR]
1556 ['-X'] ['-2' SECTORS_ON_TRACK_0] ['-3']
1557 ['-0' RATE_ON_TRACK_0] ['-A' RATE_ON_OTHER_TRACKS]
1560 'Mformat' adds a minimal MS-DOS file system (boot sector, FAT, and
1561 root directory) to a diskette that has already been formatted by a Unix
1564 The following options are supported: (The S, 2, 1 and M options may
1565 not exist if this copy of mtools has been compiled without the USE_2M
1568 The following options are the same as for MS-DOS's format command:
1571 Specifies the volume label. A volume label identifies the disk and
1572 can be a maximum of 11 characters. If you omit the -v switch,
1573 mformat will assign no label to the disk.
1575 Specifies the size of the DOS file system to format. Only a
1576 certain number of predefined sizes are supported by this flag; for
1577 others use the -h/-t/-s flags. The following sizes are supported:
1579 160K, single-sided, 8 sectors per track, 40 cylinders (for 5
1582 160K, single-sided, 9 sectors per track, 40 cylinders (for 5
1585 320K, double-sided, 8 sectors per track, 40 cylinders (for 5
1588 360K, double-sided, 9 sectors per track, 40 cylinders (for 5
1591 720K, double-sided, 9 sectors per track, 80 cylinders (for 3
1594 1200K, double-sided, 15 sectors per track, 80 cylinders (for 5
1597 1440K, double-sided, 18 sectors per track, 80 cylinders (for 3
1600 2880K, double-sided, 36 sectors per track, 80 cylinders (for 3
1604 Specifies the number of tracks on the disk.
1606 Specifies the number of total sectors on the disk. Only one of
1607 these 2 options may be specified (tracks or total sectors)
1609 The number of heads (sides).
1611 Specifies the number of sectors per track. If the 2m option is
1612 given, number of 512-byte sector equivalents on generic tracks
1613 (i.e. not head 0 track 0). If the 2m option is not given, number
1614 of physical sectors per track (which may be bigger than 512 bytes).
1617 Formats a single side (equivalent to -h 1)
1620 Formats a 360K double-sided disk (equivalent to -f 360). When used
1621 together with -the 1 switch, this switch formats a 180K disk
1624 Formats a disk with 8 sectors per track.
1626 MS-DOS format's 'q', 'u' and 'b' options are not supported, and 's'
1627 has a different meaning.
1629 The following options are specific to mtools:
1632 Format the partition as FAT32.
1635 The size code. The size of the sector is 2 ^ (sizecode + 7).
1637 formats the disk as an XDF disk. *Note XDF::, for more details.
1638 The disk has first to be low-level formatted using the xdfcopy
1639 utility included in the fdutils package. XDF disks are used for
1640 instance for OS/2 install disks.
1642 2m format. The parameter to this option describes the number of
1643 sectors on track 0, head 0. This option is recommended for sectors
1646 don't use a 2m format, even if the current geometry of the disk is
1649 Data transfer rate on track 0
1651 Data transfer rate on tracks other than 0
1653 software sector size. This parameter describes the sector size in
1654 bytes used by the MS-DOS file system. By default it is the
1655 physical sector size.
1657 Uses the requested serial number, instead of generating one
1660 If this option is given, an Atari style serial number is generated.
1661 Ataris store their serial number in the OEM label.
1663 creates the disk image file to install the MS-DOS file system on
1664 it. Obviously, this is useless on physical devices such as
1665 floppies and hard disk partitions, but is interesting for image
1668 number of hidden sectors. This parameter is useful for formatting
1669 hard disk partition, which are not aligned on track boundaries
1670 (i.e. first head of first track doesn't belong to the partition,
1671 but contains a partition table). In that case the number of hidden
1672 sectors is in general the number of sectors per cylinder. This is
1675 Sets the fsVersion id when formatting a FAT32 drive. In order to
1676 find this out, run minfo on an existing FAT32 drive, and mail me
1677 about it, so I can include the correct value in future versions of
1680 Sets the size of a cluster (in sectors). If this cluster size
1681 would generate a FAT that too big for its number of bits, mtools
1682 automatically increases the cluster size, until the FAT is small
1683 enough. If no cluster size is specified explicitly, mtools uses a
1684 default value as described in section "Number of sectors per
1687 Sets the number of FAT copies. Default is 2. This setting can
1688 also be specified using the 'MTOOLS_NFATS' environment variable.
1690 Sets the size of the root directory (in sectors). Only applicable
1691 to 12 and 16 bit FATs. This setting can also be specified using
1692 the 'MTOOLS_DIR_LEN' environment variable.
1694 Sets the length of the FAT.
1696 Use the boot sector stored in the given file or device, instead of
1697 using its own. Only the geometry fields are updated to match the
1698 target disks parameters.
1700 Keep the existing boot sector as much as possible. Only the
1701 geometry fields and other similar file system data are updated to
1702 match the target disks parameters.
1704 Sets the sector number where the backup of the boot sector should
1705 be stored (only relevant on FAT32).
1707 Sets the number of reserved sectors for this filesystem. This must
1708 be at least 1 for non-FAT32 disks, and at least 3 for FAT disks (in
1709 order to accommodate the boot sector, the info sector and the
1710 backup boot sector).
1713 Use a non-standard media descriptor byte for this disk. The media
1714 descriptor is stored at position 21 of the boot sector, and as
1715 first byte in each FAT copy. Using this option may confuse DOS or
1716 older mtools version, and may make the disk unreadable. Only use
1717 if you know what you are doing.
1719 To format a diskette at a density other than the default, you must
1720 supply (at least) those command line parameters that are different from
1723 'Mformat' returns 0 on success or 1 on failure.
1725 It doesn't record bad block information to the Fat, use 'mbadblocks'
1728 4.13.1 Number of sectors per cluster
1729 ------------------------------------
1731 If the user indicates no cluster size, mformat figures out a default
1734 For FAT32 it uses the following table to determine the number of
1735 sectors per cluster, depending on the total number of sectors on the
1738 more than 32*1024*1024*2: 64 sectors
1739 between 16*1024*1024*2 and 32*1024*1024*2: 32 sectors
1740 between 8*1024*1024*2 and 16*1024*1024*2: 16 sectors
1741 between 260*1024*2 and 81024*1024*2: 1 sectors
1743 This is derived from information on page 20 of Microsoft's
1744 'fatgen103' document, which currently can be found at the following
1747 'https://staff.washington.edu/dittrich/misc/fatgen103.pdf'
1749 For FAT12 and FAT16, mformat uses an iterative approach, where it
1750 starts with a set value, which it doubles until it is able to fill up
1751 the disk using that cluster size and a number of cluster less than the
1754 The starting value is 1 for disks with one head or less than 2000
1755 sectors, and 2 for disks with more than one head, and more than 2000
1758 The number of sectors per cluster cannot go beyond 128.
1761 File: mtools.info, Node: mkmanifest, Next: minfo, Prev: mformat, Up: Commands
1766 The 'mkmanifest' command is used to create a shell script (packing list)
1767 to restore Unix filenames. Its syntax is:
1769 'mkmanifest' [ FILES ]
1771 'Mkmanifest' creates a shell script that aids in the restoration of
1772 Unix filenames that got clobbered by the MS-DOS filename restrictions.
1773 MS-DOS filenames are restricted to 8 character names, 3 character
1774 extensions, upper case only, no device names, and no illegal characters.
1776 The mkmanifest program is compatible with the methods used in 'pcomm,
1777 arc,' and 'mtools' to change perfectly good Unix filenames to fit the
1778 MS-DOS restrictions. This command is only useful if the target system
1779 which will read the diskette cannot handle VFAT long names.
1784 You want to copy the following Unix files to a MS-DOS diskette (using
1785 the 'mcopy' command).
1794 'ASCII' converts the names to:
1804 mkmanifest very_long_name 2.many.dots illegal: good.c prn.dev Capital >manifest
1805 would produce the following:
1806 mv very_lon very_long_name
1807 mv 2xmany.dot 2.many.dots
1808 mv illegalx illegal:
1812 Notice that "good.c" did not require any conversion, so it did not
1813 appear in the output.
1815 Suppose I've copied these files from the diskette to another Unix
1816 system, and I now want the files back to their original names. If the
1817 file "manifest" (the output captured above) was sent along with those
1818 files, it could be used to convert the filenames.
1823 The short names generated by 'mkmanifest' follow the old convention
1824 (from mtools-2.0.7) and not the one from Windows 95 and mtools-3.0.
1827 File: mtools.info, Node: minfo, Next: mlabel, Prev: mkmanifest, Up: Commands
1832 The 'minfo' command prints the parameters of a MS-DOS file system, such
1833 as number of sectors, heads and cylinders. It also prints an mformat
1834 command line which can be used to create a similar MS-DOS file system on
1835 another media. However, this doesn't work with 2m or XDF media, and
1836 with MS-DOS 1.0 file systems
1839 Minfo supports the following option:
1841 Prints a hexdump of the boot sector, in addition to the other
1845 File: mtools.info, Node: mlabel, Next: mmd, Prev: minfo, Up: Commands
1850 The 'mlabel' command adds a volume label to a disk. Its syntax is:
1851 'mlabel' ['-vcsn'] ['-N' SERIAL] DRIVE:[NEW_LABEL]
1853 'Mlabel' displays the current volume label, if present. If NEW_LABEL
1854 is not given, and if neither the 'c' nor the 's' options are set, it
1855 prompts the user for a new volume label. To delete an existing volume
1856 label, press return at the prompt.
1858 The label is limited to 11 single-byte characters, e.g.
1861 Reasonable care is taken to create a valid MS-DOS volume label. If
1862 an invalid label is specified, 'mlabel' changes the label (and displays
1863 the new label if the verbose mode is set). 'Mlabel' returns 0 on
1864 success or 1 on failure.
1866 Mlabel supports the following options:
1868 Clears an existing label, without prompting the user
1870 Shows the existing label, without prompting the user.
1872 Assigns a new (random) serial number to the disk
1874 Sets the supplied serial number. The serial number should be
1875 supplied as an 8 digit hexadecimal number, without spaces
1878 File: mtools.info, Node: mmd, Next: mmount, Prev: mlabel, Up: Commands
1883 The 'mmd' command is used to make an MS-DOS subdirectory. Its syntax
1886 'mmd' ['-D' CLASH_OPTION] MSDOSDIRECTORY [ MSDOSDIRECTORIES... ]
1888 'Mmd' makes a new directory on an MS-DOS file system. An error
1889 occurs if the directory already exists.
1892 File: mtools.info, Node: mmount, Next: mmove, Prev: mmd, Up: Commands
1897 The 'mmount' command is used to mount an MS-DOS disk. It is only
1898 available on Linux, as it is only useful if the OS kernel allows
1899 configuration of the disk geometry. Its syntax is:
1901 'mmount' MSDOSDRIVE [MOUNTARGS]
1903 'Mmount' reads the boot sector of an MS-DOS disk, configures the
1904 drive geometry, and finally mounts it passing 'mountargs' to 'mount. '
1905 If no mount arguments are specified, the name of the device is used. If
1906 the disk is write protected, it is automatically mounted read only.
1909 File: mtools.info, Node: mmove, Next: mpartition, Prev: mmount, Up: Commands
1914 The 'mmove' command is used to moves or renames an existing MS-DOS file
1916 'mmove' ['-v'] ['-D' CLASH_OPTION] SOURCEFILE TARGETFILE
1917 'mmove' ['-v'] ['-D' CLASH_OPTION] SOURCEFILE [ SOURCEFILES... ] TARGETDIRECTORY
1918 'Mmove' moves or renames an existing MS-DOS file or subdirectory.
1919 Unlike the MS-DOS version of 'MOVE', 'mmove' is able to move
1920 subdirectories. Files or directories can only be moved within one file
1921 system. Data cannot be moved from MS-DOS to Unix or vice-versa. If you
1922 omit the drive letter from the target file or directory, the same letter
1923 as for the source is assumed. If you omit the drive letter from all
1924 parameters, drive a: is assumed by default.
1927 File: mtools.info, Node: mpartition, Next: mrd, Prev: mmove, Up: Commands
1932 The 'mpartition' command is used to create MS-DOS file systems as
1933 partitions. This is intended to be used on non-Linux systems, i.e.
1934 systems where fdisk and easy access to SCSI devices are not available.
1935 This command only works on drives whose partition variable is set.
1937 'mpartition' '-p' DRIVE
1938 'mpartition' '-r' DRIVE
1939 'mpartition' '-I' ['-B' BOOTSECTOR] DRIVE
1940 'mpartition' '-a' DRIVE
1941 'mpartition' '-d' DRIVE
1942 'mpartition' '-c' ['-s' SECTORS] ['-h' HEADS]
1943 ['-t' CYLINDERS] ['-v' ['-T' TYPE] ['-b'
1944 BEGIN] ['-l' length] ['-f']
1947 Mpartition supports the following operations:
1950 Prints a command line to recreate the partition for the drive.
1951 Nothing is printed if the partition for the drive is not defined,
1952 or an inconsistency has been detected. If verbose ('-v') is also
1953 set, prints the current partition table.
1955 Removes the partition described by DRIVE.
1957 Initializes the partition table, and removes all partitions.
1959 Creates the partition described by DRIVE.
1961 "Activates" the partition, i.e. makes it bootable. Only one
1962 partition can be bootable at a time.
1964 "Deactivates" the partition, i.e. makes it unbootable.
1966 If no operation is given, the current settings are printed.
1968 For partition creations, the following options are available:
1970 The number of sectors per track of the partition (which is also the
1971 number of sectors per track for the whole drive).
1973 The number of heads of the partition (which is also the number of
1974 heads for the whole drive). By default, the geometry information
1975 (number of sectors and heads) is figured out from neighboring
1976 partition table entries, or guessed from the size.
1978 The number of cylinders of the partition (not the number of
1979 cylinders of the whole drive.
1981 The starting offset of the partition, expressed in sectors. If
1982 begin is not given, mpartition lets the partition begin at the
1983 start of the disk (partition number 1), or immediately after the
1984 end of the previous partition.
1986 The size (length) of the partition, expressed in sectors. If end
1987 is not given, mpartition figures out the size from the number of
1988 sectors, heads and cylinders. If these are not given either, it
1989 gives the partition the biggest possible size, considering disk
1990 size and start of the next partition.
1992 The following option is available for all operation which modify the
1995 Usually, before writing back any changes to the partition,
1996 mpartition performs certain consistency checks, such as checking
1997 for overlaps and proper alignment of the partitions. If any of
1998 these checks fails, the partition table is not changes. The '-f'
1999 allows you to override these safeguards.
2001 The following options are available for all operations:
2003 Together with '-p' prints the partition table as it is now (no
2004 change operation), or as it is after it is modified.
2006 If the verbosity flag is given twice, mpartition will print out a
2007 hexdump of the partition table when reading it from and writing it
2010 The following option is available for partition table initialization:
2012 Reads the template master boot record from file BOOTSECTOR.
2014 4.20.1 Choice of partition type
2015 -------------------------------
2017 Mpartition proceeds as follows to pick a type for the partition:
2019 - FAT32 partitions are assigned type 0x0C ("'Win95 FAT32, LBA'")
2021 - For all others, if the partition fits entirely within the 65536
2022 sector of the disk, assign 0x01 ("'DOS FAT12, CHS'") for FAT12
2023 partition and 0x04 ("'DOS FAT16, CHS'") for FAT16 partitions
2025 - If not covered by the above, assign 0x06 ("'DOS BIG FAT16 CHS'") if
2026 partition fits entirely within the first 1024 cylinders (CHS mode)
2028 - All remaining cases get 0x0E ("'Win95 BIG FAT16, LBA'")
2030 If number of fat bits is not known (not specified in drive's
2031 definition), then FAT12 is assumed for all drives with less than 4096
2032 sectors, and FAT16 for those with more than 4096 sectors.
2034 This corresponds more or less to the definitions outlined at
2035 'https://en.wikipedia.org/wiki/Partition_type#List_of_partition_IDs' and
2036 'https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc977219(v=technet.10)',
2037 with two notable differences:
2039 - If fat bits are unknown, the reference documents consider drives
2040 with less than 32680 sectors to be FAT12. Mtools uses 4096 sectors
2041 as the cutoff point, as older versions of DOS only support FAT12 on
2042 disks with less than 4096 sectors (and these older versions are the
2043 ones which would be most likely to use FAT12 in the first place).
2045 - The reference documents use a 8GB (wikipedia) or a 4GB (Microsoft)
2046 cutoff between 0x06 ('DOS BIG FAT16 CHS') and 0x0E. Mtools uses
2047 1024 cylinders. This is because any partition beyond 1024
2048 cylinders must be LBA and cannot be CHS. 8GB works out to be the
2049 biggest capacity which can be represented as CHS (63 sectors, 255
2050 heads and 1024 cylinders). 4GB is the capacity limit for windows
2051 2000, so it makes sense that a documentation for windows 2000 would
2052 specify this as the upper limit for any partition type.
2055 File: mtools.info, Node: mrd, Next: mren, Prev: mpartition, Up: Commands
2060 The 'mrd' command is used to remove an MS-DOS subdirectory. Its syntax
2063 'mrd' ['-v'] MSDOSDIRECTORY [ MSDOSDIRECTORIES... ]
2065 'Mrd' removes a directory from an MS-DOS file system. An error
2066 occurs if the directory does not exist or is not empty.
2069 File: mtools.info, Node: mren, Next: mshortname, Prev: mrd, Up: Commands
2074 The 'mren' command is used to rename or move an existing MS-DOS file or
2075 subdirectory. Its syntax is:
2077 'mren' ['-voOsSrRA'] SOURCEFILE TARGETFILE
2079 'Mren' renames an existing file on an MS-DOS file system.
2081 In verbose mode, 'Mren' displays the new filename if the name
2082 supplied is invalid.
2084 If the first syntax is used (only one source file), and if the target
2085 name doesn't contain any slashes or colons, the file (or subdirectory)
2086 is renamed in the same directory, instead of being moved to the current
2087 'mcd' directory as would be the case with 'mmove'. Unlike the MS-DOS
2088 version of 'REN', 'mren' can be used to rename directories.
2091 File: mtools.info, Node: mshortname, Next: mshowfat, Prev: mren, Up: Commands
2096 The 'mshortname' command is used to display the short name of a file.
2101 The shortname is displayed as it is stored in raw format on disk,
2102 without any character set conversion.
2105 File: mtools.info, Node: mshowfat, Next: mtoolstest, Prev: mshortname, Up: Commands
2110 The 'mshowfat' command is used to display the FAT entries for a file.
2113 'mshowfat' ['-o' OFFSET] FILES
2115 If no offset is given, a list of all clusters occupied by the file is
2116 printed. If an offset is given, only the number of the cluster
2117 containing that offset is printed.
2120 File: mtools.info, Node: mtoolstest, Next: mtype, Prev: mshowfat, Up: Commands
2125 The 'mtoolstest' command is used to tests the mtools configuration
2126 files. To invoke it, just type 'mtoolstest' without any arguments.
2127 'Mtoolstest' reads the mtools configuration files, and prints the
2128 cumulative configuration to 'stdout'. The output can be used as a
2129 configuration file itself (although you might want to remove redundant
2130 clauses). You may use this program to convert old-style configuration
2131 files into new style configuration files.
2134 File: mtools.info, Node: mtype, Next: mzip, Prev: mtoolstest, Up: Commands
2139 The 'mtype' command is used to display contents of an MS-DOS file. Its
2142 'mtype' ['-ts'] MSDOSFILE [ MSDOSFILES... ]
2144 'Mtype' displays the specified MS-DOS file on the screen.
2146 In addition to the standard options, 'Mtype' allows the following
2147 command line options:
2150 Text file viewing. 'Mtype' translates incoming carriage
2151 return/line feeds to line feeds.
2153 'Mtype' strips the high bit from the data.
2155 The 'mcd' command may be used to establish the device and the current
2156 working directory (relative to MS-DOS), otherwise the default is 'A:/'.
2158 'Mtype' returns 0 on success, 1 on utter failure, or 2 on partial
2161 Unlike the MS-DOS version of 'TYPE', 'mtype' allows multiple
2165 File: mtools.info, Node: mzip, Prev: mtype, Up: Commands
2170 The 'mzip' command is used to issue ZIP disk specific commands on Linux,
2171 Solaris or HP-UX. Its syntax is:
2175 'Mzip' allows the following command line options:
2180 Force eject even if the disk is mounted (must be given in addition
2183 Write protect the disk.
2185 Remove write protection.
2187 Password write protect.
2191 Temporarily unprotect the disk until it is ejected. The disk
2192 becomes writable, and reverts back to its old state when ejected.
2196 To remove the password, set it to one of the password-less modes '-r'
2197 or '-w': mzip will then ask you for the password, and unlock the disk.
2198 If you have forgotten the password, you can get rid of it by low-level
2199 formatting the disk (using your SCSI adapter's BIOS setup).
2201 The ZipTools disk shipped with the drive is also password protected.
2202 On MS-DOS or on a Mac, this password is automatically removed once the
2203 ZipTools have been installed. From various articles posted to Usenet, I
2204 learned that the password for the tools disk is 'APlaceForYourStuff'(1).
2205 Mzip knows about this password, and tries it first, before prompting you
2206 for a password. Thus 'mzip -w z:' unlocks the tools disk(2). The tools
2207 disk is formatted in a special way so as to be usable both in a PC and
2208 in a Mac. On a PC, the Mac file system appears as a hidden file named
2209 'partishn.mac'. You may erase it to reclaim the 50 Megs of space taken
2210 up by the Mac file system.
2215 This command is a big kludge. A proper implementation would take a
2216 rework of significant parts of mtools, but unfortunately I don't have
2217 the time for this right now. The main downside of this implementation
2218 is that it is inefficient on some architectures (several successive
2219 calls to mtools, which defeats mtools' caching).
2221 ---------- Footnotes ----------
2223 (1) To see the articles, search for 'APlaceForYourStuff' using Google
2226 (2) I didn't know about this yet when I bought my own Zip drive.
2227 Thus I ended up reformatting my tools disk, and hence I haven't had the
2228 opportunity to test the password yet. If anybody still has their tools
2229 disk with the original password, could you try it out? Thanks in
2233 File: mtools.info, Node: Compiling mtools, Next: Porting mtools, Prev: Commands, Up: Top
2235 5 Architecture specific compilation flags
2236 *****************************************
2238 To compile mtools, first invoke './configure' before 'make'. In
2239 addition to the standard 'autoconfigure' flags, there are two
2240 architecture specific flags available.
2242 './configure --enable-xdf'
2243 './configure --disable-xdf'
2244 Enables support for XDF disks. This is on by default. *Note
2246 './configure --enable-vold'
2247 './configure --disable-vold'
2248 Enables support for vold on Solaris. When used in conjunction with
2249 vold, mtools should use different device nodes than for direct
2252 './configure --enable-new-vold'
2253 './configure --disable-new-vold'
2254 Enables new support for vold on Solaris. This is supposed to work
2255 more smoothly than the old support.
2257 './configure --enable-floppyd'
2258 './configure --disable-floppyd'
2259 Enables support for floppyd. By default, floppyd support is
2260 enabled as long as the necessary X includes and libraries are
2264 File: mtools.info, Node: Porting mtools, Next: Command Index, Prev: Compiling mtools, Up: Top
2266 6 Porting mtools to architectures which are not supported yet
2267 *************************************************************
2269 This chapter is only interesting for those who want to port mtools to an
2270 architecture which is not yet supported. For most common systems,
2271 default drives are already defined. If you want to add default drives
2272 for a still unsupported system, run configuration.guess, to see which
2273 identification autoconf uses for that system. This identification is of
2274 the form cpu-vendor-os (for example sparc-sun-sunos). The cpu and the
2275 OS parts are passed to the compiler as preprocessor flags. The OS part
2276 is passed to the compiler in three forms.
2277 1. The complete OS name, with dots replaced by underscores. SCO3.2v2
2278 would yield sco3_2v2
2279 2. The base OS name. SCO3.2v2 would yield Sco
2280 3. The base OS name plus its major version. SCO3.2v2 would yield Sco3
2282 All three versions are passed, if they are different.
2284 To define the devices, use the entries for the systems that are
2285 already present as templates. In general, they have the following form:
2287 #if (defined (my_cpu) && defined(my_os))
2288 #define predefined_devices
2289 struct device devices[] = {
2290 { "/dev/first_drive", 'drive_letter', drive_description},
2292 { "/dev/last_drive", 'drive_letter', drive_description}
2297 "/dev/first_drive" is the name of the device or image file
2298 representing the drive. Drive_letter is a letter ranging from a to z
2299 giving access to the drive. Drive_description describes the type of the
2302 extra density (2.88M) 3 1/2 disk
2304 high density 3 1/2 disk
2306 double density 3 1/2 disk
2308 high density 5 1/4 disk
2310 double density 5 1/4 disk
2312 8 sector double density 5 1/4 disk
2314 single sided double density 5 1/4 disk
2316 single sided 8 sector double density 5 1/4 disk
2318 generic floppy drive (12 bit FAT)
2320 generic hard disk (16 bit FAT)
2322 generic device (all parameters match)
2324 generic ZIP drive using normal access. This uses partition 4.
2325 'Flags' are any special flags to be passed to open.
2327 generic ZIP drive using raw SCSI access. This uses partition 4.
2328 'Flags' are any special flags to be passed to open.
2330 the remote drive used for floppyd. Unlike the other items, this
2331 macro also includes the file name ($DISPLAY) and the drive letter
2334 Entries may be described in more detail:
2335 fat_bits,open_flags,cylinders,heads,sectors,DEF_ARG
2336 or, if you need to describe an offset (file system doesn't start at
2337 beginning of file system)
2338 fat_bits, open_flags, cylinders, heads, sectors, offset, DEF_ARG0
2341 is either 12, 16 or 0. 0 means that the device accepts both types
2344 may include flags such as O_NDELAY, or O_RDONLY, which might be
2345 necessary to open the device. 0 means no special flags are needed.
2346 'cylinders,heads,sectors'
2347 describe the geometry of the disk. If cylinders is 0, the heads
2348 and sectors parameters are ignored, and the drive accepts any
2351 is used if the DOS file system doesn't begin at the start of the
2352 device or image file. This is mostly useful for Atari Ram disks
2353 (which contain their device driver at the beginning of the file) or
2354 for DOS emulator images (which may represent a partitioned device.
2356 Definition of defaults in the devices file should only be done if
2357 these same devices are found on a large number of hosts of this type.
2358 In that case, could you also let me know about your new definitions, so
2359 that I can include them into the next release. For purely local file, I
2360 recommend that you use the '/etc/mtools.conf' and '~/.mtoolsrc'
2361 configuration files.
2363 However, the devices files also allows you to supply geometry setting
2364 routines. These are necessary if you want to access high capacity
2367 Two routines should be supplied:
2369 1. Reading the current parameters
2370 static inline int get_parameters(int fd, struct generic_floppy_struct *floppy)
2372 This probes the current configured geometry, and return it in the
2373 structure generic_floppy_struct (which must also be declared). Fd
2374 is an open file descriptor for the device, and buf is an already
2375 filled in stat structure, which may be useful. This routine should
2376 return 1 if the probing fails, and 0 otherwise.
2378 2. Setting new parameters
2379 static inline int set_parameters(int fd, struct generic_floppy_struct *floppy)
2381 This configures the geometry contained in floppy on the file
2382 descriptor fd. Buf is the result of a stat call (already filled
2383 in). This should return 1 if the new geometry cannot be
2384 configured, and 0 otherwise.
2386 A certain number of preprocessor macros should also be supplied:
2389 refers to the track field in the floppy structure
2391 refers to the heads field in the floppy structure
2393 refers to the sectors per track field in the floppy structure
2394 'SECTORS_PER_DISK(floppy)'
2395 refers to the sectors per disk field in the floppy structure (if
2396 applicable, otherwise leave undefined)
2399 major number of the floppy device, when viewed as a block device
2402 major number of the floppy device, when viewed as a character
2403 device (a.k.a. "raw" device, used for fsck) (leave this undefined,
2404 if your OS doesn't have raw devices)
2406 For the truly high capacity formats (XDF, 2m, etc), there is no clean
2407 and documented interface yet.
2410 File: mtools.info, Node: Command Index, Next: Variable Index, Prev: Porting mtools, Up: Top
2416 File: mtools.info, Node: Variable Index, Next: Concept Index, Prev: Command Index, Up: Top
2424 * cylinders: geometry description. (line 60)
2425 * drive: general information. (line 6)
2426 * exclusive: open flags. (line 6)
2427 * fat_bits: miscellaneous variables.
2429 * file: location information. (line 10)
2430 * filter: miscellaneous flags. (line 78)
2431 * heads: geometry description. (line 63)
2432 * mformat_only: miscellaneous flags. (line 74)
2433 * MTOOLSRC: Configuration. (line 18)
2434 * MTOOLS_DOTTED_DIR: global variables. (line 6)
2435 * MTOOLS_FAT_COMPATIBILITY: global variables. (line 6)
2436 * MTOOLS_LOCK_TIMEOUT: global variables. (line 6)
2437 * MTOOLS_LOWER_CASE: global variables. (line 6)
2438 * MTOOLS_NAME_NUMERIC_TAIL: global variables. (line 6)
2439 * MTOOLS_NO_VFAT: global variables. (line 6)
2440 * MTOOLS_SKIP_CHECK: global variables. (line 6)
2441 * MTOOLS_TWENTY_FOUR_HOUR_CLOCK: global variables. (line 6)
2442 * nodelay: open flags. (line 6)
2443 * sectors: geometry description. (line 65)
2444 * sync: open flags. (line 6)
2445 * tracks: geometry description. (line 60)
2446 * use_xdf: miscellaneous flags. (line 70)
2449 File: mtools.info, Node: Concept Index, Prev: Variable Index, Up: Top
2458 * ALPHA patches: Location. (line 6)
2459 * APlaceForYourStuff: mzip. (line 6)
2460 * Archive bit: mattrib. (line 6)
2461 * Atari: miscellaneous flags. (line 66)
2462 * Atari Ram disk: location information. (line 28)
2463 * Backwards compatibility: old style configuration.
2465 * Bad blocks: mbadblocks. (line 6)
2466 * bigger sectors: bigger sectors. (line 6)
2467 * blocksize: miscellaneous variables.
2469 * bugs: Location. (line 6)
2470 * Case sensitivity: case sensitivity. (line 6)
2471 * Changing file attributes: mattrib. (line 6)
2472 * character devices: miscellaneous variables.
2474 * Checking configuration file: mtoolstest. (line 6)
2475 * Clusters of a file: mshowfat. (line 6)
2476 * Command list: Commands. (line 6)
2477 * Compile time configuration: Compiling mtools. (line 6)
2478 * Compiled-in defaults: Porting mtools. (line 6)
2479 * Concatenating MS-DOS files: mcopy. (line 6)
2480 * Configuration file: default values. (line 6)
2481 * Configuration file name: configuration file location.
2483 * Configuration file name (parsing order): parsing order. (line 6)
2484 * Configuration file parsing order: parsing order. (line 6)
2485 * Configuration file syntax: general syntax. (line 6)
2486 * Configuration file, old syntax: old style configuration.
2488 * Configuration files: Configuration. (line 18)
2489 * Configuration of disk geometry: geometry description. (line 6)
2490 * Copying an entire disk image: mcat. (line 9)
2491 * Copying MS-DOS files: mcopy. (line 6)
2492 * CR/LF conversions: mcopy. (line 6)
2493 * Creating a directory: mmd. (line 6)
2494 * Current working directory: directory. (line 6)
2495 * Current working directory (changing the): mcd. (line 6)
2496 * Default configuration: default values. (line 6)
2497 * Default directory: directory. (line 6)
2498 * Default directory (changing the): mcd. (line 6)
2499 * Default values: default values. (line 6)
2500 * Deleting a directory: mrd. (line 6)
2501 * deleting an MS-DOS directory recursively: mdeltree. (line 6)
2502 * deleting MS-DOS files: mdel. (line 6)
2503 * Description of disk geometry: geometry description. (line 6)
2504 * diffs: Location. (line 6)
2505 * Directory: directory. (line 6)
2506 * Directory (changing): mcd. (line 6)
2507 * Directory creation: mmd. (line 6)
2508 * Directory listing: mdir. (line 6)
2509 * Directory removing: mrd. (line 6)
2510 * disable locking: miscellaneous flags. (line 11)
2511 * Disk Geometry: geometry description. (line 6)
2512 * Disk image: mcat. (line 9)
2513 * Disk label: mlabel. (line 6)
2514 * DMF disks: more sectors. (line 6)
2515 * DOSEMU hard disk image: location information. (line 14)
2516 * Drive configuration: per drive variables. (line 6)
2517 * Drive configuration, example: general information. (line 6)
2518 * Drive description: per drive variables. (line 6)
2519 * Drive description, example: general information. (line 6)
2520 * Drive independent configuration variables: global variables. (line 6)
2522 * Duplicate file names: name clashes. (line 6)
2523 * Ejecting a Zip/Jaz disk: mzip. (line 6)
2524 * Environmental variables: global variables. (line 6)
2525 * Erasing a directory: mrd. (line 6)
2526 * erasing an MS-DOS directory recursively: mdeltree. (line 6)
2527 * erasing MS-DOS files: mdel. (line 6)
2528 * exclusive access to a drive: open flags. (line 6)
2529 * Executing commands before opening the device: miscellaneous variables.
2531 * Fat: mshowfat. (line 6)
2532 * fdformat: more sectors. (line 6)
2533 * File name of device node: location information. (line 10)
2534 * File system creation: mformat. (line 6)
2535 * Filenames: arguments. (line 6)
2536 * floppyd: floppyd. (line 6)
2537 * Floppyd cat: mcat. (line 9)
2538 * floppyd_installtest: floppyd_installtest. (line 6)
2539 * Format of disk: geometry description. (line 6)
2540 * Formats, high capacity: high capacity formats.
2542 * Formatting disks: mformat. (line 6)
2543 * FreeDOS: global variables. (line 6)
2544 * getting parameters of a MS-DOS file system: minfo. (line 6)
2545 * Global configuration variables: global variables. (line 6)
2546 * Hdimage: location information. (line 6)
2547 * Hidden files: mattrib. (line 6)
2548 * High capacity formats: high capacity formats.
2550 * High capacity formats, mounting: mmount. (line 6)
2551 * High density disk: geometry description. (line 6)
2552 * Image file: location information. (line 10)
2553 * Initializing disks: mformat. (line 6)
2554 * Jaz disk (utilities): mzip. (line 6)
2555 * Jaz disks (partitioning them): mpartition. (line 6)
2556 * Jaz disks (partitions): location information. (line 14)
2557 * Jaz disks (raw SCSI access): miscellaneous flags. (line 17)
2558 * Labeling a disk: mlabel. (line 6)
2559 * Linux enhancements (High Capacity Formats): high capacity formats.
2561 * Linux enhancements (mmount): mmount. (line 6)
2562 * List of available commands: Commands. (line 6)
2563 * Listing a directory: mdir. (line 6)
2564 * Listing space occupied by directories and files: mdu. (line 6)
2565 * Location of configuration files: configuration file location.
2567 * Location of configuration files (parsing order): parsing order.
2569 * locking (disabling it): miscellaneous flags. (line 11)
2570 * Long file name: long names. (line 6)
2571 * Low density disk: geometry description. (line 6)
2572 * Magneto-optical disks: location information. (line 14)
2573 * mailing list: Location. (line 6)
2574 * Making a directory: mmd. (line 6)
2575 * Marking blocks as bad: mbadblocks. (line 6)
2576 * mattrib: mattrib. (line 6)
2577 * mbadblocks: mbadblocks. (line 6)
2578 * mcat: mcat. (line 9)
2579 * mcd: mcd. (line 6)
2580 * mcd (introduction): directory. (line 6)
2581 * mclasserase: mclasserase. (line 6)
2582 * mcopy: mcopy. (line 6)
2583 * Mcwd file: mcd. (line 6)
2584 * mdel: mdel. (line 6)
2585 * mdeltree: mdeltree. (line 6)
2586 * mdir: mdir. (line 6)
2587 * mdu: mdu. (line 6)
2588 * Memory Card: mclasserase. (line 6)
2589 * mformat: mformat. (line 6)
2590 * mformat (geometry used for): geometry description. (line 6)
2591 * mformat parameters: minfo. (line 6)
2592 * minfo: minfo. (line 6)
2593 * mkmanifest: mkmanifest. (line 6)
2594 * mlabel: mlabel. (line 6)
2595 * mmd: mmd. (line 6)
2596 * mmount: mmount. (line 6)
2597 * mmove: mmove. (line 6)
2598 * Mounting a disk: mmount. (line 6)
2599 * Moving files (mmove): mmove. (line 6)
2600 * Moving files (mren): mren. (line 6)
2601 * mpartition: mpartition. (line 6)
2602 * mrd: mrd. (line 6)
2603 * mren: mren. (line 6)
2604 * mshortname: mshortname. (line 6)
2605 * mshowfat: mshowfat. (line 6)
2606 * mtoolstest: mtoolstest. (line 6)
2607 * mzip: mzip. (line 6)
2608 * Name clashes: name clashes. (line 6)
2609 * Name of configuration files: configuration file location.
2611 * Name of configuration files (parsing order): parsing order. (line 6)
2612 * Name of device node: location information. (line 10)
2613 * Occupation of space by directories and files: mdu. (line 6)
2614 * Odd formats: high capacity formats.
2616 * Old configuration file syntax: old style configuration.
2618 * open flags: open flags. (line 6)
2619 * Options: arguments. (line 6)
2620 * OS/2 (layout of removable media): location information. (line 14)
2621 * OS/2 (XDF disks): XDF. (line 6)
2622 * Overwriting files: name clashes. (line 6)
2623 * packing list: mkmanifest. (line 6)
2624 * Parsing order: parsing order. (line 6)
2625 * Partitioned image file: location information. (line 14)
2626 * partitions (creating): mpartition. (line 6)
2627 * password protected Zip disks: mzip. (line 6)
2628 * patches: Location. (line 6)
2629 * Physically erase: mclasserase. (line 6)
2630 * plain floppy: device xxx busy: miscellaneous flags. (line 11)
2631 * Porting: Porting mtools. (line 6)
2632 * Primary file name (long names): long names. (line 6)
2633 * Primary file name (name clashes): name clashes. (line 6)
2634 * Ram disk: location information. (line 28)
2635 * raw device: miscellaneous variables.
2637 * Read errors: mbadblocks. (line 6)
2638 * Read-only files (changing the attribute): mattrib. (line 6)
2639 * Read-only files (listing them): mdir. (line 6)
2640 * Reading MS-DOS files: mcopy. (line 6)
2641 * recursively removing an MS-DOS directory: mdeltree. (line 6)
2642 * remote floppy access: floppyd. (line 6)
2643 * remote floppy access <1>: floppyd_installtest. (line 6)
2644 * Removable media: location information. (line 14)
2645 * Removing a directory: mrd. (line 6)
2646 * removing an MS-DOS directory recursively: mdeltree. (line 6)
2647 * removing MS-DOS files: mdel. (line 6)
2648 * Renaming files (mmove): mmove. (line 6)
2649 * Renaming files (mren): mren. (line 6)
2650 * SCSI devices: miscellaneous flags. (line 17)
2651 * Secondary file name (long names): long names. (line 6)
2652 * Secondary file name (name clashes): name clashes. (line 6)
2653 * setgid installation: miscellaneous flags. (line 40)
2654 * setuid installation: miscellaneous flags. (line 40)
2655 * setuid installation (needed for raw SCSI I/O): miscellaneous flags.
2657 * Solaris (compile time configuration of vold): Compiling mtools.
2659 * Solaris (Raw access to SCSI devices such as Zip & Jaz): miscellaneous flags.
2661 * Solaris (volcheck): miscellaneous variables.
2663 * Solaris (vold): miscellaneous flags. (line 57)
2664 * Space occupied by directories and files: mdu. (line 6)
2665 * Special formats: high capacity formats.
2667 * Subdirectory creation: mmd. (line 6)
2668 * Subdirectory removing: mrd. (line 6)
2669 * SunOS (Raw access to SCSI devices such as Zip & Jaz): miscellaneous flags.
2671 * synchronous writing: open flags. (line 6)
2672 * Syntax of the configuration file: general syntax. (line 6)
2673 * Syquest disks: location information. (line 14)
2674 * Syquest disks (raw SCSI access): miscellaneous flags. (line 17)
2675 * System files: mattrib. (line 6)
2676 * Testing configuration file for correctness: mtoolstest. (line 6)
2677 * Text files: mcopy. (line 6)
2678 * Tools disk (Zip and Jaz drives): mzip. (line 6)
2679 * Verifying configuration file: mtoolstest. (line 6)
2680 * VFAT-style file names: long names. (line 6)
2681 * vgacopy: more sectors. (line 6)
2682 * Vold (compile time configuration): Compiling mtools. (line 6)
2683 * Vold (mediamgr): miscellaneous flags. (line 57)
2684 * Weird formats: high capacity formats.
2686 * Windows 95 (DMF disks): more sectors. (line 6)
2687 * Windows 95-style file names: long names. (line 6)
2688 * Windows NT (layout of removable media): location information.
2690 * Wordswapped: miscellaneous flags. (line 66)
2691 * Working directory: directory. (line 6)
2692 * Working directory <1>: mcd. (line 6)
2693 * Write protecting a Zip/Jaz disk: mzip. (line 6)
2694 * Writing MS-DOS files: mcopy. (line 6)
2695 * X terminal: floppyd. (line 6)
2696 * X terminal <1>: floppyd_installtest. (line 6)
2697 * XDF disks: XDF. (line 6)
2698 * XDF disks (compile time configuration): Compiling mtools. (line 6)
2699 * XDF disks (how to configure): miscellaneous flags. (line 70)
2700 * Zip disk (utilities): mzip. (line 6)
2701 * Zip disks (partitioning them): mpartition. (line 6)
2702 * Zip disks (partitions): location information. (line 14)
2703 * Zip disks (raw SCSI access): miscellaneous flags. (line 17)
2704 * ZipTools disk: mzip. (line 6)
2710 Node: Location
\7f3123
2711 Node: Common features
\7f4512
2712 Node: arguments
\7f5276
2713 Node: drive letters
\7f6937
2714 Node: directory
\7f8291
2715 Node: long names
\7f8737
2716 Node: name clashes
\7f11283
2717 Node: case sensitivity
\7f13567
2718 Node: high capacity formats
\7f14804
2719 Node: more sectors
\7f15926
2720 Node: bigger sectors
\7f16981
2723 Node: exit codes
\7f20239
2725 Node: Configuration
\7f21410
2726 Node: configuration file location
\7f22699
2727 Node: general syntax
\7f23152
2728 Node: default values
\7f23983
2729 Node: global variables
\7f24511
2730 Node: per drive variables
\7f26704
2731 Node: general information
\7f27539
2732 Node: location information
\7f27981
2733 Node: geometry description
\7f29510
2734 Node: open flags
\7f33371
2735 Node: miscellaneous variables
\7f33971
2736 Node: miscellaneous flags
\7f36047
2737 Node: multiple descriptions
\7f39677
2738 Node: parsing order
\7f41351
2739 Node: old style configuration
\7f42382
2740 Node: Commands
\7f43081
2741 Node: floppyd
\7f45003
2742 Node: floppyd_installtest
\7f49796
2743 Node: mattrib
\7f50427
2744 Node: mbadblocks
\7f52220
2747 Node: mclasserase
\7f55189
2750 Node: mdeltree
\7f59218
2753 Node: mformat
\7f61419
2754 Node: mkmanifest
\7f69930
2756 Node: mlabel
\7f72474
2758 Node: mmount
\7f73976
2760 Node: mpartition
\7f75386
2763 Node: mshortname
\7f82006
2764 Node: mshowfat
\7f82336
2765 Node: mtoolstest
\7f82745
2768 Ref: mzip-Footnote-1
\7f86193
2769 Ref: mzip-Footnote-2
\7f86274
2770 Node: Compiling mtools
\7f86561
2771 Node: Porting mtools
\7f87660
2772 Node: Command Index
\7f93568
2773 Node: Variable Index
\7f93696
2774 Node: Concept Index
\7f95519