[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Commands Reference, Volume 3

mount Command

Purpose

Makes a file system available for use.

Syntax

mount [ -f ] [ -n Node ] [ -o Options ] [ -p ] [ -r ] [ -v VfsName ] [ -t Type | [ Device | Node:Directory ] Directory | all | -a ] [-V [generic_options] special_mount_points ]

Description

The mount command instructs the operating system to make a file system available for use at a specified location (the mount point). In addition, you can use the mount command to build other file trees made up of directory and file mounts. The mount command mounts a file system expressed as a device using the Device or Node:Directory parameter on the directory specified by the Directory parameter. After the mount command has finished, the directory specified becomes the root directory of the newly mounted file system.

Only users with root authority or are members of the system group and have write access to the mount point can issue file or directory mounts. The file or directory may be a symbolic link. The mount command uses the real user ID, not the effective user ID, to determine if the user has appropriate access. System group members can issue device mounts, provided they have write access to the mount point and those mounts specified in the /etc/filesystems file. Users with root user authority can issue any mount command.

Users can mount a device provided they belong to the system group and have appropriate access. When mounting a device, the mount command uses the Device parameter as the name of the block device and the Directory parameter as the directory on which to mount the file system.

If you enter the mount command without flags, the command displays the following information for the mounted file systems:

If you specify only the Directory parameter, the mount command 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). The mount command looks up the associated device, directory, or file and mounts it. This is the most convenient way of using the mount command, because it does not require you to remember what is normally mounted on a directory or file. You can also specify only the device. In this case, the command obtains the mount point from the /etc/filesystems 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 for the mount attributes: automatic, true, false, removable, and readonly.

The mount all command causes all file systems with the mount=true attribute to be mounted in their normal places. This command is typically used during system initialization, and the corresponding mounts are referred to as automatic mounts.

CacheFS mount Specific

The CacheFS-specific version of the mount command mounts a cached file system; if necessary, it NFS-mounts its back file system. It also provides a number of CacheFS-specific options for controlling the caching process.

To mount a CacheFS file system, use the mount command with the -V flag followed by the argument. The following mount flags are available:

The following arguments to the -o flag are specifically for CacheFS mounts. Use commas to separate multiple options.

Note: The backfstype argument must be specified.

backfstype=file_system_type The file system type of the back file system (for example, nfs).
backpath=path Specifies where the back file system is already mounted. If this argument is not supplied, CacheFS determines a mount point for the back file system. The back file system must be read-only.
cachedir=directory The name of the cache directory.
cacheid=ID ID is a string specifying a particular instance of a cache. If you do not specify a cache ID, CacheFS will construct one.
write-around | non-shared Write modes for CacheFS. The write-around mode (the default) handles writes the same as NFS does; that is, writes are made to the back file system, and the affected file is purged from the cache. You can use the non-shared mode when you are sure that no one else will be writing to the cached file system.
noconst Disables cache consistency checking. By default, periodic consistency checking is enabled. Specify noconst only when you know that the back file system will not be modified. Trying to perform cache consistency check using cfsadmin-s will result in error. demandconst and noconst are mutually exclusive.
local_access Causes the front file system to interpret the mode bits used for access checking instead or having the back file system verify access permissions. Do not use this argument with secure NFS.
purge Purge any cached information for the specified file system.
rw | ro Read-write (default) or read-only.
suid | nosuid Allow (default) or disallow set-uid execution
acregmin=n Specifies that cached attributes are held for at least n seconds after file modification. After n seconds, CacheFS checks to see if the file modification time on the back file system has changed. If it has, all information about the file is purged from the cache and new data is retrieved from the back file system. The default value is 30 seconds.
acregmax=n Specifies that cached attributes are held for no more than n seconds after file modification. After n seconds, all file information is purged from the cache. The default value is 30 seconds.
acdirmin=n Specifies that cached attributes are held for at least n seconds after directory update. After n seconds, CacheFS checks to see if the directory modification time on the back file system has changed. If it has, all information about the directory is purged from the cache and new data is retrieved from the back file system. The default value is 30 seconds.
actimeo=n Sets acregmin, acregmax, acdirmin, and acdirmax to n.

You can use the Web-based System Manager File Systems application (wsm fs fast path) to run this command. You could also use the System Management Interface Tool (SMIT) smit mount fast path to run this command.

