Skip to content
ohsudo, Home
Linux

"umount: target is busy": find what holds the filesystem, and when umount -l is safe

Fix "umount: target is busy" on Linux: find the process with lsof or fuser, leave the folder, stop services, handle NFS and bind mounts, and know when umount -l is safe.

Beginner4 min readApplies to Ubuntu · Debian · RHEL / Rocky / AlmaLinux · ext4 · XFS · NFS

by OhSudo ··

Checked on real software: Linux · November 2026How we check

$ sudo umount /data
umount: /data: target is busy.

Something is using that filesystem: a process has a file open there, or has its current directory there. Linux refuses to unmount it, as that could lose data. So the question is who’s holding it, and very often the answer is you.

  1. A processoften your own shell, cd'd into it
  2. /dataa file or directory in use(breaks here)
  3. umount /datatarget is busy
A process has a file open there, or has its current directory there, and Linux won't unmount it from under it. Very often that process is your own shell.

TL;DR

Terminal window
pwd
cd ~
sudo umount /data

If that wasn’t it:

Terminal window
sudo lsof +f -- /data
sudo fuser -vm /data

Then stop what they show, and try again.

1. Check your own shell first

A terminal whose current directory is inside /data keeps it busy, and it’s the most common cause. Try it in the terminal, which starts in just that situation:

Terminal window
pwd
cd ~
sudo umount /data

Remember your other windows too: another terminal or tmux pane, an editor, or a file manager showing that folder.

2. Find the process

Terminal window
sudo lsof +f -- /data
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
rsync 2143 root cwd DIR 8,17 4096 2 /data
python3 2288 app 3w REG 8,17 841234 13 /data/logs/app.log

FD tells you how it’s held: cwd is a current directory, a number like 3w is an open file, and txt is a program running from there. If you can’t use lsof, fuser also works, and it’s usually installed with the psmisc package:

Terminal window
sudo fuser -vm /data
USER PID ACCESS COMMAND
/data: root kernel mount /data
root 2143 ..c.. rsync
app 2288 F.... python3

-m means “anything on this filesystem”, and that kernel line is normal: it’s the mount itself. In ACCESS, c is a current directory, F is a file open for writing, f for reading, and e is a running program.

3. Stop it

A service? Stop it properly, as kill won’t do, because systemd may restart it:

Terminal window
sudo systemctl status 2288
sudo systemctl stop myapp

A plain process? Ask it to exit:

Terminal window
sudo kill 2143

fuser can do this for every process at once, after showing you who they are. Check the list first, as this ends everything on the filesystem:

Terminal window
sudo fuser -kvm /data

Then unmount:

Terminal window
sudo umount /data

Also check for services you might not think of, such as Docker with its data or volumes there, PostgreSQL, swap files (swapon --show, and then sudo swapoff /data/swapfile), or an indexer or antivirus scanning it.

4. lsof shows nothing

It’s still busy, and no process holds it. Here’s what’s left:

Something’s mounted inside it. Unmount those first, deepest first:

Terminal window
findmnt -R /data
TARGET SOURCE FSTYPE
/data /dev/sdb1 ext4
└─/data/backups /dev/sdc1 ext4
Terminal window
sudo umount /data/backups
sudo umount /data

sudo umount -R /data does this for the whole tree.

A bind mount or another namespace. A container’s mount can keep it alive, and it’s invisible from the host’s lsof. Find them with:

Terminal window
sudo grep -l '/data' /proc/*/mountinfo 2>/dev/null
findmnt -o TARGET,SOURCE | grep data

The number in each path is a process ID. Often it’s a container: docker ps, then stop that one. On Kubernetes, it can be a pod that still uses the volume.

LVM, RAID or encryption on top. Those hold the device rather than the mount:

Terminal window
lsblk

5. NFS: when the server’s gone

If the NFS server has disappeared, umount may hang or report busy, and lsof itself can hang. Try these, in order:

Terminal window
sudo umount -f /mnt/share # force: for NFS, gives up on the unreachable server
sudo umount -l /mnt/share # lazy: see below

lsof -b avoids blocking on it. Mount with soft, or at least with _netdev and x-systemd.automount in /etc/fstab, so that a missing server doesn’t stall your machine at boot.

6. umount -l: lazy unmount

Terminal window
sudo umount -l /data

It removes the mount from view right away, and really finishes when the last process lets go. It’s not a way to skip finding the cause:

  • Programs keep writing to the disk through files they already have open.
  • The device can’t be safely unplugged or checked. It isn’t released yet, and fsck on it can corrupt data.
  • A new mount on the same folder can hide that it’s still in use.

It’s reasonable for a dead NFS server, or to get out of the way before a reboot. It’s the wrong way to prepare for fsck or for removing a disk.

umount -f is not a stronger version for local disks. On ext4 or XFS, it generally does nothing more, and still reports busy.

7. Then check it worked

Terminal window
findmnt /data

No output means it’s unmounted. For something that should stay that way, comment out its line in /etc/fstab, or the next boot mounts it again, or fails if the disk’s gone. To remount from fstab, use sudo mount /data. If you were unmounting to repair it after an error, see read-only file system.

Warning

Don’t pull a disk or detach a cloud volume while it’s busy, even if a lazy unmount made it look free. Data still in the cache is lost, and you may end up with a damaged filesystem. Stop the processes, unmount, then run sync and detach.

Shell, we have a problem!

Similar, but different: umount: /data: not mounted means nothing’s mounted there, so check findmnt. umount: /data: must be superuser means you forgot sudo. For problems mounting it again, see wrong fs type, bad option, bad superblock. Device or resource busy from rm or mv means the same thing, about a folder that’s a mount point. And a full disk is no space left on device: a deleted file a process still holds open keeps using space, and lsof +L1 finds it.

$ ./practice.sh

Practice this in the terminal

Open the Terminal Playground with this article’s scenario loaded. It is safe and runs in your browser.

Open the terminal →

Found this useful? Share it.

Found a mistake? Let us know at contact@ohsudo.com.

Tools

Try it yourself

Articles

Related articles