#1 Global Leader in Data Resilience

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
mailbox
Get weekly article updates
By subscribing, you are agreeing to have your personal information managed in accordance with the terms of Veeam's Privacy Notice.

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

error icon

Oops! Something went wrong.

Please, try again later.

Antivirus Interference
Antivirus software can cause access issues similar to those documented in this article. Such interference often occurs when security software detects a Veeam process attempting to access a file and simultaneously locks the file for inspection, coinciding with the Veeam process's attempt to lock it. This interference is frequently short-lived, resulting in the antivirus software not being detected using the methods outlined in this article. However, it may be possible to track this interference using tools like Process Monitor to observe file activities within a specific folder. Ultimately, mitigating the impact of antivirus or security software boils down to creating AV exclusions to prevent such interference.

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:

File in use example
Example of how this error appeared in all versions prior to Veeam Backup & Replication 12.
Starting in Veeam Backup & Replication 12, the error message will now include details about the locking process, when possible.
v12 win repo
As shown, the improved error message includes the exact process name and process ID.
In this example, diskspd was used to intentionally lock the VBK file to cause this error to occur.

Solution

NAS Involvement
While a process on a NAS can lock a file, due to the way some NAS devices may restrict terminal access, it can be challenging to identify if any processes on the NAS itself are locking files. If a reboot of the NAS does not resolve the lock, it may be necessary to involve the storage vendor.

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

  1. Open Resource Monitor. (resmon.exe)
  2. Switch the CPU tab.
  3. Expand the Associated Handles section.
  4. In the Search Handles field, enter the locked file's name, and press Enter
  5. Review the Search Results
Resource Monitor Handle Search
In this example, diskspd was used to intentionally lock the file to force the error to occur within Veeam Backup & Replication. While this is an unlikely real-world scenario, this is only meant to demonstrate utilizing the Associated Handles search function.

Process Explorer

Available from Microsoft: Process Explorer Download

  1. 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.
  2. In the menu bar, click Find and click Find Handle or DLL...
procexplorefind
  1. In the Process Explorer Search window that appears, enter the locked file's name.
  2. Review the search results to determine which process is locking the file.
Process Explorer Search
In this example, diskspd was used to intentionally lock the file to force the error to occur within Veeam Backup & Replication. While this is an unlikely real-world scenario, this is only meant to demonstrate utilizing the Process Explorer Search function.

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.

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.

Spelling error in text

This site is protected by hCaptcha and its Privacy Policy and Terms of Service apply except as noted in our Privacy Policy.
Thank you!

Thank you!

Your feedback has been received and will be reviewed.

Oops! Something went wrong.

Please, try again later.

You have selected too large block!

Please try select less.

KB Feedback/Suggestion

This form is only for KB Feedback/Suggestions, if you need help with the software open a support case

By submitting, you are agreeing to have your personal information managed in accordance with the terms of Veeam's Privacy Notice.
This site is protected by hCaptcha and its Privacy Policy and Terms of Service apply except as noted in our Privacy Policy.
Verify your email to continue your product download
We've sent a verification code to:
  • Incorrect verification code. Please try again.
An email with a verification code was just sent to
Didn't receive the code? Click to resend in sec
Didn't receive the code? Click to resend
Thank you!

Thank you!

Your feedback has been received and will be reviewed.

error icon

Oops! Something went wrong.

Please, try again later.