Configuring Shadow Copies at the Command Line

The command-line tool for configuring shadow copies is VSSAdmin. Using VSSAdmin, you can configure shadow copying of volumes on the computer you're logged on to locally or remotely through Remote Desktop. As with Computer Management, each volume on a server that has shared folders must be configured separately for shadow copying.

Enabling Shadow Copying from the Command Line

To enable shadow copying of a volume, you use the ADD SHADOWSTORAGE command. The syntax is as follows:

vssadmin add shadowstorage /for=ForVolumeSpec /on=OnVolumeSpec

Here, /for=ForVolumeSpec is used to specify the local volume for which you are configuring or managing shadow copies and /on=OnVolumeSpec is used to specify the volume on which the shadow copy data will be stored.

Consider the following example:

vssadmin add shadowstorage /for=c: /on=d:

Here, you are configuring the C volume to use shadow copies, and the shadow copy data is stored on D. Both values can be set to the same volume as well, such as

vssadmin add shadowstorage /for=e: /on=e:

Here, you are configuring the E volume to use shadow copies, and the shadow copy data is stored on that same volume.

With VSSAdmin, shadow copying is configured by default so that there is no maximum size limit for shadow storage. To set a specific limit, you can use the /MaxSize parameter. This parameter expects to be passed a numeric value with a suffix of KB, MB, GB, TB, PB, or EB to indicate whether the value is set in kilobytes, megabytes, gigabytes, terabytes, petabytes, or exabytes. This parameter must be set to 100 MB or greater. Consider the following example:

vssadmin add shadowstorage /for=c: /on=d: /maxsize=2GB

Here, you are configuring the C volume to use shadow copies, and the shadow copy data is stored on D. The maximum size allowed for the shadow storage is 2 GB.

The most common errors that occur when you are configuring shadow copies from the command line relate to improper syntax. If you enter the wrong syntax, VSSAdmin shows the error message "Error: Invalid command" and will display the command syntax. If shadow copying is already configured for a volume, the error message states "Error: The specified shadow copy storage association already exists."

Create Manual Snapshots from the Command Line

When you enable shadow copying, snapshots of shared folders are created automatically according to the default run schedule. If you ever want to make a snapshot manually, you can do this using the CREATE SHADOW command. Type vssadmin create shadow / for=ForVolumeSpec, where ForVolumeSpec is the local volume for which you are creating the snapshot. Consider the following example:

vssadmin create shadow /for=e:

Here, you create a snapshot of shared folders on the E volume.

Tip

Set the AutoRetry interval to retry creation automatically

Occasionally, the Shadow Copy service is busy, typically because it is creating a snapshot of this or another volume. Here, you can try again in a few minutes, or, by using the /AutoRetry parameter, you can specifically set the length of time during which CREATE SHADOW should continue to try to create the snapshot. For example, if you want to retry automatically for 15 minutes, you'd use /AutoRetry=15.

Viewing Shadow Copy Information

VSSAdmin provides several utility commands for viewing shadow copy information. The most useful are LIST SHADOWS and LIST SHADOWSTORAGE.

LIST SHADOWS lists the existing shadow copies on a volume. By default, all shadow copies on all volumes are displayed. The command accepts /for=ForVolumeSpec to list only the information for a particular volume and /shadow=ShadowId to list only the information for a particular shadow copy. However, it is much easier just to type vssadmin list shadows and go through the information to find what you are looking for.

The output from LIST SHADOWS shows summary information for each snapshot created according to its shadow copy identifier, such as:

Contents of shadow copy set ID: {ff70e4e6-4117-446a-8ffe-1708632664ff} 
   Contained 1 shadow copies at creation time: 2/26/2004 2:03:55 AM
      Shadow Copy ID: {5ba0f3d3-afa8-4e4e-a00e-64a44e11bf81}
        Original Volume: (C:)\?Volume{3796c3c0-5106-11d7-911c-806d6172696f}
         Shadow Copy Volume: \?GLOBALROOTDeviceHarddiskVolumeShadowCopy3 
         Originating Machine: corpsvr02.cpandl.com
         Service Machine: corpsvr02.cpandl.com 
         Provider: 'Microsoft Software Shadow Copy provider 1.0'
         Type: ClientAccessible
      Attributes: Persistent, Client-accessible, No auto release, No writers, Differential

Contents of shadow copy set ID: {6cb7fba8-afbb-415f-b47a-6800b332af9a} 
   Contained 1 shadow copies at creation time: 2/26/2004 2:34:09 AM
      Shadow Copy ID: {3f44a086-2034-4c6b-bf3f-3489a5e98bd8}
        Original Volume: (C:)\?Volume{3796c3c0-5106-11d7-911c-806d6172696f} 
         Shadow Copy Volume: \?GLOBALROOTDeviceHarddiskVolumeShadowCopy4 
         Originating Machine: corpsvr02.cpandl.com 
         Service Machine: corpsvr02.cpandl.com 
         Provider: 'Microsoft Software Shadow Copy provider 1.0' 
         Type: ClientAccessible 
         Attributes: Persistent, Client-accessible, No auto release, No writers, Differential

