1mtools(1)                   General Commands Manual                  mtools(1)
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 file  system
13       (typically  a floppy disk).  Where reasonable, each program attempts to
14       emulate the MS-DOS equivalent command.  However,  unnecessary  restric‐
15       tions  and oddities of DOS are not emulated. For instance, it is possi‐
16       ble to move subdirectories from one subdirectory to another.
17
18       Mtools is sufficient to give access to MS-DOS file  systems.   For  in‐
19       stance, commands such as mdir a: work on the a: floppy without any pre‐
20       liminary   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.27.tar.gz
28
29
30
31       These patches are named mtools-version-ddmm.taz, where  version  stands
32       for  the  base  version,  dd for the day and mm for the month. Due to a
33       lack of space, I usually leave only the most recent patch.
34
35       There is an mtools mailing list at info-mtools @ gnu.org .  Please send
36       all  bug  reports  to  this  list.   You  may  subscribe to the list at
37       https://lists.gnu.org/mailman/listinfo/info-mtools. (N.B. Please remove
38       the  spaces  around  the  "@". I left them there in order to fool spam‐
39       bots.)  Announcements of new mtools versions will also be sent  to  the
40       list,  in  addition to the Linux announce newsgroups.  The mailing list
41       is archived at http://lists.gnu.org/pipermail/info-mtools/
42

Common features of all mtools commands

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

See also

379       floppyd_installtest mattrib mbadblocks mcd mclasserase mcopy mdel mdel‐
380       tree mdir mdu mformat minfo mkmanifest mlabel mmd mmount mmove mrd mren
381       mshortname mshowfat mtoolstest mtype
382
383
384
385mtools-4.0.27                       16Apr21                          mtools(1)
Impressum