How to Fix ‘umount: target is busy’ Error in Linux

Attempting to unmount a storage drive, external USB drive, network share (NFS/Samba), or secondary partition in the Linux terminal by running umount /mnt/data only to be blocked by the error message: “umount: /mnt/data: target is busy.” or “umount: /dev/sdb1: device is busy” halts system maintenance workflows. In the Linux Virtual File System (VFS) architecture, the kernel strictly protects data integrity by forbidding the unmounting of any filesystem that is actively referenced. If any running process holds an open file descriptor on the mount point, a daemon has its current working directory (CWD) set inside the target directory, a shared memory segment or swapfile is active, or an open shell terminal is sitting inside the folder path, the Linux kernel returns the EBUSY (Device or resource busy) error code to prevent filesystem corruption. This guide explains how to identify holding processes and unmount storage safely.

What Causes ‘umount: target is busy’?

The Linux kernel triggers the EBUSY protection lock under several scenarios:

  • Active Shell Working Directory: Your current terminal session (or another user’s logged-in session) is navigated inside the mounted path.
  • Open File Descriptors: An application (such as text editors, media players, database daemons, or backup utilities) holding an open read/write lock on a file.
  • Background Daemons and Services: System daemons (such as Samba, NFS, Apache, or Docker containers) indexing or sharing folders inside the mount.
  • Active Swap Space: A swapfile located on the target partition actively being utilized by the Linux memory management subsystem.
  • Nested Mount Points: Another filesystem mounted inside a sub-directory of the target directory.

Method 1: Check Current Working Directory and Exit

The most frequent cause of busy targets is surprisingly simple: your current shell session is located inside the mount point.

  1. Check your active working directory path:
    pwd
  2. If the output reveals you are inside the mount path (e.g., /mnt/usb or /media/drive/folder), change your directory back to your home folder:
    cd ~
  3. Attempt to unmount the filesystem again:
    sudo umount /mnt/usb

Method 2: Identify and Terminate Holding Processes Using fuser

The fuser utility identifies every process ID (PID) currently accessing files or directories on the target mount.

  1. List all processes actively holding locks on the mount point:
    fuser -mv /mnt/data
    • -m inspects the entire mounted filesystem.
    • -v provides verbose output displaying the PID, user, and access type (e.g., c for current directory, e for executable, f for open file).
  2. Inspect the output to determine which process is holding the device. For example:
                         USER        PID ACCESS COMMAND
    /mnt/data:           user1      4128 ..c..  bash
                         www-data   5309 ...f.  nginx
  3. Gracefully terminate or kill all processes accessing the filesystem:
    sudo fuser -k -TERM -m /mnt/data
    (If processes fail to terminate gracefully, replace -TERM with -KILL to forcefully terminate them).
  4. Unmount the drive cleanly:
    sudo umount /mnt/data

Method 3: Locate Open Files Using lsof

If fuser is not installed on your Linux distribution, lsof (list open files) provides granular diagnostic details.

  1. Execute lsof targeting the mount point:
    lsof +D /mnt/data
  2. Terminal outputs a list showing the command name, PID, user, file descriptor, and the exact filename currently held open.
  3. Manually terminate the offending PID:
    sudo kill -9 PID
  4. Proceed with unmounting.

Method 4: Perform a Lazy Unmount (umount -l)

When an unresponsive network share (NFS/Samba) or non-critical drive cannot be released immediately, lazy unmounting detaches the filesystem cleanly without hanging.

  1. Execute the lazy unmount command:
    sudo umount -l /mnt/data
  2. How lazy unmounting works: The -l (lazy) flag immediately detaches the filesystem from the directory hierarchy, making it invisible to new processes. The kernel then quietly cleans up all active references and closes file descriptors in the background once existing processes finish reading.
  3. Caution for external drives: Never physically disconnect a USB drive immediately after running umount -l. Wait for disk read/write activity LEDs to cease completely to prevent data corruption.

Linux umount Troubleshooting Matrix

Tool / Technique Command Best Use Case
Directory Check cd ~ && sudo umount /mnt Shell prompt currently inside mount path
fuser Inspection fuser -mv /mnt Quickly view all PIDs holding locks
fuser Kill sudo fuser -km /mnt Force-kill holding processes automatically
Lazy Unmount sudo umount -l /mnt Hung NFS/Samba network shares or stuck daemons

Terminating active file locks with fuser or employing a lazy unmount permanently resolves ‘target is busy’ errors in Linux.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.