mtools - utilities to access DOS disks in Unix.


SUBMITTED BY: Guest

DATE: June 4, 2014, 6:14 a.m.

FORMAT: Text only

SIZE: 9.8 kB

HITS: 4832

  1. Name
  2. mtools - utilities to access DOS disks in Unix.
  3. Introduction
  4. Mtools is a public domain collection of tools to allow Unix systems to manipulate MS-DOS files: read, write, and move around files on an MS-DOS filesystem (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.
  5. 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 Infinity/etc/mtools.confIntegral works on your machine). With mtools, one can change floppies too without unmounting and mounting.
  6. Where to get mtools
  7. Mtools can be found at the following places (and their mirrors):
  8. http://mtools.linux.lu/mtools-3.9.9.tar.gz
  9. ftp://www.tux.org/pub/knaff/mtools/mtools-3.9.9.tar.gz
  10. ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-3.9.9.tar.gz
  11. Before reporting a bug, make sure that it has not yet been fixed in the Alpha patches which can be found at:
  12. http://mtools.linux.lu/
  13. ftp://www.tux.org/pub/knaff/mtools
  14. 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.
  15. 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
  16. Common features of all mtools commands
  17. Options and filenames
  18. 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 '/' 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.
  19. 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.
  20. All options use the - (minus) as their first character, not / as you'd expect in MS-DOS.
  21. Most mtools commands allow multiple filename parameters, which doesn't follow MS-DOS conventions, but which is more user-friendly.
  22. Most mtools commands allow options that instruct them how to handle file name clashes. See section 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 Commands, for a description of the options which are specific to each command.
  23. Drive letters
  24. 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 Configuration).
  25. 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.
  26. Example:
  27. mcopy -i my-image-file.bin ::file1 ::file2 .
  28. This copies file1 and file2 from the image file (my-image-file.bin) to the /tmp directory.
  29. Current working directory
  30. The mcd command (InfinitymcdIntegral) 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.
  31. VFAT-style long file names
  32. 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.
  33. The following table shows some examples of short names:
  34. Long name MS-DOS name Reason for the change
  35. --------- ---------- ---------------------
  36. thisisatest THISIS~1 filename too long
  37. alain.knaff ALAIN~1.KNA extension too long
  38. prn.txt PRN~1.TXT PRN is a device name
  39. .abc ABC~1 null filename
  40. hot+cold HOT_CO~1 illegal character
  41. As you see, the following transformations happen to derive a short name:
  42. *
  43. Illegal characters are replaced by underscores. The illegal characters are ;+=[]',\"*\\<>/?:|.
  44. *
  45. Extra dots, which cannot be interpreted as a main name/extension separator are removed
  46. *
  47. A ~n number is generated,
  48. *
  49. The name is shortened so as to fit in the 8+3 limitation
  50. 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.
  51. Example:
  52. mcopy /etc/motd a:Reallylongname
  53. 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.
  54. mcopy /etc/motd a:motd
  55. 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.
  56. In a nutshell: The primary name is the long name, if one exists, or the short name if there is no long name.
  57. 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.
  58. Unix name Long name Reason for the change
  59. --------- ---------- ---------------------
  60. prn prn-1 PRN is a device name
  61. ab:c ab_c-1 illegal character
  62. As you see, the following transformations happen if a long name is illegal:
  63. *
  64. Illegal characters are replaces by underscores,
  65. *
  66. A -n number is generated,
  67. Name clashes
  68. 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:
  69. overwrite
  70. Overwrites the existing file. It is not possible to overwrite a directory with a file.
  71. rename
  72. Renames the newly created file. Mtools prompts for the new filename
  73. autorename
  74. Renames the newly created file. Mtools chooses a name by itself, without prompting
  75. skip
  76. Gives up on this file, and moves on to the next (if any)
  77. 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.
  78. You may also chose actions (for all files) on the command line, when invoking mtools:
  79. -D o
  80. Overwrites primary names by default.
  81. -D O
  82. Overwrites secondary names by default.
  83. -D r
  84. Renames primary name by default.
  85. -D R
  86. Renames secondary name by default.
  87. -D a
  88. Autorenames primary name by default.
  89. -D A
  90. Autorenames secondary name by default.
  91. -D s
  92. Skip primary name by default.
  93. -D S
  94. Skip secondary name by default.
  95. -D m
  96. Ask user what to do with primary name.
  97. -D M
  98. Ask user what to do with secondary name.
  99. 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.
  100. 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.
  101. By default, the user is prompted if the primary name clashes, and the secondary name is autorenamed.
  102. If a name clash occurs in a Unix directory, mtools only asks whether to overwrite the file, or to skip it.

comments powered by Disqus