Get the App
SLTechnology News&Howtos  ›  Servers  › 

Resolve the umount.nfs: / data: device is busy problem

Shulou Source: shulou.com Published: 2022-06-02 12:27:06 10月14日 Update

Sometimes we encounter the following problems when we need to umount a mount directory:

[root@localhost /] # umount / data/

Umount.nfs: / data: device is busy

Use this command to view:

[root@localhost /] # fuser-m-v / data/

User process number permission command

/ data/: root 2798.. c.. Bash

Root 2996.. c.. Su

-v stands for verbose mode. The process is displayed in ps, including PID, USER, COMMAND, ACCESS fields

-m indicates the file system or block device on which the specified file resides (in the mount state). All processes accessing the file system are listed.

As shown above, two processes are occupied, kill them off, and then unmount them again.

[root@localhost /] # kill-9 2798

[root@localhost /] # kill-9 2996

[root@localhost /] # umount / data/

[root@localhost /] #

Success!

Overview of fuser

The fuser command is used to display information about all processes that are using the specified file, file system, or sockets.

[root@gc-statis2] # fuser-m-v tests/

User process number permission command

Tests/: root 7300 F.ce. Php-fpm

Www 7301.. ce. Php-fpm

Www 7302.. ce. Php-fpm

Www 7303.. ce. Php-fpm

Www 7304.. ce. Php-fpm

Www 7305.. ce. Php-fpm

Www 7306.. ce. Php-fpm

Www 7307.. ce. Php-fpm

Www 7308.. ce. Php-fpm

Www 7309.. ce. Php-fpm

Root 18891.. c.. Bash

At the same time, fuser can be used to find which processes are using the specified port (network port).

[root@gc-statis2] # fuser-v-n tcp 80

User process number permission command

80/tcp: root 7975 F.... Nginx

Www 7976 F.... Nginx

Common scenarios in fuser

Fuser is usually used to diagnose "resource busy" problems in the system, usually when you want the mount point specified by umount. If you want all kill processes that are using a specified file, file system or sockets, you can use-k option.

Fuser-k / path/to/your/filename

At this point, fuser sends SIGKILL to all processes that are using / path/to/your/filename. If you want to be prompted before sending, you can use the-I option.

Fuser-k-I / path/to/your/filename

Tags: Process command being file permission user system problem time success two information at the same time scenario such as above field commonly used location way is in Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MySQL Linux vpn Redmi