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
Log on to the Elastic Compute Service (ECS) console.
Connect to the ECS instance from a remote host.
Run the
umount /mntcommand to unmount a Network File System (NFS) file system. Replace the/mntdirectory with the actual mount directory.NoteDo not specify other parameters in the
umountcommand unless necessary.If the error message
device is busyis 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 fusercommand 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.NoteDo 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>orumount -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.
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.To verify that the file system has been unmounted, run the
mount -lcommand.The file system is successfully unmounted if it is no longer listed in the output.
Unmount from a Windows ECS instance
Log on to the ECS console.
Open the Command Prompt and run the following command to unmount the file system:
net use D: /deleteReplace the drive letter
D:in the preceding command with the actual drive letter. Run thenet usecommand to obtain the drive letter of a mount target.NoteThe
net use * /deletecommand will prompt you to confirm the unmounting of each mapped drive one by one.The
net use * /delete /ycommand unmounts all mapped drives without confirmation.
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
Run the
net usecommand to view the unmount result.If the SMB file system is not displayed in the command output, the file system is unmounted.