blob: d9c4d35caac1df224cac0432fb3ea49a7330b2ee [file] [log] [blame]
Alistair Delvabeaee832021-02-24 11:27:23 -08001'\" t
Yi Kong39bbd962022-01-09 19:41:38 +08002.TH mtools 5 "08Jan22" MTOOLS MTOOLS
Alistair Delvabeaee832021-02-24 11:27:23 -08003.SH Name
4mtools.conf - mtools configuration files
5'\" t
6.de TQ
7.br
8.ns
9.TP \\$1
10..
11
12.tr \(is'
13.tr \(if`
14.tr \(pd"
15
Yi Kong39bbd962022-01-09 19:41:38 +080016.ds St Mtools\ 4.0.37
Alistair Delvabeaee832021-02-24 11:27:23 -080017.PP
18.SH Description
19.PP
20This manual page describes the configuration files for mtools. They
21are called \fR\&\f(CW\(ifSYSCONFDIRmtools.conf\(is\fR and \fR\&\f(CW\(if~/.mtoolsrc\(is\fR. If
22the environmental variable \fR\&\f(CWMTOOLSRC\fR is set, its contents is used
23as the filename for a third configuration file. These configuration
24files describe the following items:
25.TP
26* \ Global\ configuration\ flags\ and\ variables\
27.TP
28* \ Per\ drive\ flags\ and\ variables\
29.PP
30.SS Location\ of\ the\ configuration\ files
31.PP
32.PP
33\&\fR\&\f(CW\(ifSYSCONFDIRmtools.conf\(is\fR is the system-wide configuration file,
34and \fR\&\f(CW\(if~/.mtoolsrc\(is\fR is the user's private configuration file.
35.PP
36On some systems, the system-wide configuration file is called
37\&\fR\&\f(CW\(if/etc/default/mtools.conf\(is\fR instead.
38.PP
39.SS \ \ General\ configuration\ file\ syntax
40.PP
41The configuration files is made up of sections. Each section starts
42with a keyword identifying the section followed by a colon.
43Then follow variable assignments and flags. Variable assignments take
44the following form:
45.ft I
46.nf
47name=value
48.fi
49.ft R
50
51Flags are lone keywords without an equal sign and value following
52them. A section either ends at the end of the file or where the next
53section begins.
54.PP
55Lines starting with a hash (\fR\&\f(CW#\fR) are comments. Newline characters
56are equivalent to whitespace (except where ending a comment). The
57configuration file is case insensitive, except for item enclosed in
58quotes (such as filenames).
59.PP
60.SS Default\ values
61For most platforms, mtools contains reasonable compiled-in defaults for
62physical floppy drives. Thus, you usually don't need to bother with the
63configuration file, if all you want to do with mtools is to access your
64floppy drives. On the other hand, the configuration file is needed if
65you also want to use mtools to access your hard disk partitions and
66DOSEMU image files.
67.PP
68.SS Global\ variables
69.PP
70Global flags may be set to 1 or to 0.
71.PP
72The following global flags are recognized:
73.TP
74\&\fR\&\f(CWMTOOLS_SKIP_CHECK\fR\
75If this is set to 1, mtools skips most of its sanity checks. This is
76needed to read some Atari disks which have been made with the earlier
77ROMs, and which would not be recognized otherwise.
78.TP
79\&\fR\&\f(CWMTOOLS_FAT_COMPATIBILITY\fR\
80If this is set to 1, mtools skips the fat size checks. Some disks have
81a bigger FAT than they really need to. These are rejected if this
82option is not set.
83.TP
84\&\fR\&\f(CWMTOOLS_LOWER_CASE\fR\
85If this is set to 1, mtools displays all-upper-case short filenames as
86lowercase. This has been done to allow a behavior which is consistent
87with older versions of mtools which didn't know about the case bits.
88.TP
89\&\fR\&\f(CWMTOOLS_NO_VFAT\fR\
90If this is set to 1, mtools won't generate VFAT entries for filenames
91which are mixed-case, but otherwise legal dos filenames. This is useful
92when working with DOS versions which can't grok VFAT long names, such as
93FreeDOS.
94.TP
95\&\fR\&\f(CWMTOOLS_DOTTED_DIR\fR\
96In a wide directory, prints the short name with a dot instead of spaces
97separating the basename and the extension.
98.TP
99\&\fR\&\f(CWMTOOLS_NAME_NUMERIC_TAIL\fR\
100If this is set to one (default), generate numeric tails for all long
101names (~1). If set to zero, only generate numeric tails if otherwise a
102clash would have happened.
103.TP
104\&\fR\&\f(CWMTOOLS_TWENTY_FOUR_HOUR_CLOCK\fR\
105If 1, uses the European notation for times (twenty four hour clock),
106else uses the UK/US notation (am/pm)
107.TP
108\&\fR\&\f(CWMTOOLS_LOCK_TIMEOUT\fR\
109How long, in seconds, to wait for a locked device to become free.
110Defaults to 30.
111.PP
112Example:
113Inserting the following line into your configuration file instructs
114mtools to skip the sanity checks:
115
116.nf
117.ft 3
118.in +0.3i
119 MTOOLS_SKIP_CHECK=1
120.fi
121.in -0.3i
122.ft R
123.PP
124
125\&\fR
126.PP
127Global variables may also be set via the environment:
128
129.nf
130.ft 3
131.in +0.3i
132 export MTOOLS_SKIP_CHECK=1
133.fi
134.in -0.3i
135.ft R
136.PP
137
138\&\fR
139.PP
140Global string variables may be set to any value:
141.TP
142\&\fR\&\f(CWMTOOLS_DATE_STRING\fR\
143The format used for printing dates of files. By default, is dd-mm-yyyy.
144.PP
145.SS Per\ drive\ flags\ and\ variables
146.PP
147.SS \ \ General\ information
148.PP
149Per drive flags and values may be described in a drive section. A
150drive section starts with
151\&\fR\&\f(CWdrive\fR "\fIdriveletter\fR" :
152.PP
153Then follow variable-value pairs and flags.
154.PP
155This is a sample drive description:
156
157.nf
158.ft 3
159.in +0.3i
160 drive a:
161 file="/dev/fd0" use_xdf=1
162.fi
163.in -0.3i
164.ft R
165.PP
166
167\&\fR
168.PP
169.SS \ \ Location\ information
170.PP
171For each drive, you need to describe where its data is physically
172stored (image file, physical device, partition, offset).
173.TP
174\&\fR\&\f(CWfile\fR\
175The name of the file or device holding the disk image. This is
176mandatory. The file name should be enclosed in quotes.
177.TP
178\&\fR\&\f(CWpartition\fR\
179Tells mtools to treat the drive as a partitioned device, and to use the
180given partition. Only primary partitions are accessible using this
181method, and they are numbered from 1 to 4. For logical partitions, use
182the more general \fR\&\f(CWoffset\fR variable. The \fR\&\f(CWpartition\fR variable
183is intended for removable media such as Syquest disks, ZIP drives, and
184magneto-optical disks. Although traditional DOS sees Syquest disks and
185magneto-optical disks as \fR\&\f(CW\(ifgiant floppy disks\(is\fR which are
186unpartitioned, OS/2 and Windows NT treat them like hard disks,
187i.e. partitioned devices. The \fR\&\f(CWpartition\fR flag is also useful DOSEMU
188hdimages. It is not recommended for hard disks for which direct access
189to partitions is available through mounting.
190.TP
191\&\fR\&\f(CWoffset\fR\
192Describes where in the file the MS-DOS file system starts. This is useful
193for logical partitions in DOSEMU hdimages, and for ATARI ram disks. By
194default, this is zero, meaning that the file system starts right at the
195beginning of the device or file.
196.PP
197.SS \ \ Disk\ Geometry\ Configuration
198.PP
199Geometry information describes the physical characteristics about the
200disk. Its has three purposes:
201.TP
202formatting\
203The geometry information is written into the boot sector of the newly
204made disk. However, you may also describe the geometry information on
205the command line. See section mformat, for details.
206.TP
207filtering\
208On some Unixes there are device nodes which only support one physical
209geometry. For instance, you might need a different node to access a disk
210as high density or as low density. The geometry is compared to the
211actual geometry stored on the boot sector to make sure that this device
212node is able to correctly read the disk. If the geometry doesn't match,
213this drive entry fails, and the next drive entry bearing the same drive
214letter is tried. See section multiple descriptions, for more details on
215supplying several descriptions for one drive letter.
216.IP
217If no geometry information is supplied in the configuration file, all
218disks are accepted. On Linux (and on SPARC) there exist device nodes
219with configurable geometry (\fR\&\f(CW\(if/dev/fd0\(is\fR, \fR\&\f(CW\(if/dev/fd1\(is\fR etc),
220and thus filtering is not needed (and ignored) for disk drives. (Mtools
221still does do filtering on plain files (disk images) in Linux: this is
222mainly intended for test purposes, as I don't have access to a Unix
223which would actually need filtering).
224.IP
225If you do not need filtering, but want still a default geometry for
226mformatting, you may switch off filtering using the \fR\&\f(CWmformat_only\fR
227flag.
228.IP
229If you want filtering, you should supply the \fR\&\f(CWfilter\fR flag. If you
230supply a geometry, you must supply one of both flags.
231.TP
232initial\ geometry\
233On devices that support it (usually floppy devices), the geometry
234information is also used to set the initial geometry. This initial
235geometry is applied while reading the boot sector, which contains the
236real geometry. If no geometry information is supplied in the
237configuration file, or if the \fR\&\f(CWmformat_only\fR flag is supplied, no
238initial configuration is done.
239.IP
240On Linux, initial geometry is not really needed, as the configurable
241devices are able to auto-detect the disk type accurately enough (for
242most common formats) to read the boot sector.
243.PP
244Wrong geometry information may lead to very bizarre errors. That's why I
245strongly recommend that you add the \fR\&\f(CWmformat_only\fR flag to your
246drive description, unless you really need filtering or initial geometry.
247.PP
248The following geometry related variables are available:
249.TP
250\&\fR\&\f(CWcylinders\fR\
251.TQ
252\&\fR\&\f(CWtracks\fR
253The number of cylinders. (\fR\&\f(CWcylinders\fR is the preferred form,
254\&\fR\&\f(CWtracks\fR is considered obsolete)
255.TP
256\&\fR\&\f(CWheads\fR\
257The number of heads (sides).
258.TP
259\&\fR\&\f(CWsectors\fR\
260The number of sectors per track.
261.PP
262Example: the following drive section describes a 1.44M drive:
263.PP
264
265.nf
266.ft 3
267.in +0.3i
268 drive a:
269 file="/dev/fd0H1440"
270 fat_bits=12
271 cylinders=80 heads=2 sectors=18
272 mformat_only
273.fi
274.in -0.3i
275.ft R
276.PP
277
278\&\fR
279.PP
280The following shorthand geometry descriptions are available:
281.TP
282\&\fR\&\f(CW1.44m\fR\
283high density 3 1/2 disk. Equivalent to:
284\&\fR\&\f(CWfat_bits=12 cylinders=80 heads=2 sectors=18\fR
285.TP
286\&\fR\&\f(CW1.2m\fR\
287high density 5 1/4 disk. Equivalent to:
288\&\fR\&\f(CWfat_bits=12 cylinders=80 heads=2 sectors=15\fR
289.TP
290\&\fR\&\f(CW720k\fR\
291double density 3 1/2 disk. Equivalent to:
292\&\fR\&\f(CWfat_bits=12 cylinders=80 heads=2 sectors=9\fR
293.TP
294\&\fR\&\f(CW360k\fR\
295double density 5 1/4 disk. Equivalent to:
296\&\fR\&\f(CWfat_bits=12 cylinders=40 heads=2 sectors=9\fR
297.PP
298The shorthand format descriptions may be amended. For example,
299\&\fR\&\f(CW360k sectors=8\fR
300describes a 320k disk and is equivalent to:
301\&\fR\&\f(CWfat_bits=12 cylinders=40 heads=2 sectors=8\fR
302.PP
303.SS \ \ Open\ Flags
304.PP
305Moreover, the following flags are available:
306.TP
307\&\fR\&\f(CWsync\fR\
308All i/o operations are done synchronously
309.TP
310\&\fR\&\f(CWnodelay\fR\
311The device or file is opened with the O_NDELAY flag. This is needed on
312some non-Linux architectures.
313.TP
314\&\fR\&\f(CWexclusive\fR\
315The device or file is opened with the O_EXCL flag. On Linux, this
316ensures exclusive access to the floppy drive. On most other
317architectures, and for plain files it has no effect at all.
318.PP
319.SS \ \ General\ Purpose\ Drive\ Variables
320.PP
321The following general purpose drive variables are available. Depending
322to their type, these variables can be set to a string (precmd) or
323an integer (all others)
324.TP
325\&\fR\&\f(CWfat_bits\fR\
326The number of FAT bits. This may be 12 or 16. This is very rarely
327needed, as it can almost always be deduced from information in the
328boot sector. On the contrary, describing the number of fat bits may
329actually be harmful if you get it wrong. You should only use it if
330mtools gets the auto-detected number of fat bits wrong, or if you want
331to mformat a disk with a weird number of fat bits.
332.TP
333\&\fR\&\f(CWcodepage\fR\
334Describes the DOS code page used for short filenames. This is a number
335between 1 and 999. By default, code page 850 is used. The reason for
336this is because this code page contains most of the characters that are
337also available in ISO-Latin-1. You may also specify a global code page
338for all drives by using the global \fR\&\f(CWdefault_codepage\fR parameter
339(outside of any drive description). This parameters exists starting at
340version 4.0.0
341.TP
Yi Kong39bbd962022-01-09 19:41:38 +0800342\&\fR\&\f(CWdata_map\fR\
343Remaps data from image file. This is useful for image files which
344might need additional zero-filled sectors to be inserted. Such is the
345case for instance for IBM 3174 floppy images. These images represent
346floppy disks with fewer sectors on their first cylinder. These missing
347sectors are not stored in the image, but are still counted in the
348filesystem layout. The data_map allows to fake these missing sectors
349for the upper layers of mtools. A data_map is a comma-separated
350sequence of source type and size. Source type may be \fR\&\f(CWzero\fR for
351zero-filled sectors created by map, \fR\&\f(CWskip\fR for data in raw image
352to be ignored (skipped), and nothing for data to be used as is
353(copied) from the raw image. Datamap is automatically complemented by
354an implicit last element of data to be used as is from current offset
355to end of file. Each size is a number followed by a unit: \fR\&\f(CWs\fR for
356a 512 byte sector, \fR\&\f(CWK\fR for Kbytes, \fR\&\f(CWM\fR for megabytes,
357\&\fR\&\f(CWG\fR for gigabytes, and nothing for single bytes.
358.IP
359Example:
360.IP
361\&\fR\&\f(CWdata_map=1s,zero31s,28s,skip1s\fR would be a map for use with IBM
3623174 floppy images. First sector (\fR\&\f(CW1s\fR, boot sector) is used as
363is. Then follow 31 fake zero-filled sectors (\fR\&\f(CWzero31s\fR), then the
364next 28 sectors from image (\fR\&\f(CW28s\fR) are used as is (they contain
365FAT and root directory), then one sector from image is skipped
366(\fR\&\f(CWskip1s\fR), and finally the rest of image is used as is
367(implicit)
368.IP
369.TP
Alistair Delvabeaee832021-02-24 11:27:23 -0800370\&\fR\&\f(CWprecmd\fR\
371On some variants of Solaris, it is necessary to call 'volcheck -v'
372before opening a floppy device, in order for the system to notice that
373there is indeed a disk in the drive. \fR\&\f(CWprecmd="volcheck -v"\fR in the
374drive clause establishes the desired behavior.
375.TP
376\&\fR\&\f(CWblocksize\fR\
377This parameter represents a default block size to be always used on this
378device. All I/O is done with multiples of this block size,
379independently of the sector size registered in the file system's boot
380sector. This is useful for character devices whose sector size is not
381512, such as for example CD-ROM drives on Solaris.
382.PP
383Only the \fR\&\f(CWfile\fR variable is mandatory. The other parameters may
384be left out. In that case a default value or an auto-detected value is
385used.
386.PP
387.SS \ \ General\ Purpose\ Drive\ Flags
388.PP
389A flag can either be set to 1 (enabled) or 0 (disabled). If the value is
390omitted, it is enabled. For example, \fR\&\f(CWscsi\fR is equivalent to
391\&\fR\&\f(CWscsi=1\fR
392.TP
393\&\fR\&\f(CWnolock\fR\
394Instruct mtools to not use locking on this drive. This is needed on
395systems with buggy locking semantics. However, enabling this makes
396operation less safe in cases where several users may access the same
397drive at the same time.
398.TP
399\&\fR\&\f(CWscsi\fR\
400When set to 1, this option tells mtools to use raw SCSI I/O instead of
401the standard read/write calls to access the device. Currently, this is
402supported on HP-UX, Solaris and SunOS. This is needed because on some
403architectures, such as SunOS or Solaris, PC media can't be accessed
404using the \fR\&\f(CWread\fR and \fR\&\f(CWwrite\fR system calls, because the OS expects
405them to contain a Sun specific "disk label".
406.IP
407As raw SCSI access always uses the whole device, you need to specify the
408"partition" flag in addition
409.IP
410On some architectures, such as Solaris, mtools needs root privileges to
411be able to use the \fR\&\f(CWscsi\fR option. Thus mtools should be installed
412setuid root on Solaris if you want to access Zip/Jaz drives. Thus, if
413the \fR\&\f(CWscsi\fR flag is given, \fR\&\f(CWprivileged\fR is automatically
414implied, unless explicitly disabled by \fR\&\f(CWprivileged=0\fR
415.IP
416Mtools uses its root privileges to open the device, and to issue the
417actual SCSI I/O calls. Moreover, root privileges are only used for
418drives described in a system-wide configuration file such as
419\&\fR\&\f(CW\(ifSYSCONFDIRmtools.conf\(is\fR, and not for those described in
420\&\fR\&\f(CW\(if~/.mtoolsrc\(is\fR or \fR\&\f(CW\(if$MTOOLSRC\(is\fR.
421.TP
422\&\fR\&\f(CWprivileged\fR\
423When set to 1, this instructs mtools to use its setuid and setgid
424privileges for opening the given drive. This option is only valid for
425drives described in the system-wide configuration files (such as
426\&\fR\&\f(CW\(ifSYSCONFDIRmtools.conf\(is\fR, not \fR\&\f(CW\(if~/.mtoolsrc\(is\fR or
427\&\fR\&\f(CW\(if$MTOOLSRC\(is\fR). Obviously, this option is also a no op if mtools is
428not installed setuid or setgid. This option is implied by 'scsi=1', but
429again only for drives defined in system-wide configuration files.
430Privileged may also be set explicitly to 0, in order to tell mtools not
431to use its privileges for a given drive even if \fR\&\f(CWscsi=1\fR is set.
432.IP
433Mtools only needs to be installed setuid if you use the
434\&\fR\&\f(CWprivileged\fR or \fR\&\f(CWscsi\fR drive variables. If you do not use
435these options, mtools works perfectly well even when not installed
436setuid root.
437.TP
438\&\fR\&\f(CWvold\fR\
439.IP
440Instructs mtools to interpret the device name as a vold identifier
441rather than as a filename. The vold identifier is translated into a
442real filename using the \fR\&\f(CWmedia_findname()\fR and
443\&\fR\&\f(CWmedia_oldaliases()\fR functions of the \fR\&\f(CWvolmgt\fR library. This
444flag is only available if you configured mtools with the
445\&\fR\&\f(CW--enable-new-vold\fR option before compilation.
446.TP
447\&\fR\&\f(CWswap\fR\
448.IP
449Consider the media as a word-swapped Atari disk.
450.TP
451\&\fR\&\f(CWuse_xdf\fR\
452If this is set to a non-zero value, mtools also tries to access this
453disk as an XDF disk. XDF is a high capacity format used by OS/2. This
454is off by default. See section XDF, for more details.
455.TP
456\&\fR\&\f(CWmformat_only\fR\
457Tells mtools to use the geometry for this drive only for mformatting and
458not for filtering.
459.TP
460\&\fR\&\f(CWfilter\fR\
461Tells mtools to use the geometry for this drive both for mformatting and
462filtering.
463.TP
464\&\fR\&\f(CWremote\fR\
465Tells mtools to connect to floppyd (see section floppyd).
466.PP
467.SS \ \ Supplying\ multiple\ descriptions\ for\ a\ drive
468.PP
469It is possible to supply multiple descriptions for a drive. In that
470case, the descriptions are tried in order until one is found that
471fits. Descriptions may fail for several reasons:
472.TP
4731.\
474because the geometry is not appropriate,
475.TP
4762.\
477because there is no disk in the drive,
478.TP
4793.\
480or because of other problems.
481.PP
482Multiple definitions are useful when using physical devices which are
483only able to support one single disk geometry.
484Example:
485
486.nf
487.ft 3
488.in +0.3i
489 drive a: file="/dev/fd0H1440" 1.44m
490 drive a: file="/dev/fd0H720" 720k
491.fi
492.in -0.3i
493.ft R
494.PP
495
496\&\fR
497.PP
498This instructs mtools to use /dev/fd0H1440 for 1.44m (high density)
499disks and /dev/fd0H720 for 720k (double density) disks. On Linux, this
500feature is not really needed, as the /dev/fd0 device is able to handle
501any geometry.
502.PP
503You may also use multiple drive descriptions to access both of your
504physical drives through one drive letter:
505.PP
506
507.nf
508.ft 3
509.in +0.3i
510 drive z: file="/dev/fd0"
511 drive z: file="/dev/fd1"
512.fi
513.in -0.3i
514.ft R
515.PP
516
517\&\fR
518.PP
519With this description, \fR\&\f(CWmdir z:\fR accesses your first physical
520drive if it contains a disk. If the first drive doesn't contain a disk,
521mtools checks the second drive.
522.PP
523When using multiple configuration files, drive descriptions in the files
524parsed last override descriptions for the same drive in earlier
525files. In order to avoid this, use the \fR\&\f(CWdrive+\fR or \fR\&\f(CW+drive\fR
526keywords instead of \fR\&\f(CWdrive\fR. The first adds a description to the
527end of the list (i.e. it will be tried last), and the first adds it to
528the start of the list.
529.PP
530.SS Location\ of\ configuration\ files\ and\ parsing\ order
531.PP
532The configuration files are parsed in the following order:
533.TP
5341.\
535compiled-in defaults
536.TP
5372.\
538\&\fR\&\f(CW\(ifSYSCONFDIRmtools.conf\(is\fR
539.TP
5403.\
541\&\fR\&\f(CW\(if~/.mtoolsrc\(is\fR.
542.TP
5434.\
544\&\fR\&\f(CW\(if$MTOOLSRC\(is\fR (file pointed by the \fR\&\f(CWMTOOLSRC\fR environmental
545variable)
546.PP
547Options described in the later files override those described in the
548earlier files. Drives defined in earlier files persist if they are not
549overridden in the later files. For instance, drives A and B may be
550defined in \fR\&\f(CW\(ifSYSCONFDIRmtools.conf\(is\fR and drives C and D may be
551defined in \fR\&\f(CW\(if~/.mtoolsrc\(is\fR However, if \fR\&\f(CW\(if~/.mtoolsrc\(is\fR also
552defines drive A, this new description would override the description of
553drive A in \fR\&\f(CW\(ifSYSCONFDIRmtools.conf\(is\fR instead of adding to it. If
554you want to add a new description to a drive already described in an
555earlier file, you need to use either the \fR\&\f(CW+drive\fR or \fR\&\f(CWdrive+\fR
556keyword.
557.PP
558.SS Backwards\ compatibility\ with\ old\ configuration\ file\ syntax
559.PP
560The syntax described herein is new for version \fR\&\f(CWmtools-3.0\fR. The
561old line-oriented syntax is still supported. Each line beginning with a
562single letter is considered to be a drive description using the old
563syntax. Old style and new style drive sections may be mixed within the
564same configuration file, in order to make upgrading easier. Support for
565the old syntax will be phased out eventually, and in order to discourage
566its use, I purposefully omit its description here.
567.PP
568.SH See also
569mtools