Chapter 13. Diskettes and CD-ROMs

Using removable media with Red Hat Enterprise Linux requires some explanation. This chapter discusses how to read and write files to and from diskettes, CD-ROMs, and USB Flash Drives.

13.1. Using Diskettes

Diskettes are one of the oldest removable media solutions available for the personal computer (PC). Diskettes are ideal as a portable storage solution for small files that need to be physically moved around. For example, if two PCs are not on the same network, diskettes are a great solution to transfer files from one computer to the other. Diskettes degrade with time, and should not be used for long term storage.

13.1.1. Mounting and Unmounting a Diskette

Diskettes must be mounted before use and unmounted before they are ejected from the drive. To mount a diskette means to attach it to your current file system. Strictly speaking, Red Hat Enterprise Linux attaches the contents of the diskette to your computer's file system under the directory /media/floppy/. Diskettes may be mounted manually from a shell prompt. Nautilus also has the ability to auto-mount diskettes.

To manually mount a diskette:

  1. Insert the diskette in the diskette drive.

  2. At a shell prompt, enter the command mount /media/floppy/.

  3. The diskette drive activity light should blink as it is mounted to /media/floppy/.

  4. You can access the contents of the diskette by browsing to that directory from a shell prompt or through a file browser like Nautilus.

To mount a diskette with Nautilus:

  1. Inser the diskette into the drive.

  2. Double-click on the Computer icon on your desktop.The Computer window opens.

  3. Double-click the Floppy icon. Nautilus automatically mounts the diskette and opens a window with the diskette's contents.

  4. At the same time, a diskette icon appears on the desktop. Double-click this icon at any time to open a window with the diskette's contents. Files dragged onto the icon are copied to the diskette.

To unmount a disk manually:

  1. Open a terminal window.

  2. At the shell prompt, enter the command umount /media/floppy/.

To unmount a diskette with Nautilus:

  1. Right-click on the diskette icon on the desktop.

  2. Select Unmount Volume from the menu.

Once the diskette has been unmounted, you can safely eject it from the drive.

NoteNote
 

If you do not unmount a diskette before ejecting it, the files you meant to transfer to it will not actually be written on the diskette. You may also be unable to mount a new diskette, or the old data may be written over the new diskette. Be certain to unmount your diskettes before removing them.

13.1.2. Putting Linux Files on an MS-DOS Diskette

To copy files from a Red Hat Enterprise Linux system to an MS-DOS formatted diskette so that a Windows machine can read it, be certain that the diskette is formatted with an MS-DOS (FAT) file system. Diskettes that are pre-formatted by the manufacturer are generally formatted with a FAT file system. You can also format the diskette with the Windows OS or with gfloppy. Refer to Section 13.1.3 Formatting a Diskette for more detail on formatting.

Files may be copied to and deleted from the diskette with the same shell prompt commands or actions in Nautilus as described in Section 4.5 Manipulating Files in Your Current Working Directory. You can then unmount the diskette and eject it from the drive. The files on the diskette should now be accessible from the Windows machine.

13.1.3. Formatting a Diskette

The native file system for exclusively Red Hat Enterprise Linux diskettes is ext2. Once you have created an ext2 file system on your diskette, you can manipulate its contents the same ways that you manipulate directories and files on your hard drive.

WarningWarning
 

Formatting a diskette will permanently erase all of its contents. Be sure to backup any files that you need before performing any of the following operations on your diskettes.

13.1.3.1. Formatting with gfloppy

To start gfloppy, choose Applications => System Tools => Floppy Formatter. From a shell prompt, type /usr/bin/gfloppy. gfloppy will not format a diskette that is mounted to your file system. Make certain that the diskette icon is not visible on your desktop before proceeding. If the diskette is mounted, right-click on the icon and choose Unmount Volume before proceeding.

As shown in Figure 13-1, the gfloppy interface is small and has few options. The default settings are sufficient for most users and needs; however, you can format your diskette with an MS-DOS file system type if necessary. You can also choose the density of your diskette (if you are not using the usual high density 3.5" 1.44MB diskette). You can also elect to quick format the diskette if it was previously formatted as ext2.

Figure 13-1. gfloppy

Change the settings in gfloppy to suit your needs; then click Format. A status box appears on top of the main window, showing you the status of formatting and verification. Once complete, close gfloppy and either eject or mount and use the diskette.

13.1.3.2. Using mke2fs

The mke2fs command is used to create a Linux ext2 file system on a device such as a hard drive partition or (in this case) a diskette. mke2fs essentially formats the device and creates an empty, Linux-compatible device which can then be used for storing files and data.

Insert 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. If your computer has more than one diskette drive, your primary diskette drive is /dev/fd0, your second /dev/fd1, and so on.

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

Once you have created an ext2 file system on the diskette, it is ready to be used with your Red Hat Enterprise Linux system.