Today I was having some troubles. I was trying to unmount a drive on my Linux server but I kept getting the
umount: /mnt/data: device is busy
message back. Well this means that some process is using a file on that drive. fuser to the rescue. I’ll take you through the steps I used to unlock this drive below.
The first thing we can do is find out what processes are using that drive
This will return a list of the process ID’s that are using this device
/mnt/data: 3489 10264 25560
each set of numbers is a different process and may be followed by a letter to denote why that process is locking the drive
to find out what those process ID’s are you can use grep and ps
ps aux |grep processid
replace “processid” with one of the numbers from the fuser command above and you’ll get the name of the process locking that drive.
Now if we deem none of these processes necessary then we’ll want to kill them so we can unmount our drive. To do that we add the -k switch to fuser
fuser -k /mnt/data
And just like that our drive is unlocked and we can unmount it again. You can also use this on your DVD or CD Drive if it won’t let you eject the disk.
As always if you have any questions, comments or suggestions please post them in the comment section below.