"Target is Busy" / "Device or Resource Busy" When Unmounting

Something is using the mount: a process with open files, a shell cd'd into it, or a container with a bind mount. Find the holder with one command, close it, and the umount just works.

What you'll see

Root causes

Processes with open files or CWD inside the mount

lsof +f -- /mnt/x or fuser -vm /mnt/x lists them. Editors, tail -f, and shells cd'd in are the usual suspects.

Docker bind mounts or another nested mount

findmnt -R /mnt/x reveals submounts (including container bind mounts); docker ps with volume mounts pinning the path will block umount.

Fix it

  1. List exactly what holds the mount
    lsof +f -- /mnt/x 2>/dev/null || sudo fuser -vm /mnt/x   # shows PIDs and users
  2. Stop the holders cleanly
    # close editors, cd out of the dir, stop the service: docker stop <ct> ; systemctl stop <svc>
  3. Check for nested mounts under it
    findmnt -R /mnt/x   # unmount child mounts first (bottom-up)
  4. Last resort: force-lazy unmount detaches NOW (open files keep the device busy underneath)
    sudo umount -l /mnt/x   # data is not at risk, but open handles persist until processes exit

Field note

umount -l is not a 'kill the processes' — the device stays pinned until the last fd closes; it just frees the path. Loop mounts (ISOs/images): losetup -a shows which loop device; umount the loop, then losetup -d.

Common questions

Is umount -f or -l dangerous?

-l detaches the mountpoint but leaves open files on the device (safe-ish, until they close). True danger is force-umounting NFS with -f mid-write — data can be lost. Find the holders and stop them properly first.

Why can't I even see what's using it?

NFS hangs block lsof itself. Use umount -l to detach the path, then process the stragglers. For recurring pinning, audit docker volumes and service WorkingDirectory settings.

Ship it right the first time

Our most-documented failures, packaged as ready-to-ship starter kits: Docker, Kubernetes, and Terraform.

Browse the template store →

One-time. Yours to modify. Instant download from the NinjaOps template store.

Get new fixes by email

One short email when new fixes and production templates drop. No spam, unsubscribe anytime.

Partner pick — sponsored

Vultr — our lab-environment pick for this stack

Spin up a cloud server in 60 seconds and reproduce this fix yourself — pay by the hour.

Get Vultr →
Also vetted

Sentry — Free tier: see the exact line of code that broke, before users report it.

Get Sentry →

We earn a commission if you buy through our links — it never costs you extra. More vetted tools on our picks hub · comparing clouds? DigitalOcean vs Vultr and vs AWS · full deals: DigitalOcean · Vultr · NordLayer · Semrush