The fuser command (or Let my drive go!!)

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

so type

fuser /mnt/data

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

type

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.

If you enjoyed this post, make sure you subscribe to my RSS feed!

Published by

LiamM

I'm a self labeled Nerd who enjoys Playing Video Games, restoring classic muscle cars (i have a 65' Mustang in the works) , Running Big Data Clusters, Tattoos, Working on System Automation, Riding and customizing Motorcycles, and writing python Code. I'm an SRE with DemonWare/Activision Specializing in Big Data/Hadoop operations but all opinions and views expressed on this site are solely my own.