- Veeam Support Knowledge Base
- The process cannot access the file because it is being used by another process
The process cannot access the file because it is being used by another process
| KB ID: | 1960 |
| Product: | Veeam Backup & Replication |
| Published: | 2014-11-19 |
| Last Modified: | 2024-12-03 |
| Languages: | JP |
Cheers for trusting us with the spot in your mailbox!
Now you’re less likely to miss what’s been brewing in our knowledge base with this weekly digest
Oops! Something went wrong.
Please, try again later.
Challenge
A job or task fails with the error:
The process cannot access the file because it is being used by another process.
Indicating that a file is locked by another process/task. The console may indicate specifically what file is locked. Identification of the process that is locking the file(s) must take place.
Example:
Solution
Windows File Lock Investigation
There are many ways to track down which process is locking a file; see below for examples.
The methods described in this article should be performed on the machine where the locked file is located.
Resource Monitor
- Open Resource Monitor. (resmon.exe)
- Switch the CPU tab.
- Expand the Associated Handles section.
- In the Search Handles field, enter the locked file's name, and press Enter
- Review the Search Results
Process Explorer
Available from Microsoft: Process Explorer Download
- Run Process Explorer with Administrator privileges by right-clicking on the executable and selecting 'Run as administrator,' this will ensure that all handles and locks will be visible.
- In the menu bar, click Find and click Find Handle or DLL...
- In the Process Explorer Search window that appears, enter the locked file's name.
- Review the search results to determine which process is locking the file.
Linux File Lock Investigation
To determine file locks on a Linux repository, you can use various utilities. This section will focus on using lslocks, but keep in mind that there may be other distribution-specific tools and methods available. It's important to distinguish between locked and opened files, as a file can be locked without being actively opened. The lsof command, for example, only lists actively opened files.
- lslocks — Displays a list of active file locks. (Requires util-linux package)
- lsof — Displays a list of actively open files. Specifying a particular file will show active processes for that file.
lsof “/path/to/file”
Alternatively /proc/locks can be manually investigated using the following command:
sudo find -L /proc/*/fd -maxdepth 1 -print -exec readlink {} \;
Regardless of the method used, you must verify that the file is not actively being modified. File locks can come from various sources. For example, if a job is unexpectedly terminated due to a network drop, it is possible that the Veeam Agent finished but never received a terminate command. If the repository uses deduplication, the storage may have too aggressive of a profile active and is locking the file(s) as soon as Veeam releases a lock on them.
Once you have verified that the locked file is no longer being modified, it is safe to manually kill any process still maintaining a lock on the file. However, be cautious, as killing a process that is modifying a file may result in a corrupted file.
If this KB article did not resolve your issue or you need further assistance with Veeam software, please create a Veeam Support Case.
To submit feedback regarding this article, please click this link: Send Article Feedback
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.