All Products
Search
Document Center

Apsara File Storage NAS:Unmount a file system by running a command

Last Updated:Jan 30, 2024

This topic describes how to unmount a file system that was previously mounted at a directory by running a command.

Prerequisites

  • An Apsara File Storage NAS (NAS) file system is created. For more information, see Create a file system.

  • A mount target is created. For more information, see Manage mount targets.

  • The NAS file system is mounted. For more information, see Scenarios.

Unmount a file system from a Linux ECS instance

  1. Log on to the Elastic Compute Service (ECS) console.

  2. Connect to the ECS instance from a remote host.

  3. Run the umount /mnt command to unmount a Network File System (NFS) file system. Replace the /mnt directory with the actual mount directory.

    Note

    We recommend that you do not specify other parameters in the unmount command or change the default values of these parameters.

    When you unmount the file system, the error message device is busy may be prompted. In this case, you must perform the following steps to terminate the process that is accessing the file system:

    1. Install fuser.

      • For an ECS instance that runs CentOS, Red Hat Enterprise Linux (RHEL), or Alibaba Cloud Linux, fuser is preinstalled.

      • For an ECS instance that runs Ubuntu or Debian, run the apt install -y fuser command to install fuser.

    2. Run the fuser -mv <Local directory of the mount target> command to view the ID of the process that is accessing the NAS file system.

    3. Run the kill <pid> command to terminate the process.

      Note

      If the process is a kernel process, skip this step.

  4. Optional. Disable automatic mounting of the file system at startup.

    If you configure an automatic mount script for an NFS or Server Message Block (SMB) file system and you need to restart the ECS instance, you must delete or modify the /etc/fstab configuration file to disable automatic mounting of the file system at startup.

  5. Run the mount -l command to view the unmount result.

    If the NAS file system is not displayed in the command output, the file system is unmounted.

Unmount a file system from a Windows ECS instance

  1. Log on to the ECS console.

  2. Open the Command Prompt and run the following command to unmount the file system:

    net use D: /delete

    Replace the drive letter D: in the preceding command with the actual drive letter. You can run the net use command to obtain the drive letter of a mount target.

    Note
    • You can run the net use * /delete command to unmount each available file system one by one in Windows.

    • You can run the net use * /delete /y command to unmount all the available file systems without any confirmation in Windows.

  3. Optional. Disable automatic mounting of the file system at startup.

    If you configure an automatic mount script for an NFS or SMB file system and you need to restart the ECS instance, you must delete or modify the automatic mount script to disable automatic mounting of the file system at startup.

    • Automatic mount script for an SMB file system: auto_mount.bat

    • Automatic mount script for an NFS file system: nas_auto.bat

  4. Run the net use command to view the unmount result.

    If the SMB file system is not displayed in the command output, the file system is unmounted.