mount(1Mnfs)


mount, umount -- mount or unmount remote NFS resources

Synopsis

mount [-F nfs] [-r] [-o specific_options] [server:path | mountpoint]

mount [-F nfs] [-r] [-o specific_options] server:path mountpoint

umount [-o specific_options] {server:path | mountpoint}

Description

The NFS®-specific mount command attaches a named path residing on machine server to the filesystem hierarchy at the pathname location mountpoint, which must already exist. mount maintains a table of mounted filesystems in /etc/mnttab, described in mnttab(4).

The NFS-specific umount command is located in /usr/lib/fs/nfs/umount and is called by the generic umount command. umount unmounts a filesystem and removes the appropriate entry from /etc/mnttab.

Options

The following options are available to the mount command:

-F
Specifies the File System Type (FSType). If the -F option is omitted, mount will attempt to determine the filesystem type automatically.

-r
Mount the specified filesystem read-only.

-o
Specify filesystem specific options in a comma-separated list of words from the following list:

accmax=n
(NFSv3 only.) Specifies how long to cache access permission entries. The default period is 30 seconds. A value of 0 turns off caching.

acdirmax=n
Hold cached attributes for no more than n seconds after directory update. The default is 60.

acdirmin=n
Hold cached attributes for at least n seconds after directory update. The default is 30.

acregmax=n
Hold cached attributes for no more than n seconds after file modification. The default is 60.

acregmin=n
Hold cached attributes for at least n seconds after file modification. The default is 3.

actimeo=n
Set minimum and maximum times for regular files and directories to n seconds. This option is equivalent to setting:
acdirmin=acdirmax=acregmin=acregmax=n

asyncwrites
(NFSv3 only.) All writes to the filesystem will be performed asynchronously. This may improve performance but carries with it the risk of data loss on server crashes.

bg|fg
If the first attempt fails, retry as a background process, or, as a foreground process. The default isfg.

grpid
Create a file with its GID set to the effective GID of the calling process. This behavior may be overridden on a per-directory basis by setting the set-GID bit of the parent directory; in this case, the GID is set to the GID of the parent directory (see open(2) and mkdir(2)). Files created on filesystems that are not mounted with the grpid option will obey BSD semantics; that is, the GID is unconditionally inherited from that of the parent directory.

intr
Allow keyboard interrupts to kill a process that is hung while waiting for a response on a hard-mounted filesystem.

maxthreads=n
Set the maximum number of asynchronous I/O threads for this mount point to n threads. The default is 4.

noac
Suppress attribute caching.

port=n
The server IP port number. The default is NFS_PORT.

pre4.0
Allow mounting from pre-SVR4.0 systems or other older NFS implementations. This option should be used when the NFS server does not allow a client user to belong to more than eight groups. If the pre4.0 option is not used with such a server, the mount command will fail on the client and the following message will display:
nfs mount: server:path server not responding:

RPC: Authentication error; why = Invalid client credential.


proto=netid
Specifies a transport provider (netid). If not specified, mount defaults to connectionless transport (udp).

public
Mount a remote filesystem shared as a publicly-accessible WebNFS directory.

remount
If a filesystem is mounted read-only, remounts the filesystem read-write.

retrans=n
Set the number of NFS retransmissions to n for soft mounts. The default is 5.

retry=n
The number of times to retry the mount operation. The default is 10000.

rsize=n
Set the read buffer size to n bytes. The default is 8192.

rw|ro
server:path is mounted read-write or read-only. The default is rw.

secure
Use a more secure protocol for NFS transactions.

slmax=n
(NFSv3 only.) Specifies how long to cache symbolic link target paths. The default period is 30 seconds. A value of 0 turns off caching.

soft|hard
Return an error if the server does not respond, or continue the retry request until the server responds. The default is hard.

suid|nosuid
Execution of setuid allowed or disallowed. The default is suid.

timeo=n
Set the NFS timeout to n tenths of a second. The default is 10.

vers=2|3
Specifies the version of NFS (v2 or v3) that should be used. mount will only attempt to use the specified version of NFS. If no version is specified, mount first uses NFSv3, and if unsuccessful, retries using NFSv2.

wsize=n
Set the write buffer size to n bytes. The default is 8192.
The following arguments are applicable to the NFS-specific mount and umount commands:

server:path
Where server is the machine that has the remote resource and path is the pathname of the resource.

mountpoint
The name of the local directory where the remote resource has been mounted.

