| [Top] | [Contents] | [Index] | [ ? ] |
Mtools is sufficient to give access to MS-DOS filesystems. For
instance, commands such as mdir a: work on the a: floppy
without any preliminary mounting or initialization (assuming the default
`/etc/mtools.conf' works on your machine). With mtools, one can
change floppies too without unmounting and mounting.
1. Where to get mtools Where to find mtools and early bug fixes 2. Common features of all mtools commands 3. How to configure mtools for your environment 4. Command list The available mtools commands 5. Architecture specific compilation flags 6. Porting mtools to architectures which are not supported yet Porting mtools to architectures which are not yet supported
Command Index Variable index Variable Index Concept index Concept Index
If you are reading this documentation on the World Wide Web, this section might interest you. If you are reading it using info, or as a printed document, or on one of our own sites (http://www.tux.org/pub/knaff and http://mtools.linux.lu) you do not need to worry.
It has come to my attention that some of the Web sites which display this documentation deal so called "cookies". These "cookies" are tags sent from the server to the browser, which enable the server to keep track of the sites that the user visits, and thus compromise his privacy. If you use netscape, you can enable confirmation messages for any cookies sent to your browser by going into Options->Network_Preferences->Protocols and checking the box for "Show an Alert before Accepting a cookie". Then, when the alert box pops up, click "Cancel" to refuse the cookie and protect your privacy.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Mtools can be found at the following places (and their mirrors):
http://mtools.linux.lu/mtools-3.9.10.tar.gz ftp://www.tux.org/pub/knaff/mtools/mtools-3.9.10.tar.gz ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-3.9.10.tar.gz |
Before reporting a bug, make sure that it has not yet been fixed in the Alpha patches which can be found at:
http://mtools.linux.lu/ ftp://www.tux.org/pub/knaff/mtools |
These patches are named
mtools-version-ddmm.taz, where version
stands for the base version, dd for the day and 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 mtools @ tux.org . Please send all bug reports to this list. You may subscribe to the list by sending a message with 'subscribe mtools @ tux.org' in its body to majordomo @ tux.org . (N.B. Please remove the spaces around the "@" both times. 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://www.tux.org/hypermail/mtools/latest
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.1 Options and filenames What the command line parameters of mtools mean 2.2 Drive letters Which drives are defined by default 2.3 Current working directory 2.4 VFAT-style long file names 2.5 Name clashes Name clash handling, and associated command line options 2.6 Case sensitivity of the VFAT filesystem Case sensitivity 2.7 high capacity formats How to fit more data on your floppies 2.8 Exit codes 2.9 Bugs Happens to everybody
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
/' or '\' separator. The use of the '\' 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 want the shell to expand
them.
The regular expression "pattern matching" routines follow the Unix-style
rules. For example, `*' matches all MS-DOS files in lieu of
`*.*'. The archive, hidden, read-only and system attribute bits
are ignored during pattern matching.
All options use the - (minus) as their first character, not
/ 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. See section 2.5 Name clashes, for more details on these. All
commands accept the -V flags which prints the version, and most
accept the -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. See section 4. Command list, for a description of
the options which are specific to each command.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 (see section 3. How to configure mtools for your environment).
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
-i options.
Example:
mcopy -i my-image-file.bin ::file1 ::file2 . |
This copies file1 and file2 from the image file
(my-image-file.bin) to the /tmp directory.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The mcd command (4.6 Mcd) is used to establish the device and
the current working directory (relative to the MS-DOS filesystem),
otherwise the default is assumed to be A:/. However, unlike
MS-DOS, there is only one working directory for all drives, and not one
per drive.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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:
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 |
As you see, the following transformations happen to derive a short name:
;+=[]',\"*\\<>/?:|.
~n number is generated,
The initial Unix-style file name (whether long or short) is also called the primary name, and the derived short name is also called the secondary name.
Example:
mcopy /etc/motd a:Reallylongname |
mcopy /etc/motd a:motd |
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 (\"*\\<>/?:|), and device names are still
reserved.
Unix name Long name Reason for the change --------- ---------- --------------------- prn prn-1 PRN is a device name ab:c ab_c-1 illegal character |
As you see, the following transformations happen if a long name is illegal:
-n number is generated,
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 mcopy,
mmd, mren, mmove. When a name clash happens, mtools
asks you what it should do. It offers several choices:
overwrite
rename
autorename
skip
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:
-D o
-D O
-D r
-D R
-D a
-D A
-D s
-D S
-D m
-D M
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.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The VFAT filesystem 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 filesystem, 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 filesystem allows 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.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Mtools supports a number of formats which allow to store more data on disk as usual. Due to different operating system abilities, these formats are not supported on all OS'es. 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
fdutils package at the following locations~:
|
See the manpages included in that package for further detail: Use
superformat to format all formats except XDF, and use
xdfcopy to format XDF.
2.7.1 More sectors Putting more sectors per track on the disk 2.7.2 Bigger sectors Use bigger sectors to save header space 2.7.3 2m Use a standard first track 2.7.4 XDF OS/2's eXtended density format
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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
fdformat and vgacopy. In his infinite hybris, Bill Gate$
believed that he invented this, and called it `DMF disks', or
`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.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This method allows to store up to 1992K on a 3 1/2 HD disk.
Mtools supports these formats only on Linux.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 easyer to handle by DOS. Indeed this method allows to have a standard sized bootsector, 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 shadow FAT. (Usually, DOS stores the FAT in two identical copies, for additional safety. XDF stores only one copy, and it tells DOS that it stores two. Thus the same that would be taken up by the second FAT copy is saved.) This also means that your should never use a 2m disk to store anything else than a DOS fs.
Mtools supports these format only on Linux.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 use_xdf variable for the drive in the
configuration file. See section 5. Architecture specific compilation flags, and 3.6 General Purpose Drive 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.
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.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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, 3.4 Global variables) to bypass the fat checking.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This sections explains the syntax of the configurations files for
mtools. The configuration files
are called `/usr/local/etc/mtools.conf' and `~/.mtoolsrc'. If
the environmental variable MTOOLSRC is set, its contents is used
as the filename for a third configuration file. These configuration
files describe the following items:
3.2 Location of the configuration files Where mtools looks for its configuration files 3.2.1 General configuration file syntax The layout of the configuration files 3.3 Default values Why you don't need a config file in most cases 3.4 Global variables Variables that are independent of the drive 3.5 Per drive flags and variables Variables that are specific to a given drive 3.8 Character set translation tables 3.9 Location of configuration files and parsing order 3.10 Backwards compatibility with old configuration file syntax Backwards compatibility
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
`/usr/local/etc/mtools.conf' is the system-wide configuration file, and `~/.mtoolsrc' is the user's private configuration file.
On some systems, the system-wide configuration file is called `/etc/defaults/mtools.conf' instead.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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:
name=value |
Lines starting with a hash (#) 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).
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Global flags may be set to 1 or to 0.
The following global flags are recognized:
MTOOLS_SKIP_CHECK
MTOOLS_FAT_COMPATIBILITY
MTOOLS_LOWER_CASE
MTOOLS_NO_VFAT
MTOOLS_DOTTED_DIR
MTOOLS_NAME_NUMERIC_TAIL
MTOOLS_TWENTY_FOUR_HOUR_CLOCK
Example: Inserting the following line into your configuration file instructs mtools to skip the sanity checks:
MTOOLS_SKIP_CHECK=1 |
Global variables may also be set via the environment:
export MTOOLS_SKIP_CHECK=1 |
Global string variables may be set to any value:
MTOOLS_DATE_STRING
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.5.1 General information What a drive description looks like 3.5.2 Disk Geometry Configuration Describes the physical characteristics of the media 3.5.3 Open Flags Flags passed to the open system call when the device is opened 3.6 General Purpose Drive Variables Variables which don't fit in either category 3.7 General Purpose Drive Flags Switch variables, which can be enabled or disabled 3.7.1 Supplying multiple descriptions for a drive How to supply several descriptions for a drive, to be tried one after the other.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Per drive flags and values may be described in a drive section. A
drive section starts with
drive "driveletter" :
Then follow variable-value pairs and flags.
This is a sample drive description:
drive a:
file="/dev/fd0" use_xdf=1
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Geometry information describes the physical characteristics about the disk. Its has three purposes:
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 (`/dev/fd0', `/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 mformat_only
flag.
If you want filtering, you should supply the filter flag. If you
supply a geometry, you must supply one of both flags.
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.
Wrong geometry information may lead to very bizarre errors. That's why I
strongly recommend that you add the mformat_only flag to your
drive description, unless you really need filtering or initial geometry.
The following geometry related variables are available:
cylinders
tracks
cylinders is the preferred form,
tracks is considered obsolete)
heads
sectors
Example: the following drive section describes a 1.44M drive:
drive a:
file="/dev/fd0H1440"
fat_bits=12
cylinders=80 heads=2 sectors=18
mformat_only
|
The following shorthand geometry descriptions are available:
1.44m
fat_bits=12 cylinders=80 heads=2 sectors=18
1.2m
fat_bits=12 cylinders=80 heads=2 sectors=15
720k
fat_bits=12 cylinders=80 heads=2 sectors=9
360k
fat_bits=12 cylinders=40 heads=2 sectors=9
The shorthand format descriptions may be amended. For example,
360k sectors=8
describes a 320k disk and is equivalent to:
fat_bits=12 cylinders=40 heads=2 sectors=8
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Moreover, the following flags are available:
sync
nodelay
exclusive
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following general purpose drive variables are available. Depending to their type, these variables can be set to a string (file, precmd) or an integer (all others)
file
partition
offset variable. The partition variable
is intended for removable media such as Syquests, ZIP drives, and
magneto-optical disks. Although traditional DOS sees Syquests and
magneto-optical disks as `giant floppy disks' which are
unpartitioned, OS/2 and Windows NT treat them like hard disks,
i.e. partioned devices. The partition flag is also useful DOSEMU
hdimages. It is not recommended for hard disks for which direct access
to partitions is available through mounting.
offset
fat_bits
precmd
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. precmd="volcheck -v" in the
drive clause establishes the desired behavior.
blocksize
This parameter represents a default block size to be always used on this device. All I/O is done with multiples of this block size, independantly of the sector size registered in the filesystem's boot sector. This is useful for character devices whose sector size is not 512, such as for example CD Rom drives on Solaris.
Only the file variable is mandatory. The other parameters may
be left out. In that case a default value or an autodetected value is
used.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A flag can either be set to 1 (enabled) or 0 (disabled). If the value is
ommitted, it is enabled. For example, scsi is equivalent to
scsi=1
nolock
scsi
read and write syscalls, because the OS expects
them to contain a Sun specific "disk label".
As raw Scsi access always uses the whole device, you need to specify the "partition" flag in addition
On some architectures, such as Solaris, mtools needs root privileges to
be able to use the scsi option. Thus mtools should be installed
set uid root on Solaris if you want to access Zip/Jaz drives. Thus, if
the scsi flag is given, privileged is automatically
implied, unless explicitly disabled by privileged=0
Mtools uses its root privileges to open the device, and to issue the actual SCSI I/O calls. Moreover, root privileges are only used for drives described in a system-wide configuration file such as `/usr/local/etc/mtools.conf', and not for those described in `~/.mtoolsrc' or `$MTOOLSRC'.
privileged
scsi=1 is set.
Mtools only needs to be installed setuid if you use the
privileged or scsi drive variables. If you do not use
these options, mtools works perfectly well even when not installed
setuid root.
vold
Instructs mtools to interpret the device name as a vold identifier
rather than as a filename. The vold identifier is translated into a
real filename using the media_findname() and
media_oldaliases() functions of the volmgt library. This
flag is only available if you configured mtools with the
--enable-new-vold option before compilation.
swap
Consider the media as a word-swapped Atari disk.
use_xdf
mformat_only
filter
remote
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is possible to supply multiple descriptions for a drive. In that case, the descriptions are tried in order until one is found that fits. Descriptions may fail for several reasons:
Multiple definitions are useful when using physical devices which are only able to support one single disk geometry. Example:
drive a: file="/dev/fd0H1440" 1.44m drive a: file="/dev/fd0H720" 720k |
This instructs mtools to use /dev/fd0H1440 for 1.44m (high density) disks and /dev/fd0H720 for 720k (double density) disks. On Linux, this feature is not really needed, as the /dev/fd0 device is able to handle any geometry.
You may also use multiple drive descriptions to access both of your physical drives through one drive letter:
drive z: file="/dev/fd0" drive z: file="/dev/fd1" |
With this description, mdir z: accesses your first physical
drive if it contains a disk. If the first drive doesn't contain a disk,
mtools checks the second drive.
When using multiple configuration files, drive descriptions in the files
parsed last override descriptions for the same drive in earlier
files. In order to avoid this, use the drive+ or +drive
keywords instead of drive. The first adds a description to the
end of the list (i.e. it will be tried last), and the first adds it to
the start of the list.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If you live in the USA, in Western Europe or in Australia, you may skip this section.
3.8.1 Why character set translation tables are needed Why character set tables are needed 3.8.2 Configuration using Country Using the COUNTRY variable to select tables 3.8.3 Configuration using explicit translation tables Supplying a new table for an unknown country
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
DOS uses a different character code mapping than Unix. 7-bit characters still have the same meaning, only characters with the eight bit set are affected. To make matters worse, there are several translation tables available depending on the country where you are. The appearance of the characters is defined using code pages. These code pages aren't the same for all countries. For instance, some code pages don't contain upper case accented characters. On the other hand, some code pages contain characters which don't exist in Unix, such as certain line-drawing characters or accented consonants used by some Eastern European countries. This affects two things, relating to filenames:
Mtools considers the filenames entered on the command line as having the
Unix mapping, and translates the characters to get short names. By
default, code page 850 is used with the Swiss uppercase/lowercase
mapping. I chose this code page, because its set of existing characters
most closely matches Unix's. Moreover, this code page covers most
characters in use in the USA, Australia and Western Europe. However, it
is still possible to chose a different mapping. There are two methods:
the country variable and explicit tables.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The COUNTRY variable is recommended for people which also have
access to MS-DOS system files and documentation. If you don't have access
to these, I'd suggest you'd rather use explicit tables instead.
Syntax:
COUNTRY="country[,[codepage],
country-file]"
This tells mtools to use a Unix-to-DOS translation table which matches codepage and an lowercase-to-uppercase table for country and to use the country-file file to get the lowercase-to-uppercase table. The country code is most often the telephone prefix of the country. Refer to the DOS help page on "country" for more details. The codepage and the country-file parameters are optional. Please don't type in the square brackets, they are only there to say which parameters are optional. The country-file file is supplied with MS-DOS, and is usually called `COUNTRY.SYS', and stored in the `C:\DOS' directory. In most cases you don't need it, as the most common translation tables are compiled into mtools. So, don't worry if you run a Unix-only box which lacks this file.
If codepage is not given, a per country default code page is used. If the country-file parameter isn't given, compiled-in defaults are used for the lowercase-to-uppercase table. This is useful for other Unices than Linux, which may have no `COUNTRY.SYS' file available online.
The Unix-to-DOS are not contained in the `COUNTRY.SYS' file, and
thus mtools always uses compiled-in defaults for those. Thus, only a
limited amount of code pages are supported. If your preferred code page
is missing, or if you know the name of the Windows 95 file which
contains this mapping, could you please drop me a line at
alain@linux.lu.
The COUNTRY variable can also be set using the environment.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Translation tables may be described in line in the configuration
file. Two tables are needed: first the DOS-to-Unix table, and then the
Lowercase-to-Uppercase table. A DOS-to-Unix table starts with the
tounix
keyword, followed by a colon, and 128 hexadecimal numbers.
A lower-to-upper table starts with the
fucase
keyword, followed by a colon, and 128 hexadecimal numbers.
The tables only show the translations for characters whose codes is greater than 128, because translation for lower codes is trivial.
tounix: 0xc7 0xfc 0xe9 0xe2 0xe4 0xe0 0xe5 0xe7 0xea 0xeb 0xe8 0xef 0xee 0xec 0xc4 0xc5 0xc9 0xe6 0xc6 0xf4 0xf6 0xf2 0xfb 0xf9 0xff 0xd6 0xdc 0xf8 0xa3 0xd8 0xd7 0x5f 0xe1 0xed 0xf3 0xfa 0xf1 0xd1 0xaa 0xba 0xbf 0xae 0xac 0xbd 0xbc 0xa1 0xab 0xbb 0x5f 0x5f 0x5f 0x5f 0x5f 0xc1 0xc2 0xc0 0xa9 0x5f 0x5f 0x5f 0x5f 0xa2 0xa5 0xac 0x5f 0x5f 0x5f 0x5f 0x5f 0x5f 0xe3 0xc3 0x5f 0x5f 0x5f 0x5f 0x5f 0x5f 0x5f 0xa4 0xf0 0xd0 0xc9 0xcb 0xc8 0x69 0xcd 0xce 0xcf 0x5f 0x5f 0x5f 0x5f 0x7c 0x49 0x5f 0xd3 0xdf 0xd4 0xd2 0xf5 0xd5 0xb5 0xfe 0xde 0xda 0xd9 0xfd 0xdd 0xde 0xaf 0xb4 0xad 0xb1 0x5f 0xbe 0xb6 0xa7 0xf7 0xb8 0xb0 0xa8 0xb7 0xb9 0xb3 0xb2 0x5f 0x5f fucase: 0x80 0x9a 0x90 0xb6 0x8e 0xb7 0x8f 0x80 0xd2 0xd3 0xd4 0xd8 0xd7 0xde 0x8e 0x8f 0x90 0x92 0x92 0xe2 0x99 0xe3 0xea 0xeb 0x59 0x99 0x9a 0x9d 0x9c 0x9d 0x9e 0x9f 0xb5 0xd6 0xe0 0xe9 0xa5 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa 0xab 0xac 0xad 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9 0xba 0xbb 0xbc 0xbd 0xbe 0xbf 0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc7 0xc7 0xc8 0xc9 0xca 0xcb 0xcc 0xcd 0xce 0xcf 0xd1 0xd1 0xd2 0xd3 0xd4 0x49 0xd6 0xd7 0xd8 0xd9 0xda 0xdb 0xdc 0xdd 0xde 0xdf 0xe0 0xe1 0xe2 0xe3 0xe5 0xe5 0xe6 0xe8 0xe8 0xe9 0xea 0xeb 0xed 0xed 0xee 0xef 0xf0 0xf1 0xf2 0xf3 0xf4 0xf5 0xf6 0xf7 0xf8 0xf9 0xfa 0xfb 0xfc 0xfd 0xfe 0xff |
The first table maps DOS character codes to Unix character codes. For example, the DOS character number 129. This is a u with to dots on top of it. To translate it into Unix, we look at the character number 1 in the first table (1 = 129 - 128). This is 0xfc. (Beware, numbering starts at 0). The second table maps lower case DOS characters to upper case DOS characters. The same lower case u with dots maps to character 0x9a, which is an uppercase U with dots in DOS.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Caution: When deleting files with mtools, the underscore matches all characters which can't be represented in Unix. Be careful with mdel!
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The configuration files are parsed in the following order:
MTOOLSRC environmental
variable)
Options described in the later files override those described in the
earlier files. Drives defined in earlier files persist if they are not
overridden in the later files. For instance, drives A and B may be
defined in `/usr/local/etc/mtools.conf' and drives C and D may be
defined in `~/.mtoolsrc' However, if `~/.mtoolsrc' also
defines drive A, this new description would override the description of
drive A in `/usr/local/etc/mtools.conf' instead of adding to it. If
you want to add a new description to a drive already described in an
earlier file, you need to use either the +drive or drive+
keyword.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The syntax described herein is new for version mtools-3.0. The
old line-oriented syntax is still supported. Each line beginning with a
single letter is considered to be a drive description using the old
syntax. Old style and new style drive sections may be mixed within the
same configuration file, in order to make upgrading easier. Support for
the old syntax will be phased out eventually, and in order to discourage
its use, I purposefully omit its description here.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes the available mtools commands, and the command line parameters that each of them accepts. Options which are common to all mtools commands are not described here, 2.1 Options and filenames for a description of those.
4.1 Floppyd floppy daemon to run on your X server box 4.2 Floppyd_installtest small utility to check for the presence of floppyd 4.3 Mattrib change MS-DOS file attribute flags 4.4 Mbadblocks tests a floppy disk, and marks the bad blocks in the FAT 4.5 Mcat same as cat. Only usefull with floppyd. 4.6 Mcd change MS-DOS directory 4.7 Mclasserase erase memory card 4.8 Mcopy copy MS-DOS files to/from Unix 4.9 Mdel delete an MS-DOS file 4.10 Mdeltree recursively delete an MS-DOS directory 4.11 Mdir display an MS-DOS directory 4.12 Mdu list space occupied by directory and its contents 4.13 Mformat add an MS-DOS filesystem to a low-level formatted floppy disk 4.15 Minfo get information about an MS-DOS filesystem. 4.16 Mlabel make an MS-DOS volume label 4.14 Mkmanifest makes a list of short name equivalents 4.17 Mmd make an MS-DOS subdirectory 4.18 Mmount mount an MS-DOS disk 4.20 Mpartition create an MS-DOS as a partition 4.21 Mrd remove an MS-DOS subdirectory 4.19 Mmove move or rename an MS-DOS file or subdirectory 4.22 Mren rename an existing MS-DOS file 4.23 Mshowfat shows the FAT map of a file 4.24 Mtoolstest tests and displays the configuration 4.25 Mtype display contents of an MS-DOS file 4.26 Mzip zip disk specific commands
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Floppyd is used as a server to grant access to the floppy drive
to clients running on a remote machine, just as an X server grants
access to the display to remote clients. It has the following syntax:
floppyd [-d] [-l] [-s port] [-r
user] [-b ipaddr] [-x display] devicenames
floppyd is always associated with an X server. It runs on the
same machine as its X server, and listens on port 5703 and above.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
floppyd authenticates remote clients using the Xauthority
protocol. Xhost authentication is not supported. Each floppyd is
associated with an X server. When a remote client attempts to connect
to floppyd, it sends floppyd the X authority record corresponding to
floppyd's X server. Floppyd in turn then tries to open up a connection
to the X server in order to verify the authenticity of the xauth record.
If the connection to the X server succeeds, the client is granted
access.
DISPLAY.
Caution: In order to make authentication work correctly, the
local host should not be listed in the xhost list of
allowed hosts.
Indeed, hosts listed in xhost do not need a correct
Xauthority cookie to connect to the X server. As floppyd
runs on the same host as the X server, all its probe connection would
succeed even for clients who supplied a bad cookie. This means that
your floppy drive would be open to the world, i.e. a huge security hole.
If your X server does not allow you to remove localhost:0 and
:0 from the xhost list, you can prevent floppyd from
probing those display names with the -l option.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
d
inetd.conf
s port
hitchhiker:5, the port would be 5708.
b ipaddr
r user
x display
DISPLAY variable. If neither the x attribute is present
nor DISPLAY is set, floppyd uses :0.0.
devicenames is a list of device nodes to be opened. Default
is /dev/fd0. Multiple devices are only supported on mtools
versions newer than 3.9.10.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to use floppyd, add the flag remote to the device
description in your `~/.mtoolsrc' file. If the flag remote
is given, the file parameter of the device description is taken
to be a remote address. It's format is the following:
hostname:displaynumber[/[baseport][/drive]]. When
using this entry, mtools connects to port
baseport+displaynumber at hostname. By default
baseport is 5703. The drive parameter is to distinguish among
multiple drives associated with a single display (only mtools versions
more recent than 3.9.10)
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following starts a floppy daemon giving access to `/dev/fd0', listening on the default port 5703, tied to the default X servers:
floppyd -d /dev/fd0 |
Each of the following starts a floppy daemon giving access to
`/dev/fd1', tied to the :1 local X servers, and listening on port
5704. We assume that the local host is named hitchhiker.
floppyd -d /dev/fd0 floppyd -d -x :1 -p 5704 /dev/fd0 |
If you want to start floppyd by inetd instead of running it as a
daemon, insert the following lines into `/etc/services':
# floppy daemon floppyd-0 5703/tcp # floppy daemon for X server :0 floppyd-1 5704/tcp # floppy daemon for X server :1 |
And insert the following into `/etc/inetd.conf' (assuming that you have defined a user named floppy in your `/etc/passwd'):
# floppy daemon floppyd-0 stream tcp wait floppy /usr/sbin/floppyd floppyd /dev/fd0 floppyd-1 stream tcp wait floppy /usr/sbin/floppyd floppyd -x :1 /dev/fd0 |
Note that you need to supply the X display names for the second floppyd. This is because the port is opened by inetd.conf, and hence floppyd cannot know its number to interfere the display number.
On the client side, insert the following into your `~/.mtoolsrc' to define a drive letter accessing floppy drive in your X terminal:
drive x: file="$DISPLAY" remote |
If your X terminal has more than one drive, you may access the additional drives as follows:
drive y: file="$DISPLAY//1" remote drive z: file="$DISPLAY//2" remote |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Floppyd_installtest is used to check for the presence of a running
floppyd daemon. This is usefull, if you have a small frontend script to
mtools, which decides whether to use floppyd or not.
floppyd_installtest [-f] Connect-String
If the -f option is specified, floppyd_installtest does a
full X-Cookie authentication and complains if this does not work.
The connect-String has the format described in the floppyd-section:
hostname:displaynumber[/baseport]
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Mattrib is used to change MS-DOS file attribute flags. It has the
following syntax:
mattrib [-a|+a] [-h|+h] [-r|+r]
[-s|+s] [-/] [-p] [-X] msdosfile [ msdosfiles ... ]
Mattrib adds attribute flags to an MS-DOS file (with the
`+' operator) or remove attribute flags (with the `-'
operator).
Mattrib supports the following attribute bits:
a
r
DEL nor modified.
s
h
DIR.
Mattrib supports the following command line flags:
/
X
p
readonly attribute is not taken into account, as tar can
set that one itself.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The mbadblocks command is used to scan an MS-DOS floppy and mark
its unused bad blocks as bad. It uses the following syntax:
Mbadblocks scans an MS-DOS floppy for bad blocks. All unused bad
blocks are marked as such in the FAT. This is intended to be used right
after mformat. It is not intended to salvage bad disks.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Mbadblocks should (but doesn't yet :-( ) also try to salvage bad
blocks which are in use by reading them repeatedly, and then mark them
bad.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The mcat command is used to copy an entire disk image from or
to the floppy device. It uses the following syntax:
Mcat performs the same task as the unix cat command. It
is included into the mtools package, since cat cannot access
remote floppy devices offered by the mtools floppy daemon.
Now it is possible to create boot floppies remotely.
The default operation is reading. The output is written to stdout.
If the -w option is specified, mcat reads a disk-image from
stdin and writes it to the given device.
Use this carefully! Because of the lowlevel nature of this
command, it will happily destroy any data written before on the
disk without warning!
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The mcd command is used to change the mtools working directory
on the MS-DOS disk. It uses the following syntax:
|
Without arguments, mcd reports the current device and working
directory. Otherwise, mcd changes the current device and current
working directory relative to an MS-DOS filesystem.
The environmental variable MCWD may be used to locate the file
where the device and current working directory information is stored.
The default is `$HOME/.mcwd'. Information in this file is ignored
if the file is more than 6 hours old.
Mcd returns 0 on success or 1 on failure.
Unlike MS-DOS versions of CD, mcd can be used to change to
another device. It may be wise to remove old `.mcwd' files at logout.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The mclasserase command is used to wipe memory cards by
overwriting it three times: first with 0xff, then with
0x00, then with 0xff again. The command uses the following
syntax:
|
Dos drive is optional, if none is specified, use A:. If more than
one drive are specified, all but the last are ignored.
Mclasserase accepts the following command line options:
d
p
Mclasserase returns 0 on success or -1 on failure.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The mcopy command is used to copy MS-DOS files to and from
Unix. It uses the following syntax:
|
Mcopy copies the specified file to the named file, or copies
multiple files to the named directory. The source and target can be
either MS-DOS or Unix files.
The use of a drive letter designation on the MS-DOS files, 'a:' for
example, determines the direction of the transfer. A missing drive
designation implies a Unix file whose path starts in the current
directory. If a source drive letter is specified with no attached file
name (e.g. mcopy a: .), all files are copied from that drive.
If only a single, MS-DOS source parameter is provided (e.g. "mcopy
a:foo.exe"), an implied destination of the current directory
(`.') is assumed.
A filename of `-' means standard input or standard output, depending
on its position on the command line.
Mcopy accepts the following command line options:
t
b
s
p
Q
a
Mcopy translates incoming carriage
return/line feeds to line feeds.
T