Troubleshooting

Fix "target is busy" and "Device or resource busy" on Linux

Unmount a disk that reports target is busy, find which processes hold files open with lsof and fuser, and handle busy files, swap and LVM devices safely.

IntermediateLinux VPS3 min read

umount: /mnt/data: target is busy or Device or resource busy means some process is still using the filesystem or device. Linux refuses to unmount it to protect open files. The fix is to find and stop that process, not to force it.

Before you start

  • Root access.
  • Make sure you are not inside the mount yourself: a shell whose current directory is under the mount point keeps it busy. Run cd / first.

Find what is using the mount

fuser -vm /mnt/data

Lists processes with open files, current directories or memory-mapped files on that filesystem. Alternatively:

lsof +f -- /mnt/data

The output shows the command, PID, user and file. Common culprits: a shell in that directory, a running backup or rsync, a database whose data lives there, Docker containers with a bind mount, or an NFS/Samba server exporting the path.

Stop the processes

  • Stop services cleanly: systemctl stop mysql, docker compose down, and so on.
  • For leftover shells or scripts: kill PID, and only if necessary kill -9 PID.
  • fuser -km /mnt/data kills every process using the mount at once. Use it only when you are sure what will be killed.

Then unmount again:

umount /mnt/data

Lazy unmount as a last resort

umount -l /mnt/data

A lazy unmount detaches the mount point immediately and finishes cleanup when the last user closes its files. It is useful for hung network mounts, but processes still holding files keep writing to the old filesystem. Do not use it before removing a disk you care about.

Hung network mounts (NFS, CIFS)

If the remote server is gone, commands touching the mount freeze. Use:

umount -f -l /mnt/nfs

and consider the soft and timeo mount options or systemd automount to avoid it in future.

Other "busy" cases

SituationFix
Swap device or file in useswapoff /swapfile before removing or resizing
LVM volume busy when removingUnmount filesystems on it, then lvchange -an vg/lv
Device busy when formattingIt is mounted or used by LVM/RAID; check lsblk and dmsetup ls
Cannot delete a directory: busyIt is a mount point or in use; check findmnt and lsof
Text file busy when replacing a binaryThe program is running; stop it, or replace via a new file and rename

Check before removing a disk

  • findmnt /mnt/data shows nothing after unmounting.
  • Remove or comment out its line in /etc/fstab, or the next boot may hang waiting for it (use nofail for optional disks).

Busy device FAQ

Is it safe to force unmount?

Forcing can lose data being written. Stop the processes first; use lazy or forced unmounts only for dead network mounts.

Why does it say busy when nothing shows in lsof?

Kernel users such as swap, loop devices, bind mounts or exports hold it. Check swapon --show, losetup -a and findmnt.

Can a reboot fix it?

Yes, but stopping the specific process is faster and safer for running services.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.