Background versus foreground

NFS Filesystems mounted with the bg option indicate that mount is to retry as a background process if the server's mount daemon, mountd(1Mnfs), does not respond. mount retries the request up to the count specified in the retry=n option.

Hard versus soft

Once the filesystem is mounted, each NFS request made in the kernel waits timeo=n tenths of a second for a response. If no response arrives, the time-out is multiplied by 2 and the request is retransmitted. When the number of retransmissions has reached the number specified in the retrans=n option, a filesystem mounted with the soft option returns an error on the request; one mounted with the hard option prints a warning message and continues to retry the request. If an NFS server is down, a process trying to access a filesystem from that server mounted with the hard option will hang until the server comes up again.

Read-write versus read-only

NFS Filesystems that are mounted rw (read-write) should use the hard option. If the server goes down when a user is writing a file, the write will continue when the serve comes back up, and the data being written will not be lost.

File attributes

The attribute cache retains file attributes on the client. Attributes for a file are assigned a time to be flushed (updated). If the file is modified before the flush time, then the flush time is extended by the time since the last modification (under the assumption that files that changed recently are likely to change soon). There is a minimum and maximum flush time extension for regular files and for directories. Setting actimeo=n extends flush time by n seconds for both regular files and directories.

Files


/etc/mnttab
Table of mounted filesystems.

/etc/dfs/fstypes
Default distributed filesystem type.

/etc/vfstab
Table of automatically mounted resources.

Usage

If mountpoint has any contents prior to the mount operation, the contents remain hidden until the server:path is once again unmounted. If server:path is listed in the vfstab file, the command line can specify either server:path or mountpoint, and mount will consult vfstab for more information.


NOTE: If the directory on which a filesystem is to be mounted is a symbolic link, the filesystem is mounted on the directory to which the symbolic link refers, rather than being mounted on top of the symbolic link itself.

Only a privileged user can execute these commands.

Exit codes

The following values are returned by the NFS-specific mount command:

0
Successful exit

32
Usage error

47
Could not open mnttab

48
Could not lock mnttab

70
Retry mount operation

71
Gave up retrying mount operation

72
Specify host:path

73
Invalid option

74
Server not responding

75
Could not get nfs service addr

76
Could not negotiate secure protocol

77
Access denied

78
No such directory
The following values are returned by the NFS-specific umount command:

0
Successful exit

33
Usage error

34
Permission denied

35
Directory/Resource not mounted

36
Mount point busy

Warnings

Applications may experience unexpected or unreproducible errors if they access NFS filesystems that have been mounted using the soft option or the hard,intr option combination. It is recommended that you do not specify either soft or intr when mounting NFS filesystems that are writable or that contain executable files.

If you are mounting resources on a slow machine from a much faster server, it is advised that you use the rsize=1024,wsize=1024 mount options. This is because fast servers can cause data overruns on the network adapter of slow client machines. One symptom of this problem has the following message being written to the console of the client machines:

   RPC: Timed out
Another symptom of this problem may be that the client machine appears to be hung, with the following message being written to the console of the client machine:
   NFS server hostname not responding, still trying


NOTE: When a single file is mounted over NFS, it cannot be opened with the O_CREAT flag.

See open(2) for information on O_CREAT.

Examples


NOTE: The -F nfs option specified in these examples is not strictly required and could be omitted. Here it serves merely as a reminder of the filesystem type.

To mount a remote filesystem:

   mount -F nfs serv:/usr/src /usr/src
To soft mount a remote filesystem:
   mount -F nfs -o soft serv:/usr/src /usr/src
To hard mount a remote filesystem:
   mount -F nfs -o hard serv:/usr/src /usr/src
To mount a filesystem with rsize set to 1024 bytes:
   mount -F nfs -o rsize=1024 serv:/usr/src /usr/src
To mount a filesystem and allow the mount command to only be retried 3 times:
   mount -F nfs -o retry=3 serv:/usr/src /usr/src
To mount a remote filesystem using ...
   mount -F nfs -o proto=xxx serv:/usr/src /usr/src
To unmount a remote filesystem with server:path
   umount serv:/usr/src
where serv is the name of the server and /usr/src is the name of the path.

To unmount a remote filesystem with mountpoint

   umount /usr/src
where /usr/src is the mountpoint of the mounted resource.

References

mnttab(4), mount(1Mnfs), mount(2), mountall(1M), open(2), umount(2), vfstab(4)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004