Книга: Fedora™ Unleashed, 2008 edition

The mount Command

The mount Command

File systems are mounted with the mount command and unmounted, curiously enough, with the umount command.

During the installation, you have the opportunity to decide where and how your partitions will be mounted. You indicate your choices, and Fedora automatically stores them in /etc/fstab, the file system table, for you. The mount command looks at /etc/fstab and mounts the file system according to those set preferences. You learn more about the file system table later in this section.

The syntax for mount is:

mount -t type file system_to_be mounted mount_point

Here are the components of the mount command, and a brief explanation of each:

type — Always preceded by the -t argument and followed by a space, and then the type of file system you are mounting. Typical file system types are ext2, ext3, vfat, iso9660, hpfs, hfs, ntfs, and others. For many file systems, mount can detect what type they are automatically, and the -t argument is superfluous (and is replaced with auto).

file system_to_be mounted (as represented by the partition on which it resides) — This is the device name of the file system you want to mount, typically in the form of /dev/hdx, /dev/scx, or /dev/fdx.

mount_point — The place in the directory tree where you want to mount the file system. Curiously, you can mount a file system over part of an existing file system. For example, if you have an existing directory at /foo with a single file named bar, and you mount a file system at /foo that includes a file named snafu, a listing of the directory /foo does not show the file bar, but only the file snafu. To show both files is a feature called transparency, which unfortunately is not in the current Linux repertoire.

The only real restriction to "mount anything anywhere" is that the critical system files in /bin, /etc, /lib, /dev, /proc, and /tmp need to be accessed at bootup, which typically means that they need to be on the same physical disk. If they cannot be accessed at bootup, Linux does not load and run.

Here are a few examples of using the mount command:

Mounting a floppy:

# mount -t vfat /dev/fd0 /mnt/floppy

Mounting a CD-ROM:

# mount -t iso9660 /dev/scd0 /mnt/cdrom

Mounting a Network File System (NFS) volume:

# mount -t nfs remote_host:/dir [options] mount_point

Numerous mount options exist. These options are used primarily in the /etc/fstab file. You can invoke a mount option by preceding it (or a comma-delimited string of options) with the -o switch. The mount options are listed in the fstab section of this chapter.

Оглавление книги

Оглавление статьи/книги

Генерация: 0.592. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз