Information and Links
Join the fray by commenting, tracking what others have to say, or linking to it from your blog.
Use fuser to diagnose umount issues
This morning I discovered that a drive on one of my machines was in read only mode. So I figured the easiest way to resolve the issue is to unmount the drive and re-mount it again. When I tried to umount the drive I got this error:
-
# umount /mnt/sdb
-
umount: /mnt/sdb: device is busy
A quick search on Google found me this article which was quite useful.
Basically using the fuser command in Linux we can see which user or pid is accessing files on parition. Usage is quite simple:
fuser -u /mnt/sdb will show me which users are currently using files on the partition.
/sbin/fuser -m /mnt/sdb
/mnt/sdb: 7638c
Using the -m flag, we can get the current pid using files. The 'c' in both cases signifies that this is the current directory of the user or pid.
In my case a Bash file was currently running on the parition I was trying to umount. Once it finished the drive unmounted with no problems.
Unfortunately, there is usually a reason that a drive drops into read only mode. This case was no different. I looked at dmesg from the command line to fine that my drive had some hardware failures and need replacing. Luckily I have lots of current back-ups!

