This section describes how to mount a floppy or Zip disk, discusses the /dev directory, and addresses distributing the directory tree over multiple physical devices or partitions.
On a GNU/Linux system there's no necessary correspondence between directories and physical devices as there is in Windows, in which each drive has its own directory tree beginning with a letter (such as C:\).
Instead, each physical device such as a hard disk or floppy disk has one or more filesystems on it. In order to make a filesystem accessible, it's assigned to a particular directory in another filesystem. To avoid circularity, the root filesystem (which contains the root directory /) is not stored within any other filesystem. You have access to it automatically when you boot Debian.
A directory in one filesystem that contains another filesystem is known as a mount point. A mount point is a directory in a first filesystem on one device (such as your hard disk) that ``contains'' a second filesystem, perhaps on another device (such as a floppy disk). To access a filesystem, you must mount it at some mount point.
So, for example, you might mount a CD at the mount point /cdrom. This means that if you look in the directory /cdrom, you'll see the contents of the CD. The /cdrom directory itself is actually on your hard disk. For all practical purposes, the contents of the CD become a part of the root filesystem, and when you type commands and use programs, it doesn't make any difference what the actual physical location of the files is. You could have created a directory on your hard disk called /cdrom and put some files in it, and everything would behave in exactly the same way. Once you mount a filesystem, there's no need to pay any attention to physical devices.
However, before you can mount a filesystem or actually create a filesystem on a disk that doesn't have one yet, it's necessary to refer to the devices themselves. All devices have names, which are located in the /dev directory. If you type ls /dev now, you'll see a pretty lengthy list of every possible device you could have on your Debian system. For a summary of some devices, see Table 2.1 on page . A more thorough list can be found on your system in the file /usr/src/linux/Documentation/devices.txt.
To mount a filesystem, we want to tell Linux to associate whatever filesystem it finds on a particular device with a particular mount point. In the process, we might have to tell Linux what kind of filesystem to look for.
As a simple demonstration, we'll go through mounting a CD-ROM, such as the one you may have used to install Debian. You'll need to be root to do this, so be careful; whenever you're root, you have the power to manipulate the whole system, not just your own files. Also, these commands assume there's a CD in your drive; you should put one in the drive now. Then start with the following command:
The -t option specifies the type of the filesystem, in this case iso9660. Most CDs are iso9660. The next argument is the name of the device to mount, and the final argument is the mount point. There are many other arguments for mount; see the manual page for details.
Once a CD is mounted, you may find that your drive tray will not open. You must unmount the CD before removing it.
The file /etc/fstab (it stands for ``filesystem table'') contains descriptions of filesystems that you mount often. These filesystems can then be mounted with a shorter command, such as mount /cdrom. You can also configure filesystems to mount automatically when the system boots. You'll probably want to mount all of your hard disk filesystems when you boot, so Debian automatically adds entries to fstab to do this for you.
Look at this file now by typing more /etc/fstab. It will have two or more entries that were configured automatically when you installed the system. It probably looks something like this:
#
# <file system> <mount point> <type> <options> #<dump > <pass>
/dev/hda1 / ext2 defaults 0 1
/dev/hda3 none swap sw 0 0
proc /proc proc defaults 0 0
/dev/hda5 /tmp ext2 defaults 0 2
/dev/hda6 /home ext2 defaults 0 2
/dev/hda7 /usr ext2 defaults 0 2
/dev/hdc /cdrom iso9660 ro,noauto 0 0
/dev/fd0 /floppy auto noauto,sync 0 0
The last three columns may require some explanation.
The fifth column is used by the dump utility to decide when to back up the filesystem. In most cases, you can put 0 here.
The sixth column is used by fsck to decide in what order to check filesystems when you boot the system. The root filesystem should have a 1 in this field, filesystems that don't need to be checked (such as the swap partition) should have a 0, and all other filesystems should have a 2. It's worth noting that the swap partition isn't exactly a filesystem in the sense that it does not contain files and directories but is just used by the Linux kernel as secondary memory. However, for historical reasons, the swap partitions are still listed in the same file as the filesystems.
Column four contains one or more options to use when mounting the filesystem. You can check the mount manpage for a summary; see section 5.1 on page .
/dev/sda4 /mnt/dos msdos noauto,user 0 0
If you have SCSI hard disks in your system, you'll have to change sda to sdb or sdc in the example above.