mtools - Linux


Mtools is a collection of utilities to access MS-DOS disks from Unix without mounting them. It is most effective for managing disk images for DOS and Windows environments in a Linux setting. These tools facilitate copying, renaming, reading, and writing files from/to FAT filesystem disks.


mtools itself is not a single command but a suite of commands. Here, we focus on general usage patterns for some of the common mtools:

  • mcopy (copy files):
    mcopy [options] source target
  • mdir (list directory contents):
    mdir [options] [msdosdirectory]
  • mformat (format disk):
    mformat [options] drive:

Each tool has its own set of options and arguments, often similar to their traditional DOS counterparts.


Options vary between the different tools in the mtools suite. Here are options for a few frequently used tools:

  • mcopy:
    • -v: Verbose mode, provides detailed output.
    • -n: No overwrite, do not overwrite existing files.
  • mdir:
    • -/: Recursive list, includes subdirectory contents.
    • -w: Wide list format, lists filenames as wide as the terminal window.
  • mformat:
    • -c: Specify the number of sectors per track.
    • -t: Number of tracks per side.

Common options across many mtools commands:

  • -V: Display version information.


  • Copying a file from a DOS disk in drive A to the Linux system:
    mcopy a:file.txt ~/documents/
  • Listing the contents of a DOS disk:
    mdir b:
  • Formatting a floppy disk:
    mformat a:

Common Issues

  • Issue: Access denied errors.
    • Solution: Run mtools with appropriate permissions, or adjust the device permissions.
  • Issue: Confusion about drive letters.
    • Solution: Remember that mtools uses drive letters similar to DOS (a:, b:, etc.).


mtools can be combined with shell scripts to automate managing DOS files or images. Here’s an example script to copy all .txt files from a floppy disk:

for file in $(mdir b: | grep '.txt' | awk '{print $1}'); do
    mcopy "b:$file" ~/text_files/

This script lists .txt files on drive B (assumed to be a floppy drive) and copies each to a directory on the Linux system.

  • fdisk: for disk partitioning.
  • dd: for low-level disk manipulation.

Additional Resources

For more detailed information, the man pages of the individual mtools (such as man mcopy, man mdir, man mformat, etc.) are invaluable sources of in-depth usage patterns and options. The official Mtools website and repositories often provide the latest updates and documentation.