Run a command to unmount a NAS file system from a Linux or Windows ECS instance.
Prerequisites
Before you begin, ensure that you have:
A File Storage NAS (NAS) file system. For more information, see Create a file system.
A mount target. For more information, see Manage mount targets.
The file system 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.
-
Run
umount /mntto unmount the Network File System (NFS) file system. Replace/mntwith the actual mount directory.NoteDo not add extra parameters to the
umountcommand unless necessary.If the
device is busyerror appears, a process is still accessing the file system. To identify and stop the process:-
Install fuser if it is not already present:
CentOS, Red Hat Enterprise Linux (RHEL), and Alibaba Cloud Linux: fuser is preinstalled.
Ubuntu and Debian: run
apt install -y fuser.
Run
fuser -mv <local directory of the mount target>to identify the process ID accessing the NAS file system.-
Run
kill <pid>to stop the process.NoteDo not kill kernel processes.
If the file system still cannot be unmounted, 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 the file system from remounting on startup. Verify that the file system is unmounted. Run
mount -land confirm the file system no longer appears in the output.
Unmount from a Windows ECS instance
Log on to the ECS console.
-
Open Command Prompt and run the following command to unmount the file system:
net use D: /deleteReplace the drive letter
D: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.
Delete the automatic mount script or remove the entry in
/etc/fstabto prevent the file system from remounting on startup.SMB file system automatic mount script: auto_mount.bat
NFS file system automatic mount script: nas_auto.bat
To also remove the scheduled task, open Task Scheduler, locate the corresponding task, and delete it.
Run the
net usecommand to verify the unmount result. The file system is unmounted if the SMB file system no longer appears in the output.