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, which is located in /usr/sbin, unmounts file systems.

You must have mount authority before you can issue the unmount command. For more information, see Mounting file systems in z/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 under 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 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.
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 performs the unmount operation, but it behaves like an unmount normal.
  • If there is activity in the file system, unmount -o drain returns a return value of -1 with return code EINVAL and reason code JrNotSupInSysplex.
immediate
The system immediately unmounts the file system. Any users who are 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 who are 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.

The -f filesystem_name option must also be used.

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 mount. For example:
    mount -q /ict/zfsfir
    can be used as input:
    unmount $(mount -q /ict/zfsdir)
  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 for unmount

  1. When the unmount command completes, the unmount operation is complete on the owner system and on the system where the unmount command was issued from, but not necessarily on the other systems in the sysplex. On those systems, the unmount operation completes asynchronously.
  2. If a path name is used, that path name must be accessible or you will have to use the unmount -f option using the file system name. If the path name is not accessible, use the console command D OMVS,F to obtain the file system name if it is not known.
  3. Because the path name for unmount is a node, symbolic links cannot be followed unless you add a trailing slash to the symbolic link name. For example, if /etc has been converted into a symbolic link, , 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.
  4. 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.zfs.mega' /mega
    mkdir /mega/wellie0
    mount -f 'posix.zfs.wellie0' /mega/wellie0
    then:
    unmount -R /mega

    unmounts the file system that is mounted at /mega/wellie0 and /mega. If you enter the same command again:

    unmount -R /mega

    The unmount fails because there is no file system that is mounted at /mega.

    If you then issue the command with the -m options

    unmount -R -m /mega

    the unmount operation attempts to unmount the file system that contains 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