LinuxCommandLibrary

mtools

Access MS-DOS disks and files

SYNOPSIS

mtools-command [options] [arguments]

Examples:
mdir a:
mcopy file.txt a:

PARAMETERS

-v
    Enable verbose output, showing more details about operations.

-V
    Display the version information for the mtools suite.

-D
    Enable debugging output for detailed diagnostic information.

-s
    Use a short command line (often implies a default action).

-S
    Use a long command line (often implies a specific action).

-q
    Operate quietly, suppressing most output messages.

-b
    Batch mode, preventing prompts for user input.

-a
    Ask for confirmation before performing certain actions, like overwriting files.

[utility-specific options]
    Each mtools utility (e.g., mcopy, mdir) has its own specific options that control its behavior, such as file attributes, recursion, or force overwrites. Refer to individual utility man pages for details.

DESCRIPTION

mtools is a collection of utilities that allow Unix and Linux systems to read, write, and manipulate files and directories on MS-DOS formatted disks (like floppy disks, USB sticks, or disk images) without needing to mount the filesystem. This is particularly useful for handling old DOS-era media or for quick access to FAT-formatted partitions without administrative privileges required for mounting. The suite includes commands like mdir (list directories), mcopy (copy files), mdel (delete files), mmove (move/rename files), mformat (format disks), and many others. It provides a convenient way to interact with FAT file systems directly from the command line, mimicking common DOS commands.

CAVEATS

mtools operates at a lower level than standard filesystem utilities, directly interacting with FAT structures. It does not perform full filesystem consistency checks by default, which can potentially lead to data corruption if the disk is not healthy or if operations are interrupted. It relies on a configuration file (~/.mtools.conf or /etc/mtools.conf) to define drive mappings (e.g., 'a:', 'b:') and other settings. Permissions on the underlying device file (e.g., /dev/fd0, /dev/sdb1) are crucial; the user must have read/write access to the device.

CONFIGURATION

mtools commands rely on a configuration file, typically /etc/mtools.conf or ~/.mtools.conf, to define drive letters (e.g., a:, b:) and their corresponding physical devices or partition images. This file also allows setting default options and behaviors for the utilities. Without proper configuration, mtools might not be able to locate the target MS-DOS filesystem.

DEVICE ACCESS

For mtools to function, the user running the command must have appropriate read and write permissions to the underlying block device (e.g., /dev/sdb1 for a USB drive partition). This often means the user must be part of a group like 'disk' or 'floppy', or the device permissions must be relaxed, which can be a security consideration.

HISTORY

The mtools suite originated in the early days of Linux and Unix, serving as a critical bridge between these operating systems and the prevalent MS-DOS world. Developed by Alain Knaff, its primary purpose was to facilitate easy file exchange with DOS-formatted floppy disks without the complexities of mounting. While its use for floppy disks has diminished, it remains valuable for interacting with FAT32-formatted USB drives, SD cards, and disk images, especially in scenarios where traditional mounting is inconvenient or restricted.

SEE ALSO

mount(8), umount(8), mkfs.msdos(8), fsck.msdos(8), dd(1)

Copied to clipboard