Are you trying to unmount and getting this message? Typically, the cause of this is that something is trying to access data stored on the disk. In this post we will look at what this message means, and solutions so you can resolve the error message.
What Is The Umount Command
The umount command is used to unmount file systems that have been mounted to your system. For example, a flash drive, SD Card, or Hard Drive devices that store data need to be mounted and unmounted to access and safely disconnect the devices later on.
What Is The Error
When you attempt to unmount a file system, and the file system is correctly in use you may encounter this message stating “target is busy.” This message indicates that the file system you are attempting to unmount is currently in use, and therefore cannot be unmounted.
Solutions
These solutions are not the only options, but these are the options I would use if I encountered the error.
Current Working Directory
If you’re using a terminal make sure you are not in the directory you’re trying to unmount.What I mean by this is, that if you’re trying to unmount /media/user/disk the prompt looks like this:user@example:/media/user/disk$ umount /media/user/disk
See how that contains the path you’re trying to unmount, try to change the directory to a place outside that path, and try again.
Active Mounts
Do you have another file system mounted inside the mount point of the file system you’re trying to mount? If so you will need to unmount that first before trying again.You can check this by running the mount command and filtering for the mount point you are trying to umount.mount | grep path_to_mountpoint
Make sure you replace path_to_mountpoint with the actual path to the mount point.
Running processes Accessing Files
If there are any processes actively accessing files stored on that file system, that could be interfering with the umount process.To see what process is accessing files that are on the mounted device run the following lsof command:sudo lsof +D path_to_mountpoint
Make sure you replace path_to_mountpoint with the actual path to the mount point.Then you would want to kill processes accessing the files being called out. See posts on the kill command or the pkill commands to kill the process.⚠ Depending on the kill signal you send the process you may be forcibly killing the process, be aware that force killing a process could result in data loss.
Reboot
If all else fails or you would rather not kill the specific process you can always comment out the mount line in /etc/fstab and try rebooting. Please note that this will not work with the file systems containing the systems operating systems.
Conclusion
In this post, we touched on what the error message means and solutions to the error. From making sure you’re currently working directory isn’t in a path of the file system, to make sure there isn’t a mount mounted to a path on the file system you’re trying to umount, to processes access the file system, and lastly if the above fails you can always reboot. These are the steps I would typically take when faced with this error message. It should be noted that you may see other solutions besides these but may carry more risk of data loss or accomplish something simmular to the solutions above.
Looking For More?
Done reading and looking for more to read, why not check these posts?
- Other Posts On How To Solve Specific Error Messages
- The Mount Command
- How To Mount CIFS/SMB Shares On Linux
Embracing a lifelong passion for technology since childhood, CJ delved into the intricate workings of systems, captivated by the desire to understand the unknown. This innate curiosity led to his discovery of Linux, a revelation that resonated deeply. With more than 7 years of on the job experience, he’s honed his technical skills as a Geek and Senior Linux Systems Administrator.
Leave a Reply