Rapid Recovery with the Volume Shadow Copy Service
At a Glance:
- Intro to Volume Shadow Copy Service in Windows Server 2003
- Configuration and management of the Volume Shadow Copy Service
- The Previous Versions Client in Windows XP Professional
- Disaster recovery plans
Volume Shadow Copy Service
Imagine this. You’re out early preparing your sailboat for a day on the water. The wind is steady and strong, chop is light, and your cooler is full of gourmet snacks.
Suddenly, you hear your CFO’s ring tone. Reluctantly you take the call.
"I really hate to call you on a Saturday, but I accidentally deleted the spreadsheet I was working on for the presentation to the board Monday. Is there anything you can do to help me? The year-end figures were all in there!"
After determining that he has made no backup copies of the spreadsheet, you consider your situation. Either:
- You haven’t implemented the Volume Shadow Copy Service on your Windows Server™ 2003 file and print server, so you grab your cooler and cover your boat; you’re going to the office.
- You have implemented the Windows Server 2003 Volume Shadow Copy Service and the Previous Versions Client, so you can be up and running and out on the water in about just five minutes.
Don’t think you can possibly recover your CFO’s file in under five minutes? Well, as you’ll see, the Windows Server 2003 Volume Shadow Copy Service maintains point-in-time copies that can be accessed by administrators and end users for rapid recovery. In this article, I will explain how to configure the Volume Shadow Copy Service for optimum performance and explore the Previous Versions Client for Windows® XP so you can discover how to integrate it and the Volume Shadow Copy Service with your overall disaster recovery plan.
How Does It Work?
The Windows Server 2003 Volume Shadow Copy Service uses free space on an NTFS volume or disk to create differential copies of files on your system. When enabled on a volume, the Volume Shadow Copy Service creates point-in-time copies, or snapshots, of that volume, tracking changes made to the volume between snapshots. You can restore a file to any available point-in-time copy, effectively ensuring the ability to recover previous versions of files on your system.
However, there are some limitations on recovering previous versions. The space made available for shadow copies affects the number of previous versions you can maintain. In addition, there is a hard limit of 64 previous versions allowed for each volume. This may not affect most users, but should be taken into account for files that change frequently.
There is much more to the Volume Shadow Copy Service than just the ability to restore files, though. It can work with Windows Backup and other backup tools to allow open file backup on an active server. It can also be used with storage area network (SAN) hardware to simplify backup and recovery of large open files and databases.
Setting It Up
The Volume Shadow Copy Service uses specific modules and third-party components to accomplish functionality. Among these tools are requestors, writers, and providers (see Figure 1). In the following section I’ll explain their roles.
Figure 1 Volume Shadow Architecture
Volume Shadow Copy Requestor A Volume Shadow Copy requestor is an application that makes requests for Volume Shadow Copy creation or that requests data from a shadow copy. This can be a backup and recovery application such as Windows Backup or a recovery tool such as the Previous Versions Client for Windows XP.
Volume Shadow Copy Writer A Volume Shadow Copy writer is an application or a part of an application that is responsible for preparing the application’s data for the shadow copy process. This may include deactivating the application momentarily to prepare the data for copying. It may flush log files, commit all database transactions, and perform other required tasks. Some writers even have the ability to create application-specific collections of data for rapid restoration in the event of an emergency.
Volume Shadow Copy Provider Volume Shadow Copy providers manage the actual creation of a shadow copy on disk. Providers may be software agents that track changes to data on disk, or hardware providers that can be used to perform such advanced functions as data mirroring. Note that Windows Server 2003 ships with its own software shadow copy provider that has the ability to track changes to data between snapshot intervals. This provider tracks changes made after a shadow copy to enable the user to revert the data back to the condition it was in at the time of the shadow copy.
The process used to create a Volume Shadow Copy may differ with various implementations. In this article I will discuss two scenarios; volume cloning (the creation of a complete copy of data on a volume) and copy-on-write (the process of tracking only the changes made to files after the creation of a snapshot).
Volume Cloning This process is often used by storage hardware to create a copy of data for tape backup programs. It creates an exact copy of the data on a volume and sets it aside. The backup application (the requestor) can read the mirror, recording its contents while the live data continues to be available to the system. This process simplifies the task of obtaining consistent backups of critical data.
During the process of volume cloning, the requestor notifies the Volume Shadow Copy Service that it requires a shadow copy. The service instructs any available writers to freeze their data. When the writers report that their data is ready, the service signals the provider to create a shadow copy. The provider creates an exact copy of the production data and reports the successful completion of the copy to the Volume Shadow Copy Service. The Volume Shadow Copy Service then signals the writers to thaw the production data, returning it to service. The service then notifies the requestor of the completion of the copy. The requestor reads the copy to complete the backup task. When the backup is completed, the requestor notifies the Volume Shadow Copy Service and the shadow copy is deleted.
Copy-on-Write In this process, the Volume Shadow Copy Service maintains a differential copy only of modified data. This uses less disk space than a clone and allows a shadow copy to be created quickly. Copy-on-write allows changes to be made to production data, but keeps a copy of any modified data. When the requestor reads the shadow copy, the shadow copy provider assembles the shadow copy by using the differences file to determine changes made to the production data and presents an image of the volume in its original state. This is the method used by the shadow copy provider included with Windows Server 2003.
The Volume Shadow Copy Service is used primarily to support disaster recovery operations. Whether this is the creation of a cloned disk image for backup purposes or the tracking of file changes to allow restoration of previous versions of files, the end result is the same: the simplification of backup and recovery procedures for users of Windows Server 2003.
Open File Backup Today’s e-mail and database applications such as Microsoft® Exchange Server 2003 and Microsoft SQL Server™ 2005 support round-the-clock operation of applications in datacenters around the world. Obtaining consistent backups of data on these systems has always been a challenge. Native Windows backup applications were not able to obtain backups of open files and therefore would require the e-mail or database application to be stopped. The period of time that systems are unavailable due to system backup is called a backup window. As databases continue to grow, the backup windows get larger. In an attempt to reduce the length of the backup windows, tools were created to allow databases to be backed up while open. These tools are proprietary, however, and the resulting backups must be restored using special procedures, usually involving the installation of the database application and the backup application.
The Volume Shadow Copy Service simplifies this by quickly creating a snapshot of the application data, allowing the application to return to processing transactions while the copy is used by the backup application. The snapshot process generally takes a few seconds and allows administrators to perform backup operations at any time without regard to the size of the backup window.
Shadow Copies for Shared Folders Another way to use the Volume Shadow Copy Service is for the protection of individual files. This is the principal focus of this article and will be covered in depth. Shadow Copies for Shared Folders uses copy-on-write shadow copies to create snapshots of data volumes that can be accessed by the Previous Versions Client for the purpose of restoring files to a previous condition. The Previous Versions Client can be operated by administrators and end users, making this an excellent way to reduce the resolution time for file replacements and repairs.
Configuring Shadow Copies for Shared Folders
Shadow Copies for Shared Folders is activated at the volume level. The volume to be enabled for shadow copies must use NTFS and can be saved either on a basic disk or a dynamic disk. Assigning a drive letter to the volume is optional; an NTFS volume with shadow copy enabled can be mounted as a folder on another NTFS volume.
You can configure the storage area for shadow copies to be located on the same disk as the protected volume or you can place it on any other NTFS volume on your system. This is important for performance; writing data to both the disk and the shadow copy would double activity on that disk and slow disk response. Using a separate disk allows the system to record shadow copy data on a disk that is not currently experiencing heavy write traffic.
The following shows how to configure Shadow Copies for Shared Folders:
- Right-click the volume in Disk Management (or the disk representing the volume in Windows Explorer) to open the Properties dialog for the volume you want to configure.
- Choose the Shadow Copies tab to access shadow copy configuration settings. You will notice that all eligible volumes are displayed (see Figure 2). Note that settings for volumes not using drive letters cannot be accessed in Windows Explorer; use the Disk Management snap-in (diskmgmt.msc) to access the properties for these volumes.
- Select the volume you want to configure and click Settings (see Figure 3). Choose the storage area for shadow copies, the size of the storage area to be dedicated to shadow copies, and the schedule for shadow copies. Click OK to return to the Shadow Copies dialog.
- Click Enable to activate shadow copies on the selected volume. The system will immediately create a shadow copy and will then create additional shadow copies at the scheduled intervals.
- Click OK to close the volume’s Properties dialog box.
Figure 2 Configure Shadow Copies
Figure 3 Configure Volume
Storage Area Sizing Requirements
The size of the storage area that you choose will determine how many versions of changed files you can store. Each time a snapshot is created, all volume changes will be recorded. Up to 64 versions of a volume can exist unless the shadow copy storage area runs out of space. When this happens, the oldest shadow copies are overwritten by new shadow copies.
The types of files stored in the volume will also affect the amount of storage used for each shadow copy. Some applications make small changes to their files when saving the file; others rewrite the entire file, using more space on the shadow copy. You can view the amount of space used by shadow copies in the Used column of the Shadow Copies tab for the volume or by using performance counters supplied with the Windows Server 2003 Resource Kit (see the link included in the conclusion of this article).
There is no hard and fast rule governing the size of a shadow copy storage area. It will depend on many factors such as the amount of activity on the data volume, the size of the data files, and the frequency of shadow copies. Begin with as much space as you can reasonably afford and monitor the shadow volume size and number of recorded shadow copies to ensure that you have adequate protection for your users.
Shadow Copy Schedule
The default schedule for shadow copies is 7:00 A.M. and 12:00 P.M. This ensures a snapshot of your data at the beginning of day and at lunch time. Users who have damaged or deleted a file during either the morning or the afternoon will have access to a copy no more than five hours old.
Figure 4 Increasing Stored Copies
You can change or extend the basic schedule by scheduling more frequent shadow copies or copies that better align with your unique workflow. Keep in mind that making more frequent shadow copies will increase the storage requirements of the shadow volume (see Figure 4). Likewise, if you want to increase the amount of time that shadow copies are available (the length of copy retention), you will also need to increase the amount of storage available for shadow copies. You will ultimately have to find a balance between storage requirements, retention requirements, and copy frequency.
Managing Shadow Copy for Shared Folders
Once shadow copies have been enabled, there is typically very little that you need to do to ensure proper operation of this service. Maintaining sufficient free space, taking manual snapshots, and restoring files are the most frequent management tasks you will perform.
Manage Free Space Maintain enough free space to contain the configured size of the shadow copy storage area. If disk free space falls below the minimum amount, older shadow copies will be sacrificed to allow disk operations to continue. Space from the storage area will continue to be allocated to data storage until the shadow copy area is at the minimum size required to sustain the service (300MB).
Create a Manual Shadow Copy To create a manual shadow copy, click the Create Now button on the Shadow Copies tab of the volume’s Properties dialog. The manual shadow copy will be taken and will appear in the list of available shadow copies.
An administrator on Windows Server 2003 can use the Revert button on the Shadow Copies tab of the volume’s Properties dialog to restore a shadow copy. This process will restore all files back to their snapshot condition. Since it restores an entire shadow copy, revert is not used in the recovery of a single file. I’ll discuss the Previous Versions Client next. But before you read that section, refer to the sidebar "Command-Line Management
" for an explanation of the command-line options for managing Volume Shadow Copy.
Previous Versions Client
To restore a single file, use the Previous Versions Client included with Windows Server 2003. This utility is also included in Windows XP SP2; it can be installed on a pre-SP2 system from the Windows\System32\clients\twclient folder on a Windows Server 2003 system.
The Previous Versions Client extends Windows Explorer to enable the ability for an end user to find and restore single files from shadow copies.
As stated previously, if you are running Windows XP SP2 or Windows Server 2003, you can restore files immediately. If you are running a version of Windows XP before SP2 or Windows 2000, you will need to install the Previous Versions Client manually. It is located both on the Windows Server 2003 Product CD and in the Windows\System32\clients\twclient folder on a Windows Server 2003 system. Installation is straightforward with no options to choose or paths to configure. For users of Windows 2000, the Previous Versions Client can be found at
MShadow Copy Client: Accessing Shadow Copies on Windows Server 2003
Getting Previous Versions
Once installed, the Previous Versions Client can be used to restore files. To restore an earlier version of a file, you first need to locate the shared folder where the file is stored. To restore a file on the local system, specify the path to the folder rather than browsing the local disks. This is because the Previous Versions Client requires a CIFS connection to the share and will not work when directly accessing the file system. Next, right-click the file and select Properties. Then choose the Previous Versions tab (see Figure 5). Finally, choose the version you want and click Restore.
Figure 5 Restore a Single File
To restore a deleted file simply locate the shared folder where the file is stored, right-click an empty part of the folder view and select Properties, and choose the Previous Versions tab (as shown in Figure 6). Next, choose the version you want to restore and click View. A folder containing files eligible for restoration will be displayed. Note that if you choose Restore, you will restore all files in the folder to their shadow copy condition. Finally, copy the file you want to restore into its original folder.
Figure 6 Restore a Deleted File
The Volume Shadow Copy Service is not a panacea; shadow copy can be an indispensable part of your plan, but should never be relied upon exclusively for recovery from anything really serious, such as a disk failure.
Be sure to plan and execute a full backup and recovery strategy in order to protect your data against disk failures, storm damage, fires, and other events that can destroy your hardware. Store tapes in a safe location, preferably with copies located off-site, to ensure that your business can quickly recover from disaster. If you operate large databases or e-mail servers, consider third-party disk backup solutions that can enable online backups of your critical data without impacting your ability to serve your customers. Many solutions are available now that allow you to shrink your backup windows to zero while still storing complete sets of recovery information.
You should also take the time to explore the other tools that help to manage the Volume Shadow Copy Service. Two such tools, Volperf.exe and Volrest.exe, are included in the
Windows Server Resource Kit Tools
Happy copying and I hope that you enjoy your days off!Dave Field, MCSE, is the Systems Engineer for a theme park and an author of several computer books and articles. His most recent books include Fire the Phone Company—A Handy Guide to Voice over IP (Peachpit Press, 2005) and How to Do Everything With Windows XP Home Networking (McGraw-Hill/Osborne, 2004).© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited