Unable To Lock Device. Make Sure You Do Not Have Open Files On This Device And Try Again [upd] -
Logging off your user account closes nearly all processes running under your profile, releasing most locks. After logging back in, immediately try to eject or format the device before opening any other programs.
In the world of data management, "locking" is a safety feature. When a file on a hard drive or USB stick is in use—being read, written to, or modified—the operating system places a "lock" on that file or the entire file system. This prevents other processes from simultaneously trying to modify the same data, which could result in corruption.
systemctl stop udisks2 systemctl stop autofs Logging off your user account closes nearly all
Check the "Background processes" section for or "Search Indexer" activities that look like they are accessing your external disk. Method 2: Identify the "Holding" App with Resource Monitor
The error "Unable to lock device" is essentially the operating system saying: "I tried to secure the device for ejection, but something else is currently holding the handle. If I let you pull this drive out now, that 'something else' might crash, or your data might corrupt." When a file on a hard drive or
: Open File Explorer windows or command prompts set to that drive letter can prevent a lock. HDD GURU FORUMS How to Fix It Close All Applications
If you are seeing the error "unable to lock device. make sure you do not have open files on this device and try again," you are likely dealing with a drive that is being held "hostage" by a background process. Method 2: Identify the "Holding" App with Resource
Windows Fast Startup (enabled by default) hibernates the kernel and drivers. This can cause external drives to remain locked after shutdown.
When you try to eject or unmount a device, the operating system attempts to perform a "soft lock" or a final synchronization. It wants to ensure all write operations are finished (flushing the cache) and that no new operations can start while the device is being logically disconnected.
lsof /dev/sdb reveals a stale NFS lock or a process like gvfsd-trash holding the device.
