Methods of payment Abuse

Ошибка device or resource busy

29.01.2024, 22:39

Often during work with flash drives, disks, images the error device or resource busy appears. It can be displayed when you try to unmount an external disk or partition, or when you try to move or delete a file. In this article we will discuss why this error may occur, as well as ways to fix it.

Why does the device or resource busy error appear?

The message means that a device or resource is busy. If you explain in more detail - the file that you are trying to delete or the disk that needs to be unmounted is still being used by one of the running programs. This could happen because the program has not finished its work yet, it has frozen, there are some problems in the process of its work.

An error may occur when trying to perform an operation on a file that is already being used by another process or program. Often the problem is associated with an open file, a locked device, a network connection. In the case of a flash drive, you can simply remove it from the PC, but this is not a solution, because there is a high probability of losing unsaved data. There are ways around this problem.

How to fix device or resource busy?

The first is to close programs that may be using the file or one of the files on the removable media. If one of the video files is playing, you should close the player. And only after that try to perform operations again.

If you do not know what program is preventing you from performing an operation, you can find out very easily with the help of the lsof command. Just run it and sift only those entries that refer to the mount point of your media:

lsof | grep /media/sergiy/83AE-2346

You can also sift out the processes you need in the utility itself, use the +D option, this is even better because it will not show system services, but will only show the program that needs to be terminated:

lsof +D /media/sergiy/83AE-2346

This way you will see all the processes that use the files on our media and terminate them with the kill command. In our case, we need to terminate the totem player with PID 5616:

$ kill -TERM 5616

How to see which processes are using the file? Use the fuser command:

fuser -vm /home/sergiy/83AE-2346

You will see all the necessary information: the user on whose behalf the process is running will be displayed. In the same way, you can also close it:

If you closed all the programs, but it did not help, you can try to clear the system's file cache with a command like this:

sync && echo 2 > /proc/sys/vm/drop_caches

That's all for now.