How to unmount a filesystem in Linux without investigating why is it busy?

I want to do it in one command. It should handle applications using that filesystem, submounts, containers (lxc-execute -n qqq <command>) and all other things.

Just "unmount. No objections!". Special kernel patches or configuration is allowed.

Filesystem should be really unmounted, so umount -l is certainly not an option. For example, for cryptsetup remove (BTW how to forcibly cryptsetup remove? Update: cryptsetup luksSuspend, but you won't be able to cryptsetup luksResume if it is not LUKS).

How to make all filehandles on that filesystem invalid?

The only reliable way I know is mounting the filesystem through the FUSE (there is usually no problem to unmount FUSE thing because of I can just kill it's process).

P.S. Already know mount fuser, lsof | grep, cat /proc/*/mounts | grep and obsolete non-working "badfs patch".

Use the Magic SysRq key combo: Alt+SysRq+u

Note that you should probably do an emergency sync first: Alt+SysRq+s

Also note that on some (especially newer) keyboards, you have to use PrtSc rather than SysRq

  • The shift key is not necessary, just Alt+SysRq+key. Another thing worth mentioning (especially for laptop users) is that you can press Alt, press and release SysRq, then press and release the letter/digit and finally release Alt. Most importantly, this remount all filesystems as read-only, so it's a last-ditch thing before forcibly rebooting, not a general way of remounting filesystems read-only. – Gilles Aug 15 '10 at 8:00
  • @Gilles: thanks for the tip about the shift key. I've corrected my instructions. – sml Aug 16 '10 at 7:50
  • 1. It only remounts to read-only. It is not that wanted. For example, I want to unmount it and remount using FUSE. 2. Bad thing is that I need to "-o remount,rw" root filesystem and other ones after that to return to normal work. – Vi. Aug 27 '10 at 8:36

umount --force or umount -f (equivalent)

If that fails, then use:

umount --lazy or umount --l (equivalent)

The "lazy" option will "detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)" It might cause instability, but it will get the thing unmounted. Any programs using the drive may crash.

  • Of course --force does not work. And --lazy is not real unmount - it does not release LVM, loopback or cryptsetup things. – Vi. Mar 11 '14 at 14:44
umount -f

can be used to force an unmount when the filesystem is busy.

  • 1
    It has never worked for me: umount2: Device or resource busy The only partial success was when I experimented with badfs patch. – Vi. Aug 12 '10 at 11:23
  • I had the same "error" message, but it was working nonetheless. The filesystem was unmounted after the umount -f – IanH Aug 12 '10 at 11:37
  • 3
    Try "lazy umount", umount -l. It always umounts but could produce an unstable filesystem. – Jimmy Hedman Nov 5 '10 at 15:20
  • I think Jimmy's comment on this answer is actually the best option. It's true that a "lazy" unmount can cause instability, but it's assumed you're already in an unstable state if you need to force-umount the filesystem. To this end, why is '-l' not an option? – deesto Oct 14 '13 at 15:08
  • @deesto, Lazy unmount does not make the undelying block device (LVM volume, LUKS container, loopback) unreferenced. – Vi. Dec 25 '14 at 20:50

I'm afraid there's no way to do this on one command. umount -f really does not work as smoothly as one would hope. If there are submounts under some other mount, you cannot just unmount those mounts in some random order and hope they will go down.

But no worries, there's one way to make all this a one command: create a shell/Perl script which kills the wanted processes, unmounts containers, submounts and finally unmounts some other mount. Then you can just call your script on demand. Initially that's more work for you but after you get the script working, everything's a child's play. :)

  • 1
    These are cases when I cannot unmount even manually: 1. uninterruptible-sleep processes that cannot be resumed (crashed drivers etc.) 2. Failed storage (that also hangs each request to it). I want this "dirty unmount" to handle this. – Vi. Aug 12 '10 at 12:51

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.