All Products
Search
Document Center

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

Last Updated:Dec 30, 2025

This topic describes how to use commands to unmount a file system from a client.

Prerequisites

  • A 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 file system is mounted on the client from which you plan to unmount it. For more information, see Scenarios.

Unmount 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

    Do not specify other parameters in the umount command unless necessary.

    If the error message device is busy is returned, it means a process is still accessing the file system. Follow these steps to identify and terminate the process:

    • 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.

    • 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.

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

      Note
      • Do not attempt to kill kernel processes.

      • If the file system still cannot be unmounted after the process is terminated, run the umount -f <Mount directory> or umount -l <Mount directory> command to forcibly unmount the file system. Force unmounting can cause data loss or corruption. Use it only as a last resort.

  4. Optional. Disable automatic mounting.

    If an automatic mount entry for this file system exists in /etc/fstab, remove or comment out the corresponding line to prevent it from being mounted again on system startup.

  5. To verify that the file system has been unmounted, run the mount -l command. 

    The file system is successfully unmounted if it is no longer listed in the output.

Unmount 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. Run the net use command to obtain the drive letter of a mount target.

    Note
    • The net use * /delete command will prompt you to confirm the unmounting of each mapped drive one by one.

    • The net use * /delete /y command unmounts all mapped drives without confirmation.

  3. Optional. Disable automatic mounting.

    If an automatic mount entry for this file system exists in /etc/fstab, remove or comment out the corresponding line to prevent it from being mounted again on system 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.