Yolinux.com Tutorial

Using DOS Floppies with Linux

This tutorial covers the use of DOS formatted floppies with Linux. Typically a formatted floppy diskette with a filesystem requires the diskette to be mounted before use. The following commands do not require mounting of the filesystem. It is a prerequisite however that the floppy have a DOS filesystem formatted on the diskette if it is to read from or written to.

Related YoLinux Tutorials:

°Unix for DOS users

°Boot and Recovery Disk

°Integrate Linux into MS/Windows environment

°Run MS/Windows programs on Linux

°YoLinux Tutorials Index




Free Information Technology Magazines and Document Downloads
TradePub link image


Linux commands for using DOS floppies:

mdir a: Directory listing of floppy
mdir -a a: Directory listing including hidden files
mcopy a:dos_file   unix_file Copy file from floppy.
The inverse is also true
mcopy -t file1 file2 Handle ^M translation on text files.
mcopy -/ a: ./ Copy recursively through lower directories.
mdel a:dos_file Delete file from floppy
mdu List amount of remaining space on floppy.
fdformat /dev/fd0H1440
mformat a:
Format a floppy for DOS/FAT16 (2 steps)
mlabel a:label_name Floppy label (11 char max)
mren a:file1 a:file2 Rename file on floppy.
mmd Create directory on floppy
mrd Rename DOS directory.
mcd Change default directory on floppy.

The DOS floppy diskette utilities are included in the Red Hat mtools RPM.
The fdformat command is part of the util-linux RPM package.


Floppy device description:

/dev/fd 0 - - First Floppy Drive A:\
- 1 - - Second Floppy Drive B:\
- - d - Low density 5.25 in
- - D - Low density 3.5 in
- - h - High density 5.25 in
- - H - High density 3.5 in
- - - 360
720
1200
Capacities for 5.25 in
- - - 360
720
1440
Capacities for 3.5 in

Example: /dev/fd0H1440
Floppy Device drive A, high density 3.5 inch, 1.4Mb capacity.


Format Floppy GUI Tools:

GUI format tools: DOS or native ext2 file formats.

Gnome: gfloppy

Package:
  • RH RPM: gnome-utils

Gfloppy gives you the option to specify the device directly:
/usr/bin/gfloppy --device=/dev/fd0H1440
Default is /dev/fd0

KDE: kfloppy

Package:
  • RH RPM: kdeutils


Advanced Floppy Diskette System Configuration:

The pre-defined floppy configurations are specified in floppy disk parameter table in /etc/fdprm. If referring to the floppy as /dev/fd0H1440, the user has already determined the floppy density and can thus reference the device explicitly. When using the Linux device reference /dev/fd0, /dev/fd1, etc, auto-floppy device detection will determine the floppy density. Auto-detecting floppy devices (/dev/fd0, etc) can be configured with the setfdprm command.

Checking a floppy for bad blocks: /sbin/badblocks /dev/fd0H1440 1440
This will list the block numbers for all the bad blocks on the floppy.

One can also mount a floppy:

  • Red Hat 6 to 9: mount -t msdos /dev/fd0 /mnt/floppy
  • Fedora Core 3: mount -t msdos /dev/fd0 /media/floppy

Remember to umount /mnt/floppy when done. (or for fedora Core 3: /media/floppy)

The DOS floppy utilities (mtools) do not mount the floppy in the traditional manner but give DOS like access.

Repair bad blocks so that the blocks can be ignored and floppy can be used.

   /sbin/dosfsck -at /dev/fd0H1440

Man pages:

  • mkdosfs - Create an MS-DOS file system under Linux
  • dosfsck - Check and repair MS-DOS file systems
  • setfdprm - Sets user-provided floppy disk parameters
  • badblocks - Search a device for bad blocks
  • mbadblocks - Tests a floppy disk, and marks the bad blocks in the FAT


Native Linux EXT2 formatted Floppies:

EXT2 formatted disks:

fdformat /dev/fd0H1440
/sbin/mkfs -t ext2 -c /dev/fd0H1440
OR if badblocks:
/sbin/badblocks /dev/fd0H1440 1440 > list-of-bad-blocks.txt
/sbin/mkfs -t ext2 -l list-of-bad-blocks.txt /dev/fd0H1440
Once a floppy has been formatted and the file system is in place:
mount -t ext2 /dev/fd0 /mnt/floppy
(or for fedora Core 3: /media/floppy)

Man pages:

  • tune2fs - verification based on number of times filesystem is mounted.
  • debugfs (warning: It can help recover data or destroy any chance of recovering data!
   

    Bookmark and Share


Advertisements




Copyright © 2000, 2004, 2005 by Greg Ippolito