Chapter 17. Working with MS-DOS files

Use the mtools programs to work with ms-dos based files, execute mtools for a full listing of available m* tools. There are a lot of files within the mtools package for working with ms-dos disks, also try the info documentation of mtools for more details.

The use of slashes: Note that with mtools commands you can use the slashes on the a: part either way (ie. backslash (windows-style) or forward slash (UNIX system style)).

mformat

Formats an unmounted disk as an ms-dos floppy disk. Usage is similar to the ms-dos format utility, to format the first floppy disk you can type:

mformat a:
mcopy

Copies files from an ms-dos disk when it's not mounted. Similar to the ms-dos copy command except it's more advanced.

Command syntax:

mcopy a:/file_or_files /destination/directory
mmount

Mount an ms-dos disk, without using the normal UNIX system mount.

For example:

mmount a: /mnt/floppy

This will mount the floppy under /mnt/floppy (this option may or may not be necessary, it depends on your /etc/fstab setup).

mbadblocks

Scans an ms-dos (fat formatted disk) for bad blocks, it marks any unused bad blocks as “bad” so they won't be used.

Example:

mbadblocks a:
dosfsck

This program is used to check and repair ms-dos based filesystems. Use the -a option to automatically repair the filesystem (ie don't ask the user questions), the -t option to mark un-readable clusters as bad and the -v option to be more verbose (print more information).

Example:

dosfsck -at /dev/fd0

This would check your floppy disk for any errors (and bad sectors) and repair them automatically.