Go to main content

Managing File Systems in Oracle® Solaris 11.4

Exit Print View

Updated: November 2020
 
 

Unmounting a File System

You can use the unmount command to unmount a file system. For more information about unmounting a ZFS file system, see Unmounting ZFS File Systems in Managing ZFS File Systems in Oracle Solaris 11.4.

You can either unmount a specific file system or unmount a specific device that contains a file system. For more information, see the umount(8) man page.

Ensure that the file system is not busy. A file system is considered busy, if a user is accessing a directory in the file system, or if a program has an open file in that file system, or if the file system is being shared.

Perform the following operations to make a file system available for unmounting:

  • Change to a directory in a different file system.

  • Stop the processes from using files on the file system.

  • Unshare the file system. For more information about unsharing a file system, see the unshare(8) man page.

To verify that you have unmounted a file system, use the mount command.

$ mount | grep unmounted-file-system

How to Stop All Processes That Are Accessing a File System

  1. Become an administrator.

    For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.4.

  2. List all the processes that are accessing the file system to know the processes that you want to stop.
    # fuser -c [ -u ] /mount-point
    –c

    Reports on files that are mount points for file systems and any files within those mounted file systems

    –u

    Displays the user login name for each process ID

    /mount-point

    Specifies the name of the file system for which you want to stop processes

  3. Stop all processes that are accessing the file system.
    # fuser -c -k /mount-point

    A SIGKILL is sent to each process that is using the file system.


    Note -  You must not stop the processes of a user without first warning the user.
  4. Verify that no process is accessing the file system.
    # fuser -c /mount-point
Example 11  Stopping All Processes That Are Accessing a File System

This example shows how to stop process 4006c that is using the /export/home file system.

# fuser -c /export/home
/export/home:     4006c
# fuser -c -k /export/home
/export/home:     4006c
# fuser -c /export/home
/export/home: