-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmtools.texi
2733 lines (2277 loc) · 97.5 KB
/
mtools.texi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\input texinfo @c -*-texinfo-*-
@comment %**start of header
@setfilename mtools.info
@include version.texi
@settitle Mtools @value{VERSION}
@syncodeindex pg cp
@comment %**end of header
@comment MANskip 5
@copying
This manual is for Mtools (version @value{VERSION}, @value{UPDATED}),
which is a collection of tools to allow Unix systems to manipulate
MS-DOS files.
Copyright @copyright{} 2007, 2009 Free Software Foundation, Inc.
Copyright @copyright{} 1996-2005,2007-2011,2013 Alain Knaff.
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled
``GNU Free Documentation License''.
@end quotation
@end copying
@ignore
@unnumbered Name
mtools - utilities to access DOS disks in Unix.
@end ignore
@include sysconfdir.texi
@iftex
@finalout
@end iftex
@dircategory DOS
@direntry
* Mtools: (mtools). Mtools: utilities to access DOS disks in Unix.
@end direntry
@titlepage
@title Mtools
@c The following two commands start the copyright page.
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
@c Output the table contents at the beginning
@contents
@ifnottex
@node Top, Location, (dir), (dir)
@top Mtools doc
This is mtools' documentation.
@end ifnottex
@comment MANstart 1
@unnumbered Introduction
Mtools is a collection of tools to allow Unix systems to manipulate
MS-DOS files: read, write, and move around files on an MS-DOS
file system (typically a floppy disk). Where reasonable, each program
attempts to emulate the MS-DOS equivalent command. However,
unnecessary restrictions and oddities of DOS are not emulated. For
instance, it is possible to move subdirectories from one subdirectory
to another.
Mtools is sufficient to give access to MS-DOS file systems. For
instance, commands such as @code{mdir a:} work on the @code{a:} floppy
without any preliminary mounting or initialization (assuming the default
@file{@value{SYSCONFDIR}mtools.conf} works on your machine). With mtools, one can
change floppies too without unmounting and mounting.
@insertcopying
@menu
* Location:: Where to find mtools and early bug fixes
* Common features:: Common features of all mtools commands
* Configuration:: How to configure mtools for your environment
* Commands:: The available mtools commands
* Compiling mtools:: Architecture specific compilation flags
* Porting mtools:: Porting mtools to architectures which are not
yet supported
* Command Index:: Command Index
* Variable Index:: Variable Index
* Concept Index:: Concept Index
@end menu
@node Location, Common features, Top, Top
@chapter Where to get mtools
@cindex bugs
@cindex ALPHA patches
@cindex patches
@cindex diffs
@cindex mailing list
Mtools can be found at the following places (and their mirrors):
@example
http://ftp.gnu.org/gnu/mtools/mtools-@value{VERSION}.tar.gz
@end example
These patches are named
@code{mtools-}@var{version}@code{-}@var{ddmm}@code{.taz}, where version
stands for the base version, @var{dd} for the day and @var{mm} for the
month. Due to a lack of space, I usually leave only the most recent
patch.
There is an mtools mailing list at info-mtools @@ gnu.org . Please
send all bug reports to this list. You may subscribe to the list at
https://lists.gnu.org/mailman/listinfo/info-mtools. (N.B. Please
remove the spaces around the "@@". I left them there in order to fool
spambots.) Announcements of new mtools versions will also be sent to
the list, in addition to the Linux announce newsgroups. The mailing
list is archived at http://lists.gnu.org/pipermail/info-mtools/
@node Common features, Configuration, Location, Top
@chapter Common features of all mtools commands
@menu
* arguments:: What the command line parameters of mtools
mean
* drive letters:: Which drives are defined by default
* directory:: Current working directory
* long names:: VFAT-style long filenames
* name clashes:: Name clash handling, and associated command
line options
* case sensitivity:: Case sensitivity
* high capacity formats:: How to fit more data on your floppies
* exit codes:: Exit codes
* bugs:: Happens to everybody
@end menu
@node arguments, drive letters, Common features, Common features
@section Options and filenames
@cindex Filenames
@cindex Options
MS-DOS filenames are composed of a drive letter followed by a colon, a
subdirectory, and a filename. Only the filename part is mandatory, the
drive letter and the subdirectory are optional. Filenames without a
drive letter refer to Unix files. Subdirectory names can use either the
'@code{/}' or '@code{\}' separator. The use of the '@code{\}' separator
or wildcards requires the names to be enclosed in quotes to protect them
from the shell. However, wildcards in Unix filenames should not be
enclosed in quotes, because here we @strong{want} the shell to expand
them.
The regular expression "pattern matching" routines follow the Unix-style
rules. For example, `@code{*}' matches all MS-DOS files in lieu of
`@code{*.*}'. The archive, hidden, read-only and system attribute bits
are ignored during pattern matching.
All options use the @code{-} (minus) as their first character, not
@code{/} as you'd expect in MS-DOS.
Most mtools commands allow multiple filename parameters, which
doesn't follow MS-DOS conventions, but which is more user-friendly.
Most mtools commands allow options that instruct them how to handle
file name clashes. @xref{name clashes}, for more details on these.
All commands accept the @code{-i} flag which allows to specify an
image file (@xref{drive letters}).
All commands accept the @code{-V} flag which prints the version, and
most accept the @code{-v} flag, which switches on verbose mode. In
verbose mode, these commands print out the name of the MS-DOS files
upon which they act, unless stated otherwise. @xref{Commands}, for a
description of the options which are specific to each command.
@node drive letters, directory, arguments, Common features
@section Drive letters
The meaning of the drive letters depends on the target architectures.
However, on most target architectures, drive A is the first floppy
drive, drive B is the second floppy drive (if available), drive J is a
Jaz drive (if available), and drive Z is a Zip drive (if available). On
those systems where the device name is derived from the SCSI id, the Jaz
drive is assumed to be at SCSI target 4, and the Zip at SCSI target 5
(factory default settings). On Linux, both drives are assumed to be the
second drive on the SCSI bus (/dev/sdb). The default settings can be
changes using a configuration file (@pxref{Configuration}).
The drive letter : (colon) has a special meaning. It is used to access
image files which are directly specified on the command line using the
@code{-i} options.
Example:
@example
mcopy -i my-image-file.bin ::file1 ::file2 .
@end example
This copies @code{file1} and @code{file2} from the image file
(@code{my-image-file.bin}) to the @code{/tmp} directory.
You can also supply an offset within the image file by including
@code{@@@@}@var{offset} into the file name.
Example:
@example
mcopy -i my-image-file.bin@@@@1M ::file1 ::file2 .
@end example
This looks for the image at the offset of 1M in the file, rather than
at its beginning.
@node directory, long names, drive letters, Common features
@section Current working directory
@pindex mcd (introduction)
@cindex Directory
@cindex Working directory
@cindex Current working directory
@cindex Default directory
The @code{mcd} command (@ref{mcd}) is used to establish the device and
the current working directory (relative to the MS-DOS file system),
otherwise the default is assumed to be @code{A:/}. However, unlike
MS-DOS, there is only one working directory for all drives, and not one
per drive.
@node long names, name clashes, directory, Common features
@section VFAT-style long file names
@cindex Long file name
@cindex Windows 95-style file names
@cindex VFAT-style file names
@cindex Primary file name (long names)
@cindex Secondary file name (long names)
This version of mtools supports VFAT style long filenames. If a Unix
filename is too long to fit in a short DOS name, it is stored as a
VFAT long name, and a companion short name is generated. This short
name is what you see when you examine the disk with a pre-7.0 version
of DOS.
The following table shows some examples of short names:
@example
Long name MS-DOS name Reason for the change
--------- ---------- ---------------------
thisisatest THISIS~1 filename too long
alain.knaff ALAIN~1.KNA extension too long
prn.txt PRN~1.TXT PRN is a device name
.abc ABC~1 null filename
hot+cold HOT_CO~1 illegal character
@end example
As you see, the following transformations happen to derive a short
name:
@itemize @bullet
@item
Illegal characters are replaced by underscores. The illegal characters
are @code{;+=[]',\"*\\<>/?:|}.
@item
Extra dots, which cannot be interpreted as a main name/extension
separator are removed
@item
A @code{~}@var{n} number is generated,
@item
The name is shortened so as to fit in the 8+3 limitation
@end itemize
The initial Unix-style file name (whether long or short) is also called
the @dfn{primary} name, and the derived short name is also called the
@dfn{secondary} name.
Example:
@example
mcopy /etc/motd a:Reallylongname
@end example
Mtools creates a VFAT entry for Reallylongname, and uses REALLYLO as
a short name. Reallylongname is the primary name, and REALLYLO is the
secondary name.
@example
mcopy /etc/motd a:motd
@end example
Motd fits into the DOS filename limits. Mtools doesn't need to
derivate another name. Motd is the primary name, and there is no
secondary name.
In a nutshell: The primary name is the long name, if one exists, or
the short name if there is no long name.
Although VFAT is much more flexible than FAT, there are still names
that are not acceptable, even in VFAT. There are still some illegal
characters left (@code{\"*\\<>/?:|}), and device names are still
reserved.
@example
Unix name Long name Reason for the change
--------- ---------- ---------------------
prn prn-1 PRN is a device name
ab:c ab_c-1 illegal character
@end example
As you see, the following transformations happen if a long name is
illegal:
@itemize @bullet
@item
Illegal characters are replaces by underscores,
@item
A @code{-}@var{n} number is generated,
@end itemize
@node name clashes, case sensitivity, long names, Common features
@section Name clashes
@cindex Name clashes
@cindex Duplicate file names
@cindex Overwriting files
@cindex Primary file name (name clashes)
@cindex Secondary file name (name clashes)
When writing a file to disk, its long name or short name may collide
with an already existing file or directory. This may happen for all
commands which create new directory entries, such as @code{mcopy},
@code{mmd}, @code{mren}, @code{mmove}. When a name clash happens, mtools
asks you what it should do. It offers several choices:
@table @code
@item overwrite
Overwrites the existing file. It is not possible to overwrite a
directory with a file.
@item rename
Renames the newly created file. Mtools prompts for the new filename
@item autorename
Renames the newly created file. Mtools chooses a name by itself, without
prompting
@item skip
Gives up on this file, and moves on to the next (if any)
@end table
To chose one of these actions, type its first letter at the prompt. If
you use a lower case letter, the action only applies for this file only,
if you use an upper case letter, the action applies to all files, and
you won't be prompted again.
You may also chose actions (for all files) on the command line, when
invoking mtools:
@table @code
@item -D o
Overwrites primary names by default.
@item -D O
Overwrites secondary names by default.
@item -D r
Renames primary name by default.
@item -D R
Renames secondary name by default.
@item -D a
Autorenames primary name by default.
@item -D A
Autorenames secondary name by default.
@item -D s
Skip primary name by default.
@item -D S
Skip secondary name by default.
@item -D m
Ask user what to do with primary name.
@item -D M
Ask user what to do with secondary name.
@end table
Note that for command line switches lower/upper differentiates between
primary/secondary name whereas for interactive choices, lower/upper
differentiates between just-this-time/always.
The primary name is the name as displayed in Windows 95 or Windows NT:
i.e. the long name if it exists, and the short name otherwise. The
secondary name is the "hidden" name, i.e. the short name if a long name
exists.
By default, the user is prompted if the primary name clashes, and the
secondary name is autorenamed.
If a name clash occurs in a Unix directory, mtools only asks whether
to overwrite the file, or to skip it.
@node case sensitivity, high capacity formats, name clashes, Common features
@section Case sensitivity of the VFAT file system
@cindex Case sensitivity
The VFAT file system is able to remember the case of the
filenames. However, filenames which differ only in case are not allowed
to coexist in the same directory. For example if you store a file called
LongFileName on a VFAT file system, mdir shows this file as LongFileName,
and not as Longfilename. However, if you then try to add LongFilename to
the same directory, it is refused, because case is ignored for clash
checks.
The VFAT file system allows you to store the case of a filename in the
attribute byte, if all letters of the filename are the same case, and if
all letters of the extension are the same case too. Mtools uses this
information when displaying the files, and also to generate the Unix
filename when mcopying to a Unix directory. This may have unexpected
results when applied to files written using an pre-7.0 version of DOS:
Indeed, the old style filenames map to all upper case. This is different
from the behavior of the old version of mtools which used to generate
lower case Unix filenames.
@node high capacity formats, exit codes, case sensitivity, Common features
@section high capacity formats
@cindex Special formats
@cindex High capacity formats
@cindex Odd formats
@cindex Weird formats
@cindex Formats, high capacity
@cindex Linux enhancements (High Capacity Formats)
Mtools supports a number of formats which allow storage of more data on
disk than usual. Due to different operating system abilities, these
formats are not supported on all operating systems. Mtools recognizes
these formats transparently where supported.
In order to format these disks, you need to use an operating system
specific tool. For Linux, suitable floppy tools can be found in the
@code{fdutils} package at the following locations~:
@example
@code{http://www.fdutils.linux.lu/}.
@end example
See the manual pages included in that package for further detail: Use
@code{superformat} to format all formats except XDF, and use
@code{xdfcopy} to format XDF.
@menu
* more sectors:: Putting more sectors per track on the disk
* bigger sectors:: Use bigger sectors to save header space
* 2m:: Use a standard first track
* XDF:: OS/2's eXtended density format
@end menu
@node more sectors, bigger sectors, high capacity formats, high capacity formats
@subsection More sectors
@cindex fdformat
@cindex vgacopy
@cindex DMF disks
@cindex Windows 95 (DMF disks)
The oldest method of fitting more data on a disk is to use more sectors
and more cylinders. Although the standard format uses 80 cylinders and
18 sectors (on a 3 1/2 high density disk), it is possible to use up to
83 cylinders (on most drives) and up to 21 sectors. This method allows
to store up to 1743K on a 3 1/2 HD disk. However, 21 sector disks are
twice as slow as the standard 18 sector disks because the sectors are
packed so close together that we need to interleave them. This problem
doesn't exist for 20 sector formats.
These formats are supported by numerous DOS shareware utilities such as
@code{fdformat} and @code{vgacopy}. In his infinite hubris, Bill Gate$
believed that he invented this, and called it @samp{DMF disks}, or
@samp{Windows formatted disks}. But in reality, it has already existed
years before! Mtools supports these formats on Linux, on SunOS and on
the DELL Unix PC.
@node bigger sectors, 2m, more sectors, high capacity formats
@subsection Bigger sectors
@cindex bigger sectors
By using bigger sectors it is possible to go beyond the capacity which
can be obtained by the standard 512-byte sectors. This is because of the
sector header. The sector header has the same size, regardless of how
many data bytes are in the sector. Thus, we save some space by using
@emph{fewer}, but bigger sectors. For example, 1 sector of 4K only takes
up header space once, whereas 8 sectors of 512 bytes have also 8
headers, for the same amount of useful data.
This method permits storage of up to 1992K on a 3 1/2 HD disk.
Mtools supports these formats only on Linux.
@node 2m, XDF, bigger sectors, high capacity formats
@subsection 2m
@cindex 2m
The 2m format was originally invented by Ciriaco Garcia de Celis. It
also uses bigger sectors than usual in order to fit more data on the
disk. However, it uses the standard format (18 sectors of 512 bytes
each) on the first cylinder, in order to make these disks easier to
handle by DOS. Indeed this method allows you to have a standard sized
boot sector, which contains a description of how the rest of the disk
should be read.
However, the drawback of this is that the first cylinder can hold less
data than the others. Unfortunately, DOS can only handle disks where
each track contains the same amount of data. Thus 2m hides the fact that
the first track contains less data by using a @dfn{shadow
FAT}. (Usually, DOS stores the FAT in two identical copies, for
additional safety. XDF stores only one copy, but tells DOS that it
stores two. Thus the space that would be taken up by the second FAT copy
is saved.) This also means that you should @strong{never use a 2m disk
to store anything else than a DOS file system}.
Mtools supports these formats only on Linux.
@node XDF, , 2m, high capacity formats
@subsection XDF
@cindex XDF disks
@cindex OS/2 (XDF disks)
XDF is a high capacity format used by OS/2. It can hold 1840 K per
disk. That's lower than the best 2m formats, but its main advantage is
that it is fast: 600 milliseconds per track. That's faster than the 21
sector format, and almost as fast as the standard 18 sector format. In
order to access these disks, make sure mtools has been compiled with XDF
support, and set the @code{use_xdf} variable for the drive in the
configuration file. @xref{Compiling mtools}, and @ref{miscellaneous variables},
for details on how to do this. Fast XDF access is only available for
Linux kernels which are more recent than 1.1.34.
Mtools supports this format only on Linux.
@strong{Caution / Attention distributors}: If mtools is compiled on a
Linux kernel more recent than 1.3.34, it won't run on an older
kernel. However, if it has been compiled on an older kernel, it still
runs on a newer kernel, except that XDF access is slower. It is
recommended that distribution authors only include mtools binaries
compiled on kernels older than 1.3.34 until 2.0 comes out. When 2.0 will
be out, mtools binaries compiled on newer kernels may (and should) be
distributed. Mtools binaries compiled on kernels older than 1.3.34 won't
run on any 2.1 kernel or later.
@node exit codes, bugs, high capacity formats, Common features
@section Exit codes
All the Mtools commands return 0 on success, 1 on utter failure, or 2
on partial failure. All the Mtools commands perform a few sanity
checks before going ahead, to make sure that the disk is indeed an
MS-DOS disk (as opposed to, say an ext2 or MINIX disk). These checks
may reject partially corrupted disks, which might otherwise still be
readable. To avoid these checks, set the MTOOLS_SKIP_CHECK
environmental variable or the corresponding configuration file variable
(@pxref{global variables})
@node bugs, , exit codes, Common features
@section Bugs
An unfortunate side effect of not guessing the proper device (when
multiple disk capacities are supported) is an occasional error message
from the device driver. These can be safely ignored.
The fat checking code chokes on 1.72 Mb disks mformatted with pre-2.0.7
mtools. Set the environmental variable MTOOLS_FAT_COMPATIBILITY (or the
corresponding configuration file variable, @ref{global variables}) to
bypass the fat checking.
@comment MANskip 1
@ignore
@unnumbered Name
mtools.conf - mtools configuration files
@comment MANend-skip 5
@section Description
This manual page describes the configuration files for mtools. They
@comment MANskip 5
@end ignore
@node Configuration, Commands, Common features, Top
@chapter How to configure mtools for your environment
@section Description
@cindex Configuration files
@vindex MTOOLSRC
This sections explains the syntax of the configurations files for
mtools. The configuration files
@comment MANend-skip 5
are called @file{@value{SYSCONFDIR}mtools.conf} and @file{~/.mtoolsrc}. If
the environmental variable @code{MTOOLSRC} is set, its contents is used
as the filename for a third configuration file. These configuration
files describe the following items:
@itemize @bullet
@item Global configuration flags and variables
@item Per drive flags and variables
@end itemize
@menu
* configuration file location:: Where mtools looks for its configuration files
* general syntax:: The layout of the configuration files
* default values:: Why you don't need a configuration file in most cases
* global variables:: Variables that are independent of the drive
* per drive variables:: Variables that are specific to a given drive
* parsing order:: Location of configuration files and parsing order
* old style configuration:: Backwards compatibility
@end menu
@node configuration file location, general syntax, Configuration, Configuration
@section Location of the configuration files
@cindex Configuration file name
@cindex Name of configuration files
@cindex Location of configuration files
@file{@value{SYSCONFDIR}mtools.conf} is the system-wide configuration file,
and @file{~/.mtoolsrc} is the user's private configuration file.
On some systems, the system-wide configuration file is called
@file{/etc/default/mtools.conf} instead.
@node general syntax, default values, configuration file location, Configuration
@subsection General configuration file syntax
@cindex Syntax of the configuration file
@cindex Configuration file syntax
The configuration files is made up of sections. Each section starts
with a keyword identifying the section followed by a colon.
Then follow variable assignments and flags. Variable assignments take
the following form:
@display
name=value
@end display
Flags are lone keywords without an equal sign and value following
them. A section either ends at the end of the file or where the next
section begins.
Lines starting with a hash (@code{#}) are comments. Newline characters
are equivalent to whitespace (except where ending a comment). The
configuration file is case insensitive, except for item enclosed in
quotes (such as filenames).
@node default values, global variables, general syntax, Configuration
@section Default values
@cindex Default values
@cindex Default configuration
@cindex Configuration file
For most platforms, mtools contains reasonable compiled-in defaults for
physical floppy drives. Thus, you usually don't need to bother with the
configuration file, if all you want to do with mtools is to access your
floppy drives. On the other hand, the configuration file is needed if
you also want to use mtools to access your hard disk partitions and
DOSEMU image files.
@node global variables, per drive variables, default values, Configuration
@section Global variables
@cindex Global configuration variables
@cindex Drive independent configuration variables
@cindex Environmental variables
@vindex MTOOLS_SKIP_CHECK
@vindex MTOOLS_FAT_COMPATIBILITY
@vindex MTOOLS_LOWER_CASE
@vindex MTOOLS_NO_VFAT
@vindex MTOOLS_DOTTED_DIR
@vindex MTOOLS_NAME_NUMERIC_TAIL
@vindex MTOOLS_TWENTY_FOUR_HOUR_CLOCK
@vindex MTOOLS_LOCK_TIMEOUT
@cindex FreeDOS
Global flags may be set to 1 or to 0.
The following global flags are recognized:
@table @code
@item MTOOLS_SKIP_CHECK
If this is set to 1, mtools skips most of its sanity checks. This is
needed to read some Atari disks which have been made with the earlier
ROMs, and which would not be recognized otherwise.
@item MTOOLS_FAT_COMPATIBILITY
If this is set to 1, mtools skips the fat size checks. Some disks have
a bigger FAT than they really need to. These are rejected if this
option is not set.
@item MTOOLS_LOWER_CASE
If this is set to 1, mtools displays all-upper-case short filenames as
lowercase. This has been done to allow a behavior which is consistent
with older versions of mtools which didn't know about the case bits.
@item MTOOLS_NO_VFAT
If this is set to 1, mtools won't generate VFAT entries for filenames
which are mixed-case, but otherwise legal dos filenames. This is useful
when working with DOS versions which can't grok VFAT long names, such as
FreeDOS.
@item MTOOLS_DOTTED_DIR
In a wide directory, prints the short name with a dot instead of spaces
separating the basename and the extension.
@item MTOOLS_NAME_NUMERIC_TAIL
If this is set to one (default), generate numeric tails for all long
names (~1). If set to zero, only generate numeric tails if otherwise a
clash would have happened.
@item MTOOLS_TWENTY_FOUR_HOUR_CLOCK
If 1, uses the European notation for times (twenty four hour clock),
else uses the UK/US notation (am/pm)
@item MTOOLS_LOCK_TIMEOUT
How long, in seconds, to wait for a locked device to become free.
Defaults to 30.
@end table
Example:
Inserting the following line into your configuration file instructs
mtools to skip the sanity checks:
@example
MTOOLS_SKIP_CHECK=1
@end example
Global variables may also be set via the environment:
@example
export MTOOLS_SKIP_CHECK=1
@end example
Global string variables may be set to any value:
@table @code
@item MTOOLS_DATE_STRING
The format used for printing dates of files. By default, is dd-mm-yyyy.
@end table
@node per drive variables, parsing order, global variables, Configuration
@section Per drive flags and variables
@cindex Drive description
@cindex Drive configuration
@menu
* general information:: What a drive description looks like
* location information:: Where is the drive data physically stored
* geometry description:: Describes the physical characteristics of
the media
* open flags:: Flags passed to the open system call when the
device is opened
* miscellaneous variables:: Variables which don't fit in either category
* miscellaneous flags:: Switch variables, which can be enabled or disabled
* multiple descriptions:: How to supply several descriptions for a
drive, to be tried one after the other.
@end menu
@node general information, location information, per drive variables, per drive variables
@subsection General information
@cindex Drive description, example
@cindex Drive configuration, example
@vindex drive
Per drive flags and values may be described in a drive section. A
drive section starts with
@code{drive} "@var{driveletter}" :
Then follow variable-value pairs and flags.
This is a sample drive description:
@example
drive a:
file="/dev/fd0" use_xdf=1
@end example
@node location information, geometry description, general information, per drive variables
@subsection Location information
@cindex Hdimage
For each drive, you need to describe where its data is physically
stored (image file, physical device, partition, offset).
@table @code
@item file
@cindex Image file
@cindex Name of device node
@cindex File name of device node
@vindex file
The name of the file or device holding the disk image. This is
mandatory. The file name should be enclosed in quotes.
@item partition
@cindex DOSEMU hard disk image
@cindex Zip disks (partitions)
@cindex Jaz disks (partitions)
@cindex Syquest disks
@cindex Magneto-optical disks
@cindex OS/2 (layout of removable media)
@cindex Windows NT (layout of removable media)
@cindex Removable media
@cindex Partitioned image file
Tells mtools to treat the drive as a partitioned device, and to use the
given partition. Only primary partitions are accessible using this
method, and they are numbered from 1 to 4. For logical partitions, use
the more general @code{offset} variable. The @code{partition} variable
is intended for removable media such as Syquest disks, ZIP drives, and
magneto-optical disks. Although traditional DOS sees Syquest disks and
magneto-optical disks as @samp{giant floppy disks} which are
unpartitioned, OS/2 and Windows NT treat them like hard disks,
i.e. partitioned devices. The @code{partition} flag is also useful DOSEMU
hdimages. It is not recommended for hard disks for which direct access
to partitions is available through mounting.
@item offset
@cindex Ram disk
@cindex Atari Ram disk
Describes where in the file the MS-DOS file system starts. This is useful
for logical partitions in DOSEMU hdimages, and for ATARI ram disks. By
default, this is zero, meaning that the file system starts right at the
beginning of the device or file.
@end table
@node geometry description, open flags, location information, per drive variables
@subsection Disk Geometry Configuration
@cindex Disk Geometry
@cindex Configuration of disk geometry
@cindex Description of disk geometry
@cindex Format of disk
@cindex High density disk
@cindex Low density disk
@pindex mformat (geometry used for)
Geometry information describes the physical characteristics about the
disk. Its has three purposes:
@table @asis
@item formatting
The geometry information is written into the boot sector of the newly
made disk. However, you may also describe the geometry information on
the command line. @xref{mformat}, for details.
@item filtering
On some Unixes there are device nodes which only support one physical
geometry. For instance, you might need a different node to access a disk
as high density or as low density. The geometry is compared to the
actual geometry stored on the boot sector to make sure that this device
node is able to correctly read the disk. If the geometry doesn't match,
this drive entry fails, and the next drive entry bearing the same drive
letter is tried. @xref{multiple descriptions}, for more details on
supplying several descriptions for one drive letter.
If no geometry information is supplied in the configuration file, all
disks are accepted. On Linux (and on SPARC) there exist device nodes
with configurable geometry (@file{/dev/fd0}, @file{/dev/fd1} etc),
and thus filtering is not needed (and ignored) for disk drives. (Mtools
still does do filtering on plain files (disk images) in Linux: this is
mainly intended for test purposes, as I don't have access to a Unix
which would actually need filtering).
If you do not need filtering, but want still a default geometry for
mformatting, you may switch off filtering using the @code{mformat_only}
flag.
If you want filtering, you should supply the @code{filter} flag. If you
supply a geometry, you must supply one of both flags.
@item initial geometry
On devices that support it (usually floppy devices), the geometry
information is also used to set the initial geometry. This initial
geometry is applied while reading the boot sector, which contains the
real geometry. If no geometry information is supplied in the
configuration file, or if the @code{mformat_only} flag is supplied, no
initial configuration is done.
On Linux, initial geometry is not really needed, as the configurable
devices are able to auto-detect the disk type accurately enough (for
most common formats) to read the boot sector.
@end table
Wrong geometry information may lead to very bizarre errors. That's why I
strongly recommend that you add the @code{mformat_only} flag to your
drive description, unless you really need filtering or initial geometry.
The following geometry related variables are available:
@table @code
@item cylinders
@itemx tracks
@vindex cylinders
@vindex tracks
The number of cylinders. (@code{cylinders} is the preferred form,
@code{tracks} is considered obsolete)
@item heads
@vindex heads
The number of heads (sides).
@item sectors
@vindex sectors
The number of sectors per track.
@end table
Example: the following drive section describes a 1.44M drive:
@example
drive a:
file="/dev/fd0H1440"
fat_bits=12
cylinders=80 heads=2 sectors=18
mformat_only
@end example
The following shorthand geometry descriptions are available:
@table @code
@item 1.44m
high density 3 1/2 disk. Equivalent to:
@code{fat_bits=12 cylinders=80 heads=2 sectors=18}
@item 1.2m
high density 5 1/4 disk. Equivalent to:
@code{fat_bits=12 cylinders=80 heads=2 sectors=15}
@item 720k
double density 3 1/2 disk. Equivalent to:
@code{fat_bits=12 cylinders=80 heads=2 sectors=9}
@item 360k
double density 5 1/4 disk. Equivalent to:
@code{fat_bits=12 cylinders=40 heads=2 sectors=9}
@end table
The shorthand format descriptions may be amended. For example,
@code{360k sectors=8}
describes a 320k disk and is equivalent to:
@code{fat_bits=12 cylinders=40 heads=2 sectors=8}
@node open flags, miscellaneous variables, geometry description, per drive variables
@subsection Open Flags
@vindex sync
@vindex nodelay
@vindex exclusive
@cindex open flags
@cindex synchronous writing
@cindex exclusive access to a drive
Moreover, the following flags are available:
@table @code
@item sync
All i/o operations are done synchronously
@item nodelay
The device or file is opened with the O_NDELAY flag. This is needed on
some non-Linux architectures.
@item exclusive
The device or file is opened with the O_EXCL flag. On Linux, this
ensures exclusive access to the floppy drive. On most other
architectures, and for plain files it has no effect at all.
@end table
@node miscellaneous variables, miscellaneous flags, open flags, per drive variables
@subsection General Purpose Drive Variables
The following general purpose drive variables are available.
Depending to their type, these variables can be set to a string
(precmd, postcmd) or an integer (all others)
@table @code
@item fat_bits
@vindex fat_bits
The number of FAT bits. This may be 12 or 16. This is very rarely
needed, as it can almost always be deduced from information in the
boot sector. On the contrary, describing the number of fat bits may
actually be harmful if you get it wrong. You should only use it if
mtools gets the auto-detected number of fat bits wrong, or if you want
to mformat a disk with a weird number of fat bits.
@item codepage
Describes the DOS code page used for short filenames. This is a number
between 1 and 999. By default, code page 850 is used. The reason for
this is because this code page contains most of the characters that are
also available in ISO-Latin-1. You may also specify a global code page
for all drives by using the global @code{default_codepage} parameter
(outside of any drive description). This parameters exists starting at
version 4.0.0
@item data_map
Remaps data from image file. This is useful for image files which
might need additional zero-filled sectors to be inserted. Such is the
case for instance for IBM 3174 floppy images. These images represent
floppy disks with fewer sectors on their first cylinder. These missing
sectors are not stored in the image, but are still counted in the
filesystem layout. The data_map allows to fake these missing sectors
for the upper layers of mtools. A data_map is a comma-separated
sequence of source type and size. Source type may be @code{zero} for
zero-filled sectors created by map, @code{skip} for data in raw image
to be ignored (skipped), and nothing for data to be used as is
(copied) from the raw image. Datamap is automatically complemented by
an implicit last element of data to be used as is from current offset
to end of file. Each size is a number followed by a unit: @code{s} for
a 512 byte sector, @code{K} for Kbytes, @code{M} for megabytes,
@code{G} for gigabytes, and nothing for single bytes.
Example:
@code{data_map=1s,zero31s,28s,skip1s} would be a map for use with IBM
3174 floppy images. First sector (@code{1s}, boot sector) is used as
is. Then follow 31 fake zero-filled sectors (@code{zero31s}), then the
next 28 sectors from image (@code{28s}) are used as is (they contain
FAT and root directory), then one sector from image is skipped
(@code{skip1s}), and finally the rest of image is used as is
(implicit)
@item precmd
@cindex Solaris (volcheck)
@cindex Executing commands before opening the device
Executes the given command before opening the device.
On some variants of Solaris, it is necessary to call 'volcheck -v'
before opening a floppy device, in order for the system to notice that
there is indeed a disk in the drive. @code{precmd="volcheck -v"} in the
drive clause establishes the desired behavior.
@item postcmd
@cindex Executing commands after closing the device
Executes the given command after closing the device.
May be useful if mtools shares the image file with some other application,
in order to release the image file to that application.
@item blocksize
@cindex raw device
@cindex character devices
@cindex blocksize
This parameter represents a default block size to be always used on this