How Do I Eject My USB Drive if the “Device Is Currently in Use”?

Retro

Founder
Staff Member
Joined
4 Jun 2021
Messages
6,257 (4.47/day)
Location
UK
Put your hand up 🙋‍♂️ if you've seen this annoying problem before and had no clear answer for it. That will be everyone, then. The only 100% safe way to do it is to shut down the PC, as in a controlled shutdown, not forcing it down with the power switch. However, there's still an instance when it's pretty safe to remove it without shutting down.

Leo explains exactly what's happening to cause this problem and when it's ok to take that small risk of data corruption. You'd think by the latest Windows 11, Microsoft would have finally fixed this problem, but nope, it's still there annoying the world. All it would need is a comprehensive dismount command, the thing it actually does when Windows does its controlled shutdown.

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 

Geffers

Linux enthusiast
Joined
1 Jul 2021
Messages
701 (0.51/day)
Location
NW London
In Linux you will get device busy if a window open.

wmctrl -l lists all windows opened by the windows manager so may make it easier to spot the culprit.
 

Astro What

Well-known member
Joined
6 Jun 2024
Messages
454 (1.50/day)
In Linux you will get device busy if a window open.

wmctrl -l lists all windows opened by the windows manager so may make it easier to spot the culprit.
only works by default if using a X window manager.
lsof +f -- /mountpoint
should work as long as you know the mountpoint of the USB device.
 

live627

Well-known member
Joined
12 Jul 2022
Messages
345 (0.35/day)
I ended up not using the "safely remove" function because the device was "busy" 70% of the time, and back in the day when I'd copy files to and from flash drives multiple times a day, this was enough to make me ignore it and just yank the drive. I got catastrophic data loss once where a reformat was in order, and so I eventually figured out that delayed writes are a thing, particularly on NTFS filesystems. I learned to only ever format flash drives in Fat32 and wait about ten seconds before pulling the drive.

EDIT: Just watched the video. Guess what I've never used? A portable hard drive.
 

Retro

Founder
Staff Member
Joined
4 Jun 2021
Messages
6,257 (4.47/day)
Location
UK
so I eventually figured out that delayed writes are a thing
You can improve your chances by turning off delayed writes. I've forgotten where that setting is now, but a quick Google should reveal it.
 
Back
Top Bottom