How to kill a stuck linux mount

How can you remove a mounted USB stick or USB HDD from the list of mounted devices?

PROBLEM

We have all done it – in a hurry you unplug a USB drive which was mounted in your Linux system without properly unmounting it and then it sits there in your list of mounts and you can not remove it and the next time you plug a device in it will not be on /dev/sdb anymore but on sdc, etc., etc… in other words its a PITA 🙂

Usually in such cases you would see the following message if you try to unmount this device:

 andrew@systemv /mnt$ sudo umount /mnt/usb
  mount: /mnt/usb: device is busy.
  (In some cases useful info about processes that use
  the device is found by lsof(8) or fuser(1))

What can you do get rid of this stuck USB mount?

SOLUTION

Usually this command will do the trick:

 andrew@systemv /mnt$ sudo umount -lf /mnt/usb

Note that you have to use the mount point, not the device name for this to work! So this will NOT work:

 andrew@systemv /mnt$ sudo umount -lf  /dev/sdb1 

In some cases, when the above does not work and the umount command gets stuck the only thing you can do is reboot the system and sometimes even the shutdown process may fail! In which case your only last resourt is the “magic SysRq” console… read more about this here:

wikipedia.org/wiki/Magic_SysRq_key

Leave a Reply

Your email address will not be published. Required fields are marked *