Linux Force Dismount

Multithreaded JavaScript has been published with O'Reilly!

I recently had some issues getting a drive to dismount in Debian. Then I discovered the fuser -mu tool, and was able to get the job done. This command will list the processes preventing the drive from dismounting, along with the user who spawned said processes. Simply run a kill command against the provided pid(s) and you'll be able to umount it.

$ sudo umount chelsey/
[sudo] password for tlhunter: 
umount: /storage/chelsey: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
tlhunter@titan:/storage$ fuser -mu chelsey/
/storage/chelsey:     2026rce(tlhunter)
tlhunter@titan:/storage$ kill 2026
tlhunter@titan:/storage$ sudo umount chelsey/

Good luck! You can also try the -l switch, which dismounts the drive as soon as its possible.

Tags: #linux
Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript and is an O'Reilly published author.