unmount — Remove a file system from the file hierarchy

Format

unmount [–R|f] [–v] [–o normal|drain|immediate|force|reset] [-m] name…

Description

The unmount shell command, located in /usr/sbin, unmounts file systems.

Rule: You must have mount authority before you can issue the unmount command. See the section on mount authority in z/OS UNIX System Services Planningz/OS UNIX System Services Planning.

Options

–f
The list of names to unmount are file system names instead of path names.

This option is mutually exclusive with -R.

–m
Specifies that the name... parameter can be any file or directory within the file system to be unmounted.
–R
Unmounts the specified file system and all the file systems below it in the file system hierarchy.

This option is mutually exclusive with -f.

–o normal|drain|immediate|force|reset
normal
Specifies that if no user is accessing any of the files in the specified file system, the system processes the unmount request. Otherwise, the system rejects the unmount request. This is the default
drain
Specifies that an unmount drain request is to be made. The system will wait for all use of the file system to be ended normally before the unmount request is processed or until another UNMOUNT command is issued.
Currently, unmount –o drain is not supported in a sysplex. If an unmount –o drain is issued in a sysplex, the following behavior is exhibited:
  • If there is no activity in the file system, unmount -o drain will perform the unmount, but it will behave like an unmount normal.
  • If there is activity in the file system, unmount -o drain will return a Return_value of -1 with Return_code EINVAL and Reason_code JrNotSupInSysplex.
immediate
The system immediately unmounts the file system. Any users accessing files in the specified file system will receive failing return codes. All data changes to files in the specified file system are saved. If the data changes cannot be saved, the unmount request fails.
force
Also specifies that the system will unmount the file system immediately. Any users accessing files in the specified file system will receive failing return codes. If possible, all data changes to files in the specified file system are saved. If the data changes to the files cannot be saved, the unmount request continues and the data is lost.

Rule: An unmount –o immediate request must be issued before you can request an unmount –o force of a file system. Otherwise, unmount –o force will fail.

reset
A reset request stops a previous unmount –o drain request.

Restriction: unmount –o reset is not supported in a sysplex.

–v
Lists all file systems that are unmounted.

name… specifies the path name of the mount point directory to use when locating the file system to be unmounted or the name of the file system to be unmounted. If the -m option is used, the name can be for any file or directory within that file system.

Examples

  1. To unmount a file system that is mounted on /u/wjs, issue:
    unmount /u/wjs
  2. The output of mount –q can be used for the input of unmount. For example:
    mount -q /ict/hfsfir
    can be used as input:
    unmount $(mount -q /ict/hfsdir)
  3. To unmount a file system that contains the file or directory /u/wjs, using the -m option to specify the directory:
    unmount -m /u/wjs
  4. To unmount a file system that contains the file or directory /u along with all other file systems mounted over or below that file system, using the -m option to specify the directory:
    unmount -R -m /u

Usage notes

  1. Because the path name for unmount is a node, symbolic links cannot be followed unless a trailing slash is added to the symbolic link name. For example, if /etc has been converted into a symbolic link, /etc -> $SYSNAME/etc, issuing unmount -R /etc without the trailing slash will result in trying to unmount -R /etc -> $SYSNAME/etc. Depending on the security access for the symbolic link, RACF® errors might occur. However, if you specify unmount -R /etc/ with the trailing slash, the symbolic link will be followed and RACF will determine the access from the file being linked to.
  2. When the -m option is specified, the unmount shell command operates on the path name and its associated file system. If the path name does not have a file system mounted on it, the associated file system is the one that contains the path. For example:
    mkdir /mega
    mount -f 'posix.hfs.mega' /mega
    mkdir /mega/wellie0
    mount -f 'posix.hfs.wellie0' /mega/wellie0
    then:
    unmount -R /mega

    will unmount the file system mounted at /mega/wellie0 and /mega. If you enter the same command again:

    unmount -R /mega

    The unmount will fail because there is no file system mounted at /mega.

    If you then issue the command with the -m options;

    unmount -R -m /mega

    the unmount will attempt to unmount the file system containing the /mega directory (in this case, the root) and any other file systems that are mounted on the root.

Exit values

0
Successful completion

Related information

chmount, mount