Skip to content
Device or resource busy

Device or resource busy

DodaTech 3 min read

The Device or resource busy error means a file, directory, or mount point is currently in use by one or more processes. Linux prevents operations like unmounting, deleting, or modifying resources that are actively open.

What It Means

When you try to unmount a filesystem, delete a file, or modify a device, the kernel checks if any process holds a reference to it. If a process has the resource open (even in the background), Linux blocks the operation and reports the resource as busy.

Why It Happens

  • You’re trying to unmount a filesystem while a terminal is open inside it.
  • A file is open by a text editor, database, or server process.
  • A daemon is using a device file (e.g., a webcam or sound card).
  • NFS or Samba shares are mounted and a client holds an open handle.
  • A loop device is attached to a disk image you’re trying to detach.

How to Fix It

1. Find which processes are using the resource

lsof /path/to/file
fuser -v /mountpoint

lsof lists open files. fuser shows processes using a file or directory. Both need the exact path.

2. Kill the process using the file

# Get the PID from lsof output, then:
kill -9 PID

# Or use fuser to kill directly:
fuser -k /path/to/file

Use kill -9 as a last resort — it doesn’t let the process clean up. Try kill PID first.

3. Close terminal sessions in the mount

If the mount point is your current directory in another terminal:

# In the other terminal:
cd /

# Now unmount should work
sudo umount /mountpoint

4. Lazy unmount (force detach)

sudo umount -l /mountpoint

umount -l detaches the filesystem immediately and cleans up once all handles close. Use this when a normal unmount keeps failing but you need to proceed.

5. Detach a loop device

sudo losetup -d /dev/loop0

List attached loop devices with losetup -a first to find the right one.

6. Restart the service using the resource

sudo systemctl restart nginx
sudo systemctl restart docker

If a service holds the resource, restarting it releases the handles.

How is Device or resource busy different from Permission denied?
Permission denied means you lack access rights — the resource is available but locked to your user. Device busy means the resource is in active use by a process — you can’t touch it until that process releases it.
Can I see what's holding a USB drive before unmounting?
Yes. Run lsof /media/usb or fuser -v /media/usb. If nothing shows, check if a shell has the mount as its working directory with lsof +D /media/usb.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro