Linux : umount filesystem device or ressource busy workarounds

By | March 7, 2016

You probably had this output error while trying unmounting a drive/mount point on a Linux or Unix system :

Device or resource busy

Of course, you certainly need to make sure that no user or process are accessing this filesystem in any way. Even though you have taken every precaution, you still may have this issue.

1. Find out what is currently accessing the filesystem (this example will assume the filesystem will be /var/www) :

lsof | grep /var/www

Close any process issued by the command above and unmount it :

umount /var/www

CAUTION : The two steps mentioned below may lead to data loss or corruption, but only for the data being written by those involved process, it should not harm the data previously written on the filesystem. Anyway, always work with backups!

2. If you still experience issue or cannot gracefully close these process, you may kill those associated filesystem access processes :

fuser -km /var/www

You can now attempt to unmount it :

umount /var/www

3. Alternatively, you can try to force the unmount :

umount -f /var/www