Volume Shadow Copy Service lets users restore, recover files

Admin dream: Users restoring their own files. And if you have some disk space to spare, you can enable this capability directly in Windows Server 2003 through the Volume Shadow Copy Service (VSS).

One of the most frustrating jobs for your typical overworked network administrator is restoring files that users...

have accidentally modified or deleted.

When a user needs a file restored, the request is always urgent. So you have to stop what you're doing and find the right tape so you can restore the file.

But suppose users could restore their own files? Several products will let users restore their own files, but if you have some disk space to spare, you can enable this capability directly through Windows Server 2003 without having to buy anything extra.

What makes this possible is the Volume Shadow Copy Service (VSS). VSS can be a huge timesaver for administrators. The key is understanding what it does. VSS performs two important functions.

  • It allows users to restore their own files without you, the admin, having to put a tape in the drive or giving anyone permission to use your backup software.
  • In some cases, it makes it possible for your backup software to back up open files. (Discussing the backing up of open files is beyond the scope of this article. However, most of the newer backup applications are designed to support VSS. Prior to the creation of VSS, backup applications typically skipped files that were open.)

Enabling VSS is simple. To do so:

  1. Go to the server you want to enable VSS on, and open My Computer.
  2. Right-click on the volume you want to enable VSS on.
  3. Select the Properties command from the resulting shortcut menu. Windows will now display the volumes properties sheet.
  4. Select the properties sheet's Shadow Copies tab, as shown below.

  5. Click the Enable button. A warning message will tell you that VSS will use the default schedule (which I'll discuss further down in the article). For now, just click Yes to go ahead and enable shadow copy for the selected volume.

VSS is now enabled for the selected volume. But before I show you how to fine-tune VSS, you need to know a little more about how VSS works.

As we just saw, Windows displays a message that VSS will use the default schedule. The default schedule creates a shadow copy every morning at 7 a.m. Note, however, a shadow copy is not a backup.

Shadow copy backups

When Windows creates the 7 a.m. shadow copy, it is actually recording the state of the volume at that moment in time. Shadow copy backups of files are not actually made until the file is modified.

For example, suppose the shadow copy occurred at 7 a.m. A user who accidentally deletes a file at 8 a.m. could not use VSS to recover the file, because VSS has not actually made a backup of the file.

However, if the user were to modify the file at 8 a.m., VSS would create a backup of the file as it existed at 7 a.m., prior to allowing the modified version to be saved. If the user were to decide that their modifications were a mistake, they could easily revert back to the 7 a.m. version of the file.

So if the user were to make another change to the file at 10 a.m., the VSS service should save the 8 a.m. version, right? Not exactly. For VSS to create a backup of a file, two things have to happen.

  • Windows has to take a snapshot of the volume.
  • A file on the protected volume has to be modified.

If we stick with our example of a snapshot being taken at 7 a.m., and the file in question being modified at 8 a.m., then, as far as VSS is concerned, its job is done (at least for that file).

This is where the schedule comes into play. If VSS only makes one shadow copy per day, then VSS will make at most one backup of each file on the protected volume. I say at most because if the file does not change, no backup will be made of the file. That is why I recommend performing multiple shadow copies throughout the day (if possible).

Note the Settings button in the above screen shot. Clicking this button would take you to the screen shown below. This screen allows you to set the shadow copy schedule, and to set the maximum amount of disk space used by shadow copies.

So how can users use VSS to recover files? Actually, the recovery process is simple. To revert to a previous version of a file, all a user has to do is right-click on the file and select the Properties command from the resulting shortcut menu. The user will see the file's properties sheet, and can then go to the sheet's Previous Version tab and select the version of the file they want to restore.

If restoring a file requires right-clicking on the existing file, how is a user supposed to restore a file that's been deleted? Normally, using VSS to recover a deleted file would probably be impossible. But with VSS, shadow copies are bound to filenames. This means that a user who accidentally deletes a file can create a new file that has the exact same name as the file that was deleted. The user can then right-click on that file and use the Previous Versions tab on the file's properties sheet to restore the file that was deleted. The catch? If the user doesn't know the exact file name, this procedure will not work.

Because shadow copies are linked to filenames, a user who renames a file no longer has access to previous versions of that file. VSS will start saving versions of the newly renamed file the next time a shadow copy is made (assuming there are also future modifications to the file). However, any existing previous file versions are no longer accessible unless the file is renamed to back to its original name.

About the author: Brien M. Posey, MCSE, is a Microsoft Most Valuable Professional for his work with Windows 2000 Server, Exchange Server and IIS. He has served as CIO for a nationwide chain of hospitals and was once in charge of IT security for Fort Knox. He writes regularly for SearchWinComputing.com and other TechTarget sites.

More information on this topic:

Dig Deeper on Windows Server storage management