VSS: Back up open (locked) files Outlook (*.pst), and etc. with the Volume Shadow Copy support.

The problem of backing up open files

If you have previously encountered the problem of copying busy files that are currently being used by another application, then this article is for you.

There are so-called exclusive locks of files, which are not available even for reading by other applications.

Examples of open files:


For example, MS Outlook stores all of your information such as email, calendars, contacts, tasks, and notes in the *.pst file like:
"C:\Users\%username%\Documents\Outlook Files\yourname@domain.com.pst"
or
"C:\Users\%username%\AppData\Local\Microsoft\Outlook\yourname@domain.com.pst",
depending your settings in the "File -> Account Settings -> Data Files" menu.

If Microsoft Outlook is open, you cannot access .PST file even for read-only to back up the file. If you try to copy the file to another folder you will receive the following error message:

The process cannot access the file because it is being used by another process.

Or

File in Use. The action can't be completed because the file is open in Microsoft Outlook.

Or the error text may look a little different:

0x80070021: The process cannot access the file because another process has locked a portion of the file (Access denied).

The process can not access the file (it is being used by another process)
Figure. Error message when copying the file because it is locked by another process

Solution for backing up open (locked) files

There are 2 ways:

  1. Before copying files, close the program that uses these files. For example, you can kill the MS Outlook process (End task) using the command: taskkill /im outlook.exe /f
  2. Use VSS (Volume Shadow Copy) to "hot" copy open files (copy blocked files).

The first way is too hard and not always possible, because sometimes task cancellation (kill process) in the Task Manager requires elevated privileges. In addition, data integrity is not guaranteed, because during process unloading from memory this process can write to disk and then the file will remain corrupted (damaged).

The second way is more humane, because it uses the VSS - Shadow Copy technology from Microsoft and guarantees the integrity of the data on the disk.

Below we will show a way of hot backup of files that are used by another application.

What is hot or shadow copying?

Volume Shadow Copy (VSS backup) is a Microsoft technology that allows you to copy files that are being used by another application. This copying is possible thanks to the creation of an instant snapshot of the file system, while the file system continues to work normally without any locks. Thus, copying file is possible without interrupting the work of current applications. Volume Shadow Service runs in the background and accesses data on the disk, even if the file is currently being used by another application. The integrity of the data is not violated.

NOTE! The Volume Shadow Copy technology applies to the entire disk, not to individual files on the disk, so you can not create a shadow copy of any single file. However, you can first create a shadow copy of the entire volume, then mount it in the system as a logical drive, for example, Z:\ and then selectively copy the files you need from that drive (shadow copy).

Where shadow copies stored are and how much disk space do they take?

Shadow copies of a volume are usually stored in the "System Volume Information" hidden system folder located in the root of each disk. The size of one shadow copy is approximately 100-300 MB, which is much less than the total amount of data stored on the disk. Disk space for storing shadow copies on the disk is allocated by the system in advance and you do not need to worry about it.

Shadow copying of files in Exiland Backup Professional

Starting from version 4.9 of Exiland Backup, the backup of open/locked files, such as MS Outlook (*.pst,*.ost), MS Access (*.mdb), SQL Server (* .mdf) and others, using VSS (Volume Shadow Copy), is fully automated. If you do not have a deep knowledge of the operating system or you just want to save time, use Exiland Backup.

The algorithm of hot backing up of files in Exiland Backup is quite simple:

  1. First, the program creates a temporary shadow copy of the volume (a snapshot of the file system) from which you want to copy the files.
  2. Then, the shadow copy created is mounted as a logical drive in the operating system.
  3. The program copies the selected files from the mounted drive (shadow copy) to the destination folder.
  4. The program deletes the temporary shadow copy of the volume.

How to set up Outlook file backup (*.pst, *.ost) without closing Microsoft Outlook

When you create a backup job, you specify the source files and folders. If you know that the source files can be used by another application during the backup, then set the option "[x] Enable VSS (Volume Shadow Copy) for disk", as shown in the screenshot below. If the source data is located on several disks, the program will offer the creation of shadow copies for several volumes in turn.

Configure shadow copy to back up open files

Creating a shadow copy of the volume and copying locked files

During the execution of the backup job, the log will show you that the program first creates a temporary shadow copy of drive C, then copies the files from the shadow copy, and deletes the previously created shadow copy after the job is done. An example of the job execution log is shown below.

VSS Backup: executing a backup job for the locked files using a shadow copy

You can download and try out the demo version of Exiland Backup Professional on the download page.