1mtools.1(3)                Library Functions Manual                mtools.1(3)
2
3
4

Name

6       mtools - utilities to access DOS disks in Unix.
7
8
9

Introduction

11       Mtools  is a public domain collection of tools to allow Unix systems to
12       manipulate MS-DOS files: read, write, and move around files on  an  MS-
13       DOS  filesystem (typically a floppy disk).  Where reasonable, each pro‐
14       gram attempts to emulate the MS-DOS equivalent command. However, unnec‐
15       essary restrictions and oddities of DOS are not emulated. For instance,
16       it is possible to move subdirectories from one subdirectory to another.
17
18       Mtools is  sufficient  to  give  access  to  MS-DOS  filesystems.   For
19       instance,  commands  such  as mdir a: work on the a: floppy without any
20       preliminary  mounting   or   initialization   (assuming   the   default
21       `/etc/mtools.conf' works on your machine).  With mtools, one can change
22       floppies too without unmounting and mounting.
23

Where to get mtools

25       Mtools can be found at the following places (and their mirrors):
26
27          http://mtools.linux.lu/mtools-3.9.10.tar.gz
28          ftp://www.tux.org/pub/knaff/mtools/mtools-3.9.10.tar.gz
29          ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-3.9.10.tar.gz
30
31
32
33       Before reporting a bug, make sure that it has not yet been fixed in the
34       Alpha patches which can be found at:
35
36          http://mtools.linux.lu/
37          ftp://www.tux.org/pub/knaff/mtools
38
39
40
41       These  patches  are named mtools-version-ddmm.taz, where version stands
42       for the base version, dd for the day and mm for the  month.  Due  to  a
43       lack of space, I usually leave only the most recent patch.
44
45       There  is an mtools mailing list at mtools @ tux.org .  Please send all
46       bug reports to this list.  You may subscribe to the list by  sending  a
47       message  with  'subscribe  mtools @ tux.org' in its body to majordomo @
48       tux.org . (N.B. Please remove the spaces around the "@" both  times.  I
49       left  them  there  in  order  to  fool spambots.)  Announcements of new
50       mtools versions will also be sent to the list, in addition to the linux
51       announce    newsgroups.     The    mailing    list   is   archived   at
52       http://www.tux.org/hypermail/mtools/latest
53

Common features of all mtools commands

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

See also

378       floppyd_installtest mattrib mbadblocks mcd mcopy mdel mdeltree mdir mdu
379       mformat minfo mkmanifest mlabel mmd mmount mmove  mrd  mren  mtoolstest
380       mtype
381
382
383
384mtools-3.9.10                       28Feb05                        mtools.1(3)
Impressum