DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Working with files and directories

Mounting a filesystem

In addition to containing loose files, a storage medium may be used to store a whole filesystem, with its own root directory and subdirectories. A filesystem stored in this way can be mounted onto the main filesystem using the mnt(C) command.

Once a filesystem has been mounted on another filesystem, its root directory appears as a subdirectory of the parent filesystem. You can enter the mounted filesystem by using cd, and it looks just like another subdirectory hierarchy, even though it resides on another physical device.

Mounting a filesystem

To mount a CD-ROM filesystem, for example, you must first place the disk in a CD-ROM drive installed on your computer, then use the mnt command. For example:

   $ mnt /mnt
The /mnt directory is a mount point; when a device is mounted on it that device's root directory appears in the filesystem instead of /mnt. Any files that existed in /mnt before the new filesystem was mounted on it are obscured, although they will be accessible again when the filesystem is unmounted.

Once the CD-ROM is mounted, it appears on the system as a tree of subdirectories, with the root directory of the CD-ROM located in the mount directory /mnt.

The mnt command reads a file called /etc/default/filesys (see filesys(F)), which contains a list of mountable filesystems. This file also specifies the name of the device associated with the filesystem (the bdev keyword) and the absolute pathname of the filesystem's mount point within the parent filesystem (the mountdir keyword).

Your system administrator must have added an entry to this file before you can use mnt to mount a CD-ROM. You can examine the contents of /etc/default/filesys with the mnt -t option, as follows:

   $ mnt -t
   Mount Directory:                 /apps
   Block Device:                    /dev/apps
   Character Device:                /dev/rapps
   Password required:               No
   Mount if requested:              No
   Fsck if requested:               Only if filesystem is dirty
      Fsck flags:                   -y
   Mount at system startup:         Yes
   Fsck at system startup:          Only if filesystem is dirty
      Fsck options:                 -y
   Run command before mounting:     No
   Run command after mounting:      No
   

Mount Directory: /private Block Device: /dev/private Character Device: /dev/rprivate Password required: No Mount if requested: Yes Fsck if requested: Only if filesystem is dirty Fsck flags: -y Mount at system startup: Yes Fsck at system startup: Only if filesystem is dirty Fsck options: -y Run command before mounting: No Run command after mounting: No

Otherwise, use cat(C) to show the contents of /etc/default/filesys, as follows:
   $ cat /etc/default/filesys
   .
   .
   .
   bdev=/dev/apps cdev=/dev/rapps \
           mountdir=/apps rcmount=yes \
           mount=no fsckflags=-y
   bdev=/dev/private cdev=/dev/rprivate \
   

mountdir=/private rcmount=yes \ mount=yes fsckflags=-y

For a filesystem to be mountable by a user other than the root user, its /etc/default/filesys entry must contain the command mount=yes. In the example, the filesystem /dev/private is mountable by users while /dev/apps is not.

To unmount a filesystem, use either the umnt(C) command, as follows, or the mnt -u option.

   $ umnt /mnt
You can also mount a DOS filesystem, allowing the use of DOS files without first copying them into the UNIX filesystem. For details, see ``Using mounted DOS filesystems''.

Next topic: Managing files
Previous topic: Navigating symbolic links

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003