Contents of shadow copy set ID: {25f354e1-003a-4e54-8ba6-2f09bc499ef4} 
   Contained 1 shadow copies at creation time: 2/26/2004 3:08:37 AM
      Shadow Copy ID: {f3899e11-613a-4a7d-95de-cb264d1dbb7b}
        Original Volume: (C:)\?Volume{3796c3c0-5106-11d7-911c-806d6172696f} 
         Shadow Copy Volume: \?GLOBALROOTDeviceHarddiskVolumeShadowCopy5 
         Originating Machine: corpsvr02.cpandl.com 
         Service Machine: corpsvr02.cpandl.com 
         Provider: 'Microsoft Software Shadow Copy provider 1.0' 
         Type: ClientAccessible 
      Attributes: Persistent, Client-accessible, No auto release, No writers, Differential

Here, there is a data set for each snapshot that has been created. The most important information is the following:

  • Shadow Copy ID The unique identifier for the snapshot image. This identifier can be copied and used to delete a particular snapshot if desired.

  • Original Volume The volume for which shadow copies are configured.

  • Originating Machine The name of the computer you are working with.

LIST SHADOWSTORAGE displays all shadow copy storage associations on the system. The command accepts /for=ForVolumeSpec and /on=OnVolumeSpec parameters to limit the out-put. But again, it is much easier just to type vssadmin list shadowstorage and go through the information to find what you are looking for. Here is an example of the output from this command:

Shadow Copy Storage association
   For volume: (C:)\?Volume{3796c3c0-5106-11d7-911c-806d6172696f} 
   Shadow Copy Storage volume: (C:)\?Volume{3796c3c0-5106-11d7-911c-806d617269 6f}
   Used Shadow Copy Storage space: 39.516 MB 
   Allocated Shadow Copy Storage space: 122.297 MB 
   Maximum Shadow Copy Storage space: 3.726 GB

Here, the output shows you the following information:

  • For Volume The volume for which shadow copies are configured

  • Shadow Copy Storage Volume The volume on which shadow copy data is stored

  • Used Shadow Copy Storage Space The actual amount of disk space used on the storage volume

  • Allocated Shadow Copy Storage Space The amount of disk space allocated on the storage volume for shadow copies

  • Maximum Shadow Copy Storage Space The maximum size allowed for shadow copies on the storage volume

Deleting Snapshot Images from the Command Line

If you want to delete individual snapshots on a volume, you can use the DELETE SHADOWS command to do this. You can delete the oldest snapshot on the specified volume by typing vssadmin delete shadows /for=ForVolumeSpec /oldest, where /for=ForVolumeSpec specifies the local volume for which the snapshot is used. For example, if you configured shadow copying on the C volume and want to delete the oldest snapshot on this volume, you'd enter the command:

vssadmin delete shadows /for=c: /oldest

When prompted to confirm that you really want to delete the snapshot, press Y. VSSAdmin should then report "Successfully deleted 1 shadow copies."

To delete a snapshot by its shadow identifier use the /Shadow=ShadowID parameter instead of the /For=ForVolumeSpec and /Oldest parameters. Here, ShadowID is the globally unique identifier for the snapshot image, including the brackets {}. For example, if you want to delete the snapshot image with the ID {f3899e11-613a-4a7d-95de-cb264d1dbb7b} from the C volume, you'd use the following command:

vssadmin delete shadows /for=c: /shadow={f3899e11-613a-4a7d-95de-cb264d1dbb7b}

Again, when prompted to confirm that you really want to delete the snapshot, press Y. VSSAdmin doesn't actually check to see if the snapshot exists until you confirm that you want to delete the snapshot. In this case, if the shadow copy ID is invalid or the snapshot has already been deleted, VSSAdmin reports a "not found" error, such as:

Error: Shadow Copy ID: {f3899e11-613a-4a7d-95de-cb264d1dbb7b} not found.

DELETE SHADOWS also lets you delete all snapshots on all volumes configured for shadow copy on the computer. To do this, type delete shadows /all. When prompted to confirm that you really want to delete all snapshots, press Y. VSSAdmin should then report, "Successfully deleted N shadow copies." Deleting all the shadow copies, doesn't disable shadow copy on the volumes, however. To do this, you must use the DELETE SHADOWSTORAGE command.

Disabling Shadow Copies from the Command Line

To disable shadow copy on a volume, you can use the DELETE SHADOWSTORAGE command. However, unlike the graphical user interface (GUI), you cannot disable shadow copying until all previously saved snapshot images on the affected volume are deleted. Because of this, you must first delete all the snapshots on the volume and then disable shadow copying. Type the command vssadmin delete shadowstorage /for=ForVolumeSpec, where /for=ForVolumeSpec is used to specify the local volume for which you are disabling shadow copy. For example, if you want to disable shadow copying of the C volume, you'd use the command:

vssadmin delete shadowstorage /for=c:

As long as the shadow storage isn't in use, you will be able to delete and VSSAdmin will report, "Successfully deleted the shadow copy storage association(s)."

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset