Accessing Your Floppy Drive, CD-ROM Drive, and Other Partitions

Last updated: July 18, 1998
Development stage: Beta

The process of "mounting" is a means of accessing other types of filesystems. That means with this, you can use this to read and write to files from media such as floppies, CD-ROMs, and other partitions of your hard drive. Linux uses /dev entries to access this, along with the mount command. To access your floppy drive, type this:

mount /dev/fd0 /mnt/floppy

You'll have to create the directory /mnt/floppy if it doesn't already exist. Linux "attaches" the contents to the mount point, otherwise known as the directory /mnt/floppy/ here. In place of /mnt/floppy you can specify any other empty directory.

The equivalent of typing a: in DOS to get into the floppy's directory is typing cd /mnt/floppy. Since it's now part of your filesystem, you just change directories.

You usually have to be the root user to mount and unmount. According to Kevin Ng it's possible to be a normal user and access devices such as a floppy. He said he modified his /etc/fstab file and added the 'user' option, and to consult the mount(1) manpage (type 'man mount') for details (of course, manpages might be a little hard to understand while you're starting out with Linux, but if you can handle them, by all means read them).

CD-ROM Drive

Mounting your CD-ROM drive depends on how the drive is set up. Some uncommon CD-ROM drives might not be supported by Linux, but let's just say you have a standard drive. You might have to try all of the following:

mount /dev/hdb /mnt/cdrom
mount /dev/hdc /mnt/cdrom
mount /dev/hdd /mnt/cdrom

The hd* entries might go on, but chances are that it's within this range right here. If you're successful, Linux won't spit out an error; if you're not, it'll say no such device or something like that. Just use the cd command to move to the directory you mounted the CD-ROM's contents to (this goes for the floppy drive, too). The subdirectories of the CD will be subdirectories in the mount point directory. (Again, this goes for the floppy drive, too).

Other Partitions on Your Hard Drive

If you have multiple partitions on your hard drive and want to copy files back and forth without rebooting, use the mount command also. You'll have to know which partition your other operating system rests on, and it is hda* in your /dev/ directory. If you have Windows 95 or MS-DOS/Win 3.1 running on your first partition, the entry will be /dev/hda1. So, you have to type this:

mount /dev/hda1 /mnt/hd/

Well, okay. I'm making this look too much like my computer. Here's the basic command:

mount /dev/hda* /mnt/hd

This time, you might have to create a directory in /mnt/ to do that... try mkdir /mnt/hd as root.

Again, /mnt/hd is the mount point/mount directory (that's where you're viewing/reading/writing the floppy or separate partition), and /dev/hda* is the device you are going to access. The * represents which partition you are going to access through the mounting process. The '*' is a whole number, usually from 1 through 4. You might also want to change the part after 'hd' to some other letter if you're going to mount another partition on your hard drive.

Unmounting

Unmounting is pretty easy. Basically, this is what you should do.

umount /mnt/hd/

Scott Northcutt wrote in to say that when using the umount command, you should be in a directory other than where the files are mounted. For example, if you have a CD-ROM mounted on /mnt/cdrom, you should use cd /directory/somewhere/else to get to another directory, and then unmount. If you don't do this, Linux will complain that the device is busy.

You can also use, in place of /mnt/hd, the device that you're trying to unmount, such as /dev/hda2. In the example, /mnt/hd is the directory you mounted to, and you change that with whatever directory you created or used to mount the partition, floppy, or CD.

Suggestions

Basically, you should use mount to access anything from a floppy to a Zip disk. It's the only tool that I know of to easily read and write to other partitions.

The file /etc/fstab includes information on which devices to mount automatically at startup.

Device names:

The first (master) drive on the first Eide interface is /dev/hda
The second (aka slave) drive on the first Eide interface is /dev/hdb
The first (master) drive on the second Eide interface is /dev/hdc
The second (aka slave) drive on the second Eide interface is /dev/hdd

SCSI drives are an altogether different thing. They are /dev/sda and so
on.

From this most people should be able to determine which device names to
use. 

Mounting dos partitions: 

The mount command needs a parameter to access vfat (long file names)

So I mount like this:
       mount -t vfat /dev/hda1 /msdos
Also, mounting CD's should theoretically be:
       mount -t iso9660 /dev/hdd /mnt/cdrom
However, since iso9660 is default, this should not be necessary.
"man mount" is a good way to learn more.

Mans Axel Nilsson

And about that VFAT thing, you have to have VFAT support compiled into your kernel for it to work with Windows 95's long filenames.


Copyright © 1997-1999 Joshua Go (joshuago at users dot sourceforge dot net). All rights reserved. Permission to use, distribute, and copy this document is hereby granted. You may modify this document as long as credit to me is given.