mount Command
Purpose
Makes a file system available for use.
Syntax
mount [ -f ] [ -n node ] [ -o options ] [ -p ] [ -r ] [ -v vfsname ] [ -F AltFSfile ] [ -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/file systems 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:
- the node (if the mount is remote)
- the object mounted
- the mount point
- the virtual-file-system type
- the time mounted
- any mount options
If you specify only the directory or node: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/file systems 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/file systems file.
The /etc/file systems 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 mount operations are referred to as automatic mount operations.
By default, the mount command runs the wlmcntrl command to refresh the current assignment rules in the kernel after mounting the file system. In some situations (such as when many file systems are mounted at once, or when a rule for an inaccessible remote mount is present in the workload manager configuration), calling wlmcntrl automatically after mount might be undesirable.
If you wish to override this
behavior, set the environment variable MOUNT_WLMCNTRL_SELFMANAGE to
any value. This will avoid calling the wlmcntrl command during
the mount operation. You must manually run wlmcntrl -u -d
""
to refresh the current assignment rules in the kernel.
For more information, see wlmcntrl command.
- If the cdromd CD and DVD automount daemon is enabled, those devices will be automatically mounted as specified in the /etc/cdromd.conf file. Use the cdumount or cdeject command to unmount an automatically mounted CD or DVD. Use stopsrc -s cdromd to disable the CD/DVD automount daemon.
- For CacheFS, the remote file system that is to be cached locally
must be exported such that the root ID of the local system is not
remapped on the remote host to
nobody
(or the ID that the remote host uses as the anonymous user). For example, if host A were to export a file system /F, which would be mounted with CacheFS on host B, then the /etc/exports on host A would need to have an entry similar to:
depending on the mount options used for the local CacheFS mount./F -rw,root=B or /F -ro,root=B
- Mounting a JFS file system on a read-only logical volume is not supported.
- Mounting a JFS2 file system with EAv1 on Trusted AIX® system converts the file system to EAv2.
Using mount on a JFS2 File System
The mount command can also be used to access a snapshot of a JFS2 file system as a directory tree. The snapshot on device is mounted read-only at directory. A snapshot can only be mounted once. When mounting a JFS2 file system with snapshots, the snapshots are activated.
You can use the System Management Interface Tool (SMIT) smit mount fast path to run this command.
Flags
Item | Description |
---|---|
-a | Mounts all file systems in the /etc/file systems 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. |
-F AltFSfile | Mounts on a file of an alternate file system, other than the /etc/file systems file. |
-n node | Specifies the remote node that holds the directory to be mounted.
The node can be specified as a colon-separated IPv6 address. If this
is done with the node:directory format, the colon-separated
IPv6 address must be enclosed in square brackets. |
-p | Mounts a file system as a removable file system. While open files are on it, a removable 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/file systems file or any previous command-line options. |
-t type | Mounts all stanzas in the /etc/file systems 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. |
File System Specific Options
Item | Description |
---|---|
-o options | Specifies options. Options entered on the command line should
be separated only by a comma. The following file system-specific options
do not apply to all virtual file system types:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NFS Specific Options
Item | Description |
---|---|
-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
NFS-specific options do not apply to all virtual file system types:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CacheFS Specific Options
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.
Item | Description |
---|---|
-o | Specifies options.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Restriction: mfsid is
an option if the backend file system for CacheFS is NFS v4.
|
|
-V | Mounts a CacheFS file system. |
Server Message Block (SMB) client file system specific options
Item | Description |
---|---|
-o options | Specifies options for mounting the SMB client file system. Options that you enter on the
command line must be separated only by a comma. Do not insert a space before or after a comma. The
following options are available for the SMB client file system:
|
If the options that are used with the mount command (pver, signing,
secure_negotiate, or encryption
) are unspecified by using the -o flag,
the default values for the mount command options are initialized by using the new
values of the kernel tunable parameters (smbc_protocol_version, smbc_signing,
smbc_secure_negotiate, smbc_encryption
). The kernel tunable parameters are initialized from
tunable parameters defined in the smbctune.conf file. These parameters can also
be modified by using the smbctune command.
Options of the -o flag (mount command) | Corresponding kernel tunable parameter of the smbctune.con file | Valid values |
pver | smbc_protocol_version | 2.1, 3.0.2, auto |
signing | smbc_signing | enabled, required |
secure_negotiate | smbc_secure_negotiate | desired, required, disabled |
encryption | smbc_encryption | desired, required, disabled |
Security
Examples
- To list the mounted file systems, enter the following command:
This command produces output similar to the following:mount
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.node mounted mounted over vfs date options ---- ------- ------------ --- ------------ ------------------- /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
- To mount all default file systems, enter the following command:
mount allThis command sequence mounts all standard file systems in the /etc/file systems file marked by the mount=true attribute.
- To mount a remote directory, enter the following command: mount -n nodeA /home/tom.remote /home/tom.localThis 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.
- To mount a file or directory from the /etc/file systems file
with a specific type, enter the following command: mount -t remoteThis command sequence mounts all files or directories in the /etc/file systems file that have a stanza that contains the type=remote attribute.
- To CacheFS-mount the file system which is already NFS-mounted
on /usr/abc, enter the following command:
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
- To mount a snapshot, enter the following command:
This command mounts the snapshot contained on the /dev/snapsb device onto the /home/janet/snapsb directory.mount -o snapshot /dev/snapsb /home/janet/snapsb
- To mount a file system and create a snapshot, enter the following
command:
This command mounts the file system contained on the /dev/sbdevice onto the /home/janet/sb directory and creates a snapshot for the file system on the /dev/snapsbdevice.mount -o snapto=/dev/snapsb /dev/sb /home/janet/sb
- To access files on an SMB server as a local file system, enter
the following command:
mount -v cifs -n pezman/user1/pass1 -o uid=201,fmode=750 /home /mnt
- To mount an SMB client file system as a local mount point, enter the following
command:
Where,mount -v smbc -n llm140.xyz.com/cec102usr1/Passw0rd \ -o wrkgrp=SMB_21.FVT,port=445,signing=required /some_share /mnt
llm140.xyz.com
is the Windows server,cec102usr1
is the Kerberos user name,Passw0rd
is the password of the Kerberos user,SMB_21.FVT
is the workgroup,some_share
is the share point on the Windows system, and/mnt
is the local mount point. - To remount the mounted read-only JFS2 file system to a read-write
file system, enter the following command:
mount –o remount,rw fsname
- To mount all on a file /tmp/fs1 of an alternate
file system, enter the following command:
mount -F /tmp/fs1 all
Files
Item | Description |
---|---|
/etc/file systems | Lists the known file systems and defines their characteristics. |
/etc/vfs | Contains descriptions of virtual-file-system types. |