mount
PURPOSE
Makes a file system available for use.
SYNOPSIS
Without Superuser Authority
mount [ [-rs] [directory] ]
With Superuser Authority
mount [ [-rs] [device] [directory] ]
DESCRIPTION
The mount command instructs the operating system to make
a file system available for use. In addition, you can
use mount to build other file trees made up of directory
and file mounts. In the case of file system mounts, the
mount command mounts the specified device on the speci-
fied directory and records its availability in
/etc/mnttab. After mount has finished, directory becomes
the root of the newly mounted file system. Unless you
specify the -s flag, device and directory names are
restricted to strings of 100 characters or less.
Any user can issue a mount directory1 directory2 or mount
file1 file2 command if that user has search permission to
the directory or file to be mounted (directory1 or file1)
and search or write permission to the directory or file
to be mounted over (directory2 or file2). Members of the
system group can do any mount that a user can do plus any
mount described in the /etc/filesystems file (mount
directory). Users operating as superuser can issue any
mount command.
If you enter the mount command without flags, it writes
to standard output the mounted file systems (except those
mounted with the -s flag), their location, and whether
they are read-only. The environment variables NLLDATE
and NLTIME control the appearance of the modification
date and time.
If you specify only a directory name, mount takes it to
be the name of the directory or file on which a file
system, directory, or file is usually mounted (as defined
in the /etc/filesystems file). mount looks up the asso-
ciated device, directory, or file and mounts it. This is
the most convenient way of using the mount command, as it
does not require you to remember what is normally mounted
on a directory or file.
The /etc/filesystems file should include a stanza for
each mountable file system, directory, or file. This
stanza should specify at least the name of the file
system and either the device on which it resides or the
directory name. If the stanza includes a mount
attribute, the mount command uses the associated values.
It recognizes five values in the mount attribute: true,
false, removable, inherit and read-only (see the
filesystems file in AIX Operating System Technical Refer-
ence for a description of these mount attributes.) The
command mount all causes all file systems with the attri-
bute mount=true to be mounted in their normal places.
This command is typically used during system initializa-
tion.
If you are operating with superuser authority, you can
mount a file system arbitrarily by naming both a device
and a directory on the command line. mount takes device
to be the name of the block device special file and
directory to be the directory on which it should mount
the file system.
The mount and umount programs maintain the mount table in
/etc/mnttab as accurately as possible. However, some
events can invalidate this mount table. (The system
itself has an internal mount table that it maintains
independently.) Several programs and library routines
use /etc/mnttab to determine the fully qualified name of
the current directory. If /etc/mnttab does not properly
reflect the state of all mounted file systems, these pro-
grams may stop working.
Using the -s flag, deleting /etc/mnttab, or truncating it
after file systems have been mounted will almost surely
invalidate its contents. When the system is restarted
after a crash, an old (possibly invalid) /etc/mnttab may
still be present. If you suspect that your /etc/mnttab
is invalid, you can use mount to check it and clean it up
as follows:
1. Run a simple mount without any arguments to weed out
any entries that describe file systems that are not
actually mounted.
2. Enter mount all to remount all of the usual file
systems. While mount cannot remount file systems
that are already mounted, it notices that file
systems are not listed as mounted and adds the appro-
priate entries to /etc/mnttab.
FLAGS
-i Requests an inherited mount. (For informa-
tion on inherited mounts, see Managing the
AIX Operating System.)
-n node Specifies the node that holds the directory
to be mounted. If you specify this option
without specifying the directory to be
mounted, mount displays a list of all
mounts issued at node.
-p Mounts a file system as a removable file
system. While there are open files, a
removably mounted file system behaves the
same as a normally mounted file system.
However, when there are not open files (and
no process has a current directory on the
file system), all of the file system's disk
buffers are written to the medium, and the
operating system "forgets" the structure of
the file system. This allows you to remove
and reinsert media such as diskettes
without issuing a mount or umount command
each time. Use this flag only for diskette
mounts.
-r Mounts a file system as a read-only file
system, regardless of the specification in
/etc/filesystems.
-s Does not record the availability of the new
file system in /etc/mnttab. This allows a
file systems to be mounted on a read-only
root where /etc/mnttab would not be writ-
able. As several programs and library rou-
tines depend on /etc/mnttab, use this flag
with caution.
-t type Mounts all stanzas in /etc/filesystems that
contain type = type and are not mounted.
(type is a string value, such as "remote".)
EXAMPLES
1. To list the file systems that are mounted:
mount
nodename mounted mounted over access date
----------- ------------- --------------- ------- ------------
nick /dev/hd0 / r/w Dec 17 08:04
nick /dev/hd6 /vrm ro Dec 17 08:05
nick /dev/hd1 /u r/w Dec 17 08:06
nick /dev/hd2 /usr r/w Dec 17 08:06
nick /dev/hd3 /tmp r/w Dec 17 08:06
darlene /dev/hd2 /usr r/w Dec 17 10:44
For each file system, mount lists the node name, the
device name, the name under which it is mounted, the
access permitted (read only or read/write), and the
date and time it was mounted.
2. To mount a diskette:
mount /dev/fd0 /diskette0
This mounts a diskette ("/dev/fd0") onto the direc-
tory "/diskette0". A file system must already exist
on the diskette, and the directory "/diskette0" must
already exist. To access a file on the diskette, use
a path name that begins with "/diskette0". For
example, to access "prog.c" use "/diskette0/prog.c".
Warning: Be sure that the current directory is not
still on the diskette when you remove it from the
drive, or you may lose some of your data.
3. To mount a write-protected diskette:
mount -r /dev/fd0 /diskette0
This mounts the diskette on /diskette0 as a read-
only, file system. This tells the operating system
not to update file access times, which would cause
errors with a write-protected diskette.
4. To mount a default file system:
mount /diskette0
This mounts the device that is usually mounted on
/diskette0, which is determined by information in the
file /etc/filesystems.
5. To mount all default file systems:
mount all
This mounts all standard file systems in
/etc/filesystems marked "mount = true".
6. To mount a remote directory:
mount -n nodeA /u/tom /u/tom
This mounts the remote nodeA directory /u/tom onto
the local node directory /u/tom.
7. To mount a file or directory from the /etc/filesystem
file with a specific type:
mount -t remote
This mounts all files or directories in the
/etc/filesystems file that have a stanza that con-
tains the attribute "type = remote".
FILES
/etc/filesystems Descriptions of mountable file
systems.
/etc/mnttab Record of mounted file systems.
RELATED INFORMATION
The following command: "umount, unmount."
The mount, mntctl, umount, and vmount system calls and
the filesystems and mnttab files in AIX Operating System
Technical Reference.
The discussion of distributed services, code service, and
the overview of international character support in Man-
aging the AIX Operating System.