Using a Diskette

Q: Working with Diskettes

How do I use a diskette with Red Hat Linux?

A. Using Mtools

If you've got an MS-DOS formatted diskette, you can access the files by 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, open an Xterm window and type man mtools at the 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 the prompt in an Xterm window:

mcopy a:thisfile.txt thisfile.txt
	  

The file will then be copied from the diskette drive (drive A:) to the directory you're currently in when you issue the mcopy command. If you're in your /home directory, then, 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
	  

(The above command assumes subdir is the name of the subdirectory you want to access.)

If you have a diskette which you want to format and use with your Red Hat Linux system, use the ext2 filesystem. For more on this, 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 formatted diskette into the drive and issue the following command at a shell in an Xterm window:

$ /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.