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 collection of tools to allow Unix systems to manipulate MS-
12       DOS files: read, write, and move around files on an  MS-DOS  filesystem
13       (typically  a floppy disk).  Where reasonable, each program attempts to
14       emulate the MS-DOS equivalent command.  However,  unnecessary  restric‐
15       tions  and oddities of DOS are not emulated. For instance, it is possi‐
16       ble to move subdirectories from one subdirectory to another.
17
18       Mtools is  sufficient  to  give  access  to  MS-DOS  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://ftp.gnu.org/gnu/mtools/mtools-4.0.12.tar.gz
28          http://mtools.linux.lu/mtools-4.0.12.tar.gz
29          ftp://www.tux.org/pub/knaff/mtools/mtools-4.0.12.tar.gz
30          ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-4.0.12.tar.gz
31
32
33
34       Before reporting a bug, make sure that it has not yet been fixed in the
35       Alpha patches which can be found at:
36
37          http://ftp.gnu.org/gnu/mtools/
38          http://mtools.linux.lu/
39          ftp://www.tux.org/pub/knaff/mtools
40
41
42
43       These  patches  are named mtools-version-ddmm.taz, where version stands
44       for the base version, dd for the day and mm for the  month.  Due  to  a
45       lack of space, I usually leave only the most recent patch.
46
47       There  is an mtools mailing list at mtools @ tux.org .  Please send all
48       bug reports to this list.  You may subscribe to the list by  sending  a
49       message  with  'subscribe  mtools @ tux.org' in its body to majordomo @
50       tux.org . (N.B. Please remove the spaces around the "@" both  times.  I
51       left  them  there  in  order  to  fool spambots.)  Announcements of new
52       mtools versions will also be sent to the list, in addition to the linux
53       announce    newsgroups.     The    mailing    list   is   archived   at
54       http://lists.gnu.org/pipermail/info-mtools/
55

Common features of all mtools commands

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

See also

392       floppyd_installtest mattrib mbadblocks mcd mcopy mdel mdeltree mdir mdu
393       mformat minfo mkmanifest mlabel mmd mmount mmove  mrd  mren  mtoolstest
394       mtype
395
396
397
398mtools-4.0.12                       03Nov09                        mtools.1(3)
Impressum