Saturday, March 24, 2007

Lazy unmounting

Abstract:
umount: /mnt: device is busy
umount -l /mnt

Unmounting
Sometimes a mount point can't be unmounted. Generally there is a user who's still using a file in the directory. In this case, lsof is your friend (lsof | grep /mnt)

But some cases are particularly bothering:
  • You may not want to kill the process which uses the given file
  • Maybe nobody is using the mount point, which means it is broken (this is often a samba or nfs broken pipe)
Then the -l option comes into play. umount -l allows a mountpoint to be disabled for everybody except for the processes currently using it. This means that no new or existing process can open a file on it. Only currently opened ones can be read, written and closed. It will realy be unmounted when no more blocker remains.

That's how you can do an unblocking umount.

No comments: