Chapter 13. Frequently Asked Questions

Using a Diskette

Q: Working with Diskettes

How do I use a diskette with Red Hat Linux?

A. Using Mtools

If you have an MS-DOS formatted diskette, you can access the files on it using the mtools utility.

Mtools offers a wide range of options for working with diskettes, including copying, moving, deleting, and formatting. To read more about mtools, type man mtools at a shell prompt.

For example, to copy a file from an MS-DOS formatted diskette (such as one from a Windows95 system), use the following syntax at a shell prompt:

mcopy a:thisfile.txt 

The file will then be copied from the diskette drive (drive A:) to the directory you were in when you issued the mcopy command. If you're in your /home directory, you'll find thisfile.txt there.

If you want to view the contents of an MS-DOS formatted diskette, type mdir at the prompt. By default, you'll be shown the contents of the diskette in the A: drive.

To change to a subdirectory on the diskette, type

mcd a:subdir

In the above command, subdir is the name of the subdirectory you want to access.

If you have a diskette that you want to format and use with your Red Hat Linux system, use the ext2 filesystem. For more on ext2, read on…

A: The ext2 Filesystem

To use a diskette specifically with Red Hat Linux, you'll need to create a Second Extended (ext2) filesystem on the disk. The ext2 filesystem is the filesystem used by Red Hat Linux, and is the most commonly used Linux filesystem type.

Once you've created an ext2 filesystem on the diskette, you can manipulate its contents in the same ways that you manipulate directories and files on your hard drive.

Creating an ext2 Filesystem on a Diskette

The mke2fs command is used to create a Linux ext2 filesystem on a device, which may be a disk partition or a diskette. Put your diskette into the drive and issue the following command at a shell prompt:

$ /sbin/mke2fs /dev/fd0

On Linux systems, /dev/fd0 refers to the first diskette drive, usually your A: drive.

The mke2fs utility has a number of options. The -c option makes the mke2fs command check the device for bad blocks before creating the filesystem. The other options are covered in the mke2fs man page.

Once you've created an ext2 filesystem on the diskette, it is ready to be used with your Red Hat Linux system.

TipIf You're Using a GUI

Want another quick way to format a floppy for either ext2 or MS-DOS? If you are using KDE, try KDE Floppy Formatter, an easy way to format diskettes. To start the utility, go to Main Menu K => Utilities => KFloppy. In GNOME, go to Main Menu => Programs => Utilities => gfloppy to start the gfloppy.