How do I forcefully unmount a Linux disk partition?

Sometimes you try to unmount a disk partition or mounted CD/DVD disk or device, which is accessed by other users, then you will get an error umount: /xxx: device is busy. However, Linux or FreeBSD comes with the fuser command to kill forcefully mounted partition. For example, you can kill all processes accessing the file system mounted at /nas01 using the fuser command.

Understanding device error busy error

Linux / UNIX will not allow you to unmount a device that is busy. There are many reasons for this (such as program accessing partition or open file) , but the most important one is to prevent the data loss. Try the following command to find out what processes have activities on the device/partition. If your device name is /dev/sdb1, enter the following command as root user:
# lsof | grep '/dev/sda1'

vi 4453       vivek    3u      BLK        8,1                 8167 /dev/sda1

Above output tells that user vivek has a vi process running that is using /dev/sda1. All you have to do is stop vi process and run umount again. As soon as that program terminates its task, the device will no longer be busy and you can unmount it with the following command:
# umount /dev/sda1

How do I list the users on the file-system /nas01/?

Type the following command:
# fuser -u /nas01/
# fuser -u /var/www/

Sample outputs:

/var/www:             3781rc(root)  3782rc(nginx)  3783rc(nginx)  3784rc(nginx)  3785rc(nginx)  3786rc(nginx)  3787rc(nginx)  3788rc(nginx)  3789rc(nginx)  3790rc(nginx)  3791rc(nginx)  3792rc(nginx)  3793rc(nginx)  3794rc(nginx)  3795rc(nginx)  3796rc(nginx)  3797rc(nginx)  3798rc(nginx)  3800rc(nginx)  3801rc(nginx)  3802rc(nginx)  3803rc(nginx)  3804rc(nginx)  3805rc(nginx)  3807rc(nginx)  3808rc(nginx)  3809rc(nginx)  3810rc(nginx)  3811rc(nginx)  3812rc(nginx)  3813rc(nginx)  3815rc(nginx)  3816rc(nginx)  3817rc(nginx)

The following discussion allows you to unmout device and partition forcefully using mount or fuser Linux commands.

Linux fuser command to forcefully unmount a disk partition

Suppose you have /dev/sda1 mounted on /mnt directory then you can use fuser command as follows:

WARNING! These examples may result into data loss if not executed properly (see “Understanding device error busy error” for more information).

Type the command to unmount /mnt forcefully:
# fuser -km /mnt

  • -k : Kill processes accessing the file.
  • -m : Name specifies a file on a mounted file system or a block device that is mounted. In above example you are using /mnt

Linux umount command to unmount a disk partition.

You can also try the umount command with –l option on a Linux based system:
# umount -l /mnt

  • -l : Also known as Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. This option works with kernel version 2.4.11+ and above only.

If you would like to unmount a NFS mount point then try following command:
# umount -f /mnt

  • -f: Force unmount in case of an unreachable NFS system

Please note that using these commands or options can cause data loss for open files; programs which access files after the file system has been unmounted will get an error.

See also:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 10 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
10 comments… add one
  • Lukasz Jan 30, 2009 @ 13:40

    Very useful, thank you.

  • mohammed a.rahman Jun 20, 2009 @ 18:13


  • Anil Kumar Jena Apr 29, 2010 @ 20:30

    fuser -km {file / filesystem}
    If you have NFS mount file then it will now work.

  • Mark Nov 18, 2010 @ 22:28

    Sometimes fuser and lsof fail. One option that works for me is remounting read-only, and then doing a lazy unmount:

    mount -o ro,remount /dev/sdb3
    umount -l /dev/sdb3

  • Christian Feb 24, 2011 @ 8:57

    I have a cronjob that needs to mount an external hdd and then unmount after it backup to my external hdd.

    This is how my inside my cron.daily looks like:-

    system (“/etc/rc.d/init.d/sendmail stop”);
    system (“/usr/sbin/cmuExport -d”);
    system (“/etc/rc.d/init.d/sendmail start”);

    system (“mkdir /mnt/usbdisk”);
    system (“mount -t ext3 /dev/sdb1/mnt/usbdisk”);
    system (“/bin/tar -zcvf /home/cmu/localhost.tar.gz/home/cmu/localhost”);
    system (“mv /home/cmu/localhost.tar.gz/mnt/usbdisk”);
    system (“umount -l /dev/sdb1/mnt/usbdisk”);

    But it doesn’t unmount it. The error message says:-

    umount: /mnt/usbdisk: not mounted
    umount: /mnt/usbdisk: not mounted

    I need help, please thank you.

    • VItaly Mar 20, 2011 @ 20:44

      First: Why are you using perl script instead of bash script if all calls are system’s? You can just delete “system” before all of your strings and rename to At least this will be easier to debug.

      Second: You have an error in umount command. Here command you needed:
      “umount -l /dev/sdb1″.
      In fact your command must work for your /dev/sdb1. Error was coz system trying to find block device “/mnt/usbdisk”, but this is a mount point.

  • Zahid Haseeb Mar 19, 2012 @ 5:58

    @ nixcraft

    As you said
    # lsof | grep ‘/dev/sda1’

    what about if we have a cifs mounted partition ?

  • naildownx Aug 6, 2013 @ 19:15

    the fuser -km /mnt/SHARE command worked for me! Thanks!

  • Tim Macking Nov 6, 2013 @ 19:01

    This will work if you have NFS mount fuser -km {file / filesystem}

    Tim Macking

  • Gaurav Kumar Garg Mar 24, 2014 @ 7:32

    for forcefully unmounting use command

    umount -l /your_mount_path

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum