Mounting and Unmounting CD-ROM and Floppy-Based Filesystems


Now that you've had some experience mounting different foreign filesystems, it should be a snap moving on to CD-ROMs and floppy drives. CD-ROMs usually are mounted as CD9660 filesystems, but floppies generally are either FFS (the FreeBSD standard) or MSDOS.

Mounting CDs and Floppies

For CD-ROMs, the main trick is to determine the device name. IDE drives will be of the form /dev/acd0c, SCSI drives will be of the form /dev/cd0c, and miscellaneous types of nonstandard drives have other prefixes. As for the suffix, use c to indicate that you are addressing the entire disk in "dedicated" mode. Here's an example:

# mount_cd9660 /dev/acd0c /cdrom


Tip

See http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-naming.html for the current reference to disk names.


Mounting CD-ROMs in a GUI Environment

One drawback of the UNIX system architecture is that you need to be the root user to mount CD-ROMs. This usually isn't a problem if you're using the command line at the physical console; but if your FreeBSD machine is a desktop workstation, especially if it has multiple users, your KDE or GNOME login will be using a regular user account, not the root account. This is an important security consideration, as it mitigates the risk of potentially destructive system operations being executed as root; but it also means mounting CD-ROMs is a lot more difficult. The procedure for enabling regular users to mount CD-ROMs in KDE involves tweaking a lot of permission settings on your user accounts and on your CD-ROM drive device, enabling a kernel permissions adjustment, and even adding user-level mount points and corresponding entries to /etc/fstab. The full procedure is outlined at http://www.bsdguides.org/guides/freebsd/beginners/kde_cd_icons.php; note, though, that even with this configuration in place, only one user at a time can have the CD-ROM drive mounted, and another user won't be able to access it until the user who mounted it unmounts it.

After you have your system's permissions set up properly, mounting CD-ROMs in KDE or GNOME is quite seamless. Just navigate to the system's drives in a filesystem window and click or double-click the CD-ROM drive icon. The desktop environment automatically mounts the disc in the background and launches a navigation window to let you browse its contents.


Mounting a floppy disk is fairly straightforward. Use the device name /dev/fd0 (the zero specifies your first floppy drive). The kernel also contains a confusing entry for fdc0, which refers to the actual ISA floppy disk controller device, but fd0 and fd1 are the device names for the drives that hang off the controller. Here's how to mount a UNIX floppy disk:

# mount /dev/fd0 /floppy


An MS-DOS floppy can be mounted in a similar fashion:

# mount_msdosfs /dev/fd0 /floppy


Be careful: Floppy disks can be write protected and CD-ROMs are physically read-only, but FreeBSD does not check at mount time whether they are writable! If you mount a write-protected floppy without specifying the -r or rdonly option, you will get I/O errors whenever anything tries to write to the diskand what happens as a result can vary with the stability of whatever program is doing the writing. Anything from a simple console error message to a complete hang of the system can occur. Therefore, if you must mount a write-protected floppy or CD-ROM from the command line, make sure you specify the -r or rdonly option to prevent programs from even trying to write to it!

Unmounting CDs and Floppies

The other tricky thing about CD-ROMs and floppies is that because they are removable devices, there exists the potential to remove the disk while the system still thinks it is mounted. Windows (for comparison's sake) dynamically mounts and refreshes the devices whenever they are accessed for reading or writing, and Mac OS X keeps track of such things by having disk mounting and physical insertion/ejection controlled entirely by software, making the user's actions interdependent with the software's state. FreeBSD (and other x86 UNIXes) do not have the latter luxury or the former sophistication, so you must shoulder the burden of making sure the system's impression of its mounted disks is an accurate one.

Most CD-ROM drives lock their trays when the operating system has a disk mounted because they have soft-eject mechanisms that are aware of the media's state in the operating system. Such a drive will not respond when you press the Eject button until you have unmounted the device. Floppies, however, can be mechanically ejected on a whim, and even CD-ROMs can be ejected through determination and the use of a paper clip. If a mounted device is ejected without being properly unmounted, and some program tries to read from or write to the device, the same kind of system destabilization can occur as described previously.

The bottom line is this: Always remember to use umount /cdrom or umount /floppy before ejecting a disk. Your system will thank you.

Other Removable Media

The field of removable media is becoming more complex every day, with USB and FireWire-based external media and rewritable CD and DVD drives coming into the market at an ever-increasing pace. Zip drives and their relatives have been around for some time, and though they're beginning to disappear from the market, you might still have a use for them. FreeBSD supports parallel port Zip drives as the vp0 device and USB Zip drives as the umass device. But dozens of new devices are in development, and each will offer its own complications in writability, removability, and mountability. Your understanding of mounting and unmounting CD-ROMS and floppies, however, can help prepare you for dealing with other removable media devices in FreeBSD.




FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net