How to use DiskShadow for in depth VSS troubleshooting
说明
VSS troubleshooting is a common task when using AppAssure. Although the VShadow utility is included in the AppAssure Agent Installation directory, there are times when it is preferable to use diskshadow, the Windows utility included in each version of Windows beginning with Windows 2008 as it offers more functionality and a dedicated context. On the other hand, performing common tasks using DiskShadow is sometimes rather counter intuitive, thus the need to organize them in a KB.
解决办法
Troubleshooting VSS using DiskShadow may be organized follows:
DiskShadow context
Run diskshadow at an elevated Command or Powershell prompt. The Prompt changes to DISKSHADOW>.
All further commands entered in the console are referring to diskshadow. To quit the context, type exit
Logging the results to a text file for further analysis
Launch diskshadow with the "-l" (short from log) parameter
diskshadow -l c:\temp\diskshadow.txt. The log file contains all the context commands and the results displayed on the screen during the session
Best Practice and help commands
It is good practice to start every set of DiskShadow commands with reset command and finish with exit
NOTE: Exit quits DiskShadow. Separate multiple jobs using the reset command.
To get more in depth information re the diskshadow capabilities, type help at the diskshadow prompt
More help with specific commands type khelp at the end of the command e.g. Delete Shadows Help
It is recommended to use the logging option as the output may be larger than the screen buffer, thus some data may be lost from the screen.
Retrieve VSS providers information
reset
list providers
exit
Retrieve detailed VSS Writers information
reset
list writers
list writers status
list writers metadata
list writers detailed
exit
NOTE: Use just one "list" command out of the four "list" commands shown. The output can use useful to see the list of files which are reported by the VSS writers to be included and excluded by the backup.
Test Shadow Creation
reset
set verbose on
set option differential
set context volatile
add volume c:
add volume d: (if the system is on more than one disk, add them one by one)
create
exit
Any failure during the create phase indicate a problem either with VSS or one of the writers which should be pursued with Microsoft.
Test open files options
reset
set verbose on
set option differential
set context volatile nowriters
add volume c: (replace c: with the drive letter the snapshot is having problems.)
create
exit
Remove previously created VSS snapshots
reset
delete shadows all
delete shadows volume c:
delete shadows \\servername\share
delete shadows oldest c:
delete shadows exposed Z:
delete shadows exposed
exit
NOTE: Use only one "delete" command out for the six "delete" commands versions.
Mount (Expose) a shadow copy to a drive, mountpoint, or share
Scripts consist out of diskshadow commands, written one per line in a text file. It is recommended to use the extension .dsh to differentiate scripts from regular text files but it is not necessary. For instance script.dsh is executed the same as script.txt if they feature the same content.
WARNING -- the first line of the script MUST be a comment (prefixed with #) as the first script line may be skipped. It is good practice to end the script with a comment as well (i.e. #end script).
DiskShadow can be run in scripted mode using the -s parameter, i.e.
diskshadow -s c:\temp\script.txt
Environment variables can be added
PowerShell
DiskShadow one liners can be executed from an elevated PowerShell console, using the piping PowerShell capabilities. For instance, to list the VSS writers, type:
"list-writers" | diskshadow
NOTE: It is not possible to concatenate commands and run them in PowerShell.