Note: If the mount command encounters a Journaled File System which was not unmounted before reboot, a replay of any JFS log records is attempted. In order to move a compatible JFS filesystem to a system running an earlier release of the AIX operating system, the filesystem must always be unmounted cleanly prior to its movement. Failure to unmount first may result in an incompatible JFS log device. If the movement results in an unknown log device, the filesystem should be returned to the system running the latter operating system release, and fsck should be run on the filesystem.

Flags

-a Mounts all file systems in the /etc/filesystems file with stanzas that contain the true mount attribute.
all Same as the -a flag.
-f Requests a forced mount during system initialization to enable mounting over the root file system.
-n Node Specifies the remote node that holds the directory to be mounted.

File System Specific Options:

-o Options Specifies options. Options you enter on the command line should be separated only by a comma, not a comma and a space. The following file- system-specific options do not apply to all virtual-file-system types:
bsy Prevents the mount operation if the directory to be mounted over is the current working directory of a process.
log=LVName Specifies the full path name of the filesystem logging logical volume name where the following file-system operations are logged.
nodev Specifies that you cannot open devices from this mount. This option returns a value of ENXIO if a failure occurs.
nosuid Specifies that execution of setuid and setgid programs by way of this mount is not allowed. This option returns a value of EPERM if a failure occurs.
ro Specifies that the mounted file is read-only. The default value is rw.
rw Specifies that the mounted file is read/write accessible. rw is the default value.

NFS Specific Options

-o Options Specifies options.
bg Attempts mount in background if first attempt is unsuccessful. The default value is fg.
fg Attempts mount in foreground if first attempt is unsuccessful. fg is the default value.
vers=[2|3] Specifies NFS version. The default is the version of NFS protocol used between the client and server and is the highest one available on both systems. If the NFS server does not support NFS Version 3, the NFS mount will use NFS Version 2. Use the vers=[2|3] option to select the NFS version. This option only applies to AIX Version 4.2.1 or later.
proto=[udp|tcp] Specifies the transport protocol. The default transport protocol used for AIX Version 4.2.1 NFS mounts is udp if available on the server. For AIX Versions 4.3.0 and later the default is tcp. Use the proto=[udp|tcp] option to override the default. This option only applies to AIX Version 4.2.1 or later.
retry=n Sets the number of times the mount is attempted to n; the default value is 1000. When the retry value is 0, the system makes 10,000 attempts.
rsize=n Sets the read buffer size to n bytes. The default value is 8192. For AIX Version 4.2.1 only, the default value is 32768 when using Version 3 of the NFS protocol.
wsize=n Sets the write buffer size to n bytes. The default value is 8192. For AIX Version 4.2.1 only, the default value is 32768 when using Version 3 of the NFS protocol.
llock Requests that files lock locally at the NFS client. NFS network file locking requests are not sent to the NFS server if the llock option is used. This option only applies to AIX Version 4.2.1 or later.
timeo=n Sets the Network File System (NFS) time-out period to n tenths of a second. The default value is 7.
retrans=n Sets the number of NFS transmissions to n. The default value is 3.
port=n Sets server Internet Protocol (IP) port number to n. The default value is the NFS_PORT (a system-specified constant).
soft Returns an error if the server does not respond. The default value is hard.
hard Retries a request until server responds. The option is the default value.
intr Allows keyboard interrupts on hard mounts.
nointr Specifies no keyboard interrupts allowed on hard mounts. This option only applies to AIX Version 4.2.1 or later.
posix Requests that pathconf information be exchanged and made available on an NFS Version 2 mount. Requires a mount Version 2 rpc.mountd at the NFS server.

This option only applies to AIX Version 4.2.1 or later.

secure Specifies that the mount command uses Data Encryption Standard (DES) for NFS transactions.
grpid Directs any file or directory created on the file system to inherit the group ID of the parent directory.
noacl Specifies not to use the AIX Access Control List RPC program for this NFS mount request. The default is noacl. This option only applies to AIX Version 4.2.1 or later.
acl Requests using the AIX Access Control List RPC program for this NFS mount. If the acl option is used, the ACL RPC program is used only if the NFS server provides it. The default is noacl. This option only applies to AIX Version 4.2.1 or later.
noac Specifies that the mount command performs no attribute or directory caching. If you do not specify this option, the attributes (including permissions, size, and timestamps) for files and directories are cached to reduce the need to perform over-the-wire NFSPROC_GETATTR Remote Procedure Calls (RPCs). The NFSPROC_GETATTR RPC enables a client to prompt the server for file and directory attributes. The acregmin, acregmax, acdirmin, and acdirmax options control the length of time for which the cached values are retained.
shortdev Specifies that you are mounting a file system from a host that does not support 32-bit device special files. This option does not apply to AIX Version 4.2.1 or later.
actimeo=n Sets minimum and maximum times for regular files and directories to n seconds. If this option is set, it overrides any settings for the acregmin, acregmax, acdirmin, and acdirmax options.
acregmin=n Holds cached attributes for at least n seconds after file modification. The default is 3 seconds.
acregmax=n Holds cached attributes for no longer that n seconds after file modification. The default is 60 seconds.
acdirmin=n Holds cached attributes for at least n seconds after directory update. The default is 30 seconds.
acdirmax=n Holds cached attributes for no more than n seconds after directory update. The default is 60 seconds.
-p Mounts a file system as a removable file system. While open files are on it, a removably mounted file system behaves the same as a normally mounted file system. However, when no files are open (and no process has a current directory on the file system), all of the file system disk buffers in the file system are written to the medium, and the operating system forgets the structure of the file system.
-r Mounts a file system as a read-only file system, regardless of its previous specification in the /etc/filesystems file.
-t Type Mounts all stanzas in the /etc/filesystems file that contain the type=Type attribute and are not mounted. The Type parameter specifies the name of the group.
-v VfsName Specifies that the file system is defined by the VfsName parameter in the /etc/vfs file.

Examples

  1. To list the mounted file systems, enter:
    mount
    This command produces output similar to the following:
    node   mounted          mounted    vfs  date          options   over
    ----   -------          ---------  ---  ------------   -------  ---------
           /dev/hd0         /          jfs  Dec 17 08:04   rw, log  =/dev/hd8
           /dev/hd3         /tmp       jfs  Dec 17 08:04   rw, log  =/dev/hd8
           /dev/hd1         /home      jfs  Dec 17 08:06   rw, log  =/dev/hd8
           /dev/hd2         /usr       jfs  Dec 17 08:06   rw, log  =/dev/hd8
    sue    /home/local/src  /usr/code  nfs  Dec 17 08:06   ro, log  =/dev/hd8
    For each file system, the mount command lists the node name, the device name, the name under which it is mounted, the virtual-file-system type, the date and time it was mounted, and its options.
  2. To mount all default file systems, enter:
    mount all
    This command sequence mounts all standard file systems in the /etc/filesystems file marked by the mount=true attribute.
  3. To mount a remote directory, enter:
    mount -n nodeA /home/tom.remote /home/tom.local
    This command sequence mounts the /home/tom.remote directory located on nodeA onto the local /home/tom.local directory. It assumes the default VfsName parameter=remote, which must be defined in the /etc/vfs file.
  4. To mount a file or directory from the /etc/filesystems file with a specific type, enter:
    mount -t remote
    This command sequence mounts all files or directories in the /etc/filesystems file that have a stanza that contains the type=remote attribute.
  5. To CacheFS-mount the file system which is already NFS-mounted on /usr/abc, enter:
    mount -V cachefs -o backfstype=nfs,backpath=/usr/abc,
    cachedir=/cache1 server1:/user2 /xyz

    The lines similar to the following appear in the /etc/mnttab file after the mount command is executed:

    server1:/user2 /usr/abc nfs
    /usr/abc /cache1/xyz cachefs backfstype=nfs

Files

/etc/filesystems Lists the known file systems and defines their characteristics.
/etc/vfs Contains descriptions of virtual-file-system types.

Related Information

The nfso command, umount command.

The mntctl subroutine, mount subroutine, umount subroutine.

The filesystems file, vfs file.

Setting up and running Web-based System Manager in AIX Version 4.3 System Management Guide: Operating System and Devices.

Mounting Overview and System Management Interface Tool (SMIT): Overview in AIX Version 4.3 System Management Concepts: Operating System and Devices.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]