如何使用卷影复制来进行备份

计划是创build一个相当大的I / O卷的卷影副本。 它的容量为350GB,其中包含一个基于文件系统的全文索引,该文件索引组织在数百个文件夹中,数十万个小文件需要处于一致的状态才能成功恢复。

当前索引器停止,备份任务运行,然后索引器重新启动。 这会导致索引在备份过程中几个小时不可用。 我想通过阴影复制进行一致的备份,理想情况下,根本不必停止索引器。

所以,我已经打开了该卷的卷影副本,并将其configuration为每天晚上创build一个快照,以创build一个不同的卷。

现在我有点不知所措 – 我怎样才能作为一个整体访问影子副本,以便我可以做出备份? 我设想一个只读驱动器,其中包含上次快照时的文件,但也许情况完全不同。

OS是Windows Server 2003 SP2,备份软件是CommVault Galaxy 7.0。


编辑 :请注意 – 在此期间 – 已经创build了两个答案,以脚本的forms实现必要的function:

  • VBScript (由我自己)
  • PowerShell ( John John )

所以本着重塑轮盘的精神,我向你展示了Tomalak的优秀脚本(见上),但是在Powershell中完全重写了! 我这样做的主要原因是为了传播Powershell的强大能力,也因为我鄙视vbscript与我的整个存在。

大多数function都是相同的,但是由于各种原因,我做了一些有些不同的事情。 debugging输出肯定比较冗长。

一个非常重要的事情要注意的是,这个版本检测操作系统的版本和位,并调用适当版本的vshadow.exe。 我在下面列出了一个图表,显示要使用哪个版本的vshadow.exe,在哪里获取它们,以及如何命名它们。


以下是使用信息:

VssSnapshot.ps1 Description: Create, mount or delete a Volume Shadow Copy Service (VSS) Shadow Copy (snapshot) Usage: VssSnapshot.ps1 Create -Target <Path> -Volume <Volume> [-Debug] VssSnapshot.ps1 Delete -Target <Path> [-Debug] Paremeters: Create - Create a snapshot for the specified volume and mount it at the specified target Delete - Unmount and delete the snapshot mounted at the specified target -Target - The path (quoted string) of the snapshot mount point -Volume - The volume (drive letter) to snapshot -Debug - Enable debug output (optional) Examples: VssSnapshot.ps1 Create -Target D:\Backup\DriveC -Volume C - Create a snapshot of volume C and mount it at "D:\Backup\DriveC" VssSnapshot.ps1 Delete -Target D:\Backup\DriveC - Unmount and delete a snapshot mounted at "D:\Backup\DriveC" Advanced: VssSnapshot.ps1 create -t "c:\vss mount\c" -v C -d - Create a snapshot of volume C and mount it at "C:\Vss Mount\C" - example mounts snapshot on source volume (C: --> C:) - example uses shortform parameter names - example uses quoted paths with whitespace - example includes debug output 

这是脚本:

 # VssSnapshot.ps1 # http://serverfault.com/questions/119120/how-to-use-a-volume-shadow-copy-to-make-backups/119592#119592 Param ([String]$Action, [String]$Target, [String]$Volume, [Switch]$Debug) $ScriptCommandLine = $MyInvocation.Line $vshadowPath = "." # Functions Function Check-Environment { Write-Dbg "Checking environment..." $UsageMsg = @' VssSnapshot Description: Create, mount or delete a Volume Shadow Copy Service (VSS) Shadow Copy (snapshot) Usage: VssSnapshot.ps1 Create -Target <Path> -Volume <Volume> [-Debug] VssSnapshot.ps1 Delete -Target <Path> [-Debug] Paremeters: Create - Create a snapshot for the specified volume and mount it at the specified target Delete - Unmount and delete the snapshot mounted at the specified target -Target - The path (quoted string) of the snapshot mount point -Volume - The volume (drive letter) to snapshot -Debug - Enable debug output (optional) Examples: VssSnapshot.ps1 Create -Target D:\Backup\DriveC -Volume C - Create a snapshot of volume C and mount it at "D:\Backup\DriveC" VssSnapshot.ps1 Delete -Target D:\Backup\DriveC - Unmount and delete a snapshot mounted at "D:\Backup\DriveC" Advanced: VssSnapshot.ps1 create -t "c:\vss mount\c" -v C -d - Create a snapshot of volume C and mount it at "C:\Vss Mount\C" - example mounts snapshot on source volume (C: --> C:) - example uses shortform parameter names - example uses quoted paths with whitespace - example includes debug output '@ If ($Action -eq "Create" -And ($Target -And $Volume)) { $Script:Volume = (Get-PSDrive | Where-Object {$_.Name -eq ($Volume).Substring(0,1)}).Root If ($Volume -ne "") { Write-Dbg "Verified volume: $Volume" } Else { Write-Dbg "Cannot find the specified volume" Exit-Script "Cannot find the specified volume" } Write-Dbg "Argument check passed" } ElseIf ($Action -eq "Delete" -And $Target ) { Write-Dbg "Argument check passed" } Else { Write-Dbg "Invalid arguments: $ScriptCommandLine" Exit-Script "Invalid arguments`n`n$UsageMsg" } $WinVer = ((Get-WmiObject Win32_OperatingSystem).Version).Substring(0,3) Switch ($WinVer) { "5.2" { $vshadowExe = "vshadow_2003" $WinBit = ((Get-WmiObject Win32_Processor)[0]).AddressWidth } "6.0" { $vshadowExe = "vshadow_2008" $WinBit = (Get-WmiObject Win32_OperatingSystem).OSArchitecture } "6.1" { $vshadowExe = "vshadow_2008R2" $WinBit = (Get-WmiObject Win32_OperatingSystem).OSArchitecture } Default { Write-Dbg "Unable to determine OS version" Exit-Script "Unable to determine OS version" } } Switch ($WinBit) { {($_ -eq "32") -or ($_ -eq "32-bit")} {$vshadowExe += "_x86.exe"} {($_ -eq "64") -or ($_ -eq "64-bit")} {$vshadowExe += "_x64.exe"} Default { Write-Dbg "Unable to determine OS bitness" Exit-Script "Unable to determine OS bitness" } } $Script:vshadowExePath = Join-Path $vshadowPath $vshadowExe If (Test-Path $vshadowExePath) { Write-Dbg "Verified vshadow.exe: $vshadowExePath" } Else { Write-Dbg "Cannot find vshadow.exe: $vshadowExePath" Exit-Script "Cannot find vshadow.exe" } Write-Dbg "Environment ready" } Function Prepare-Target { Write-Log "Preparing target..." Write-Dbg "Preparing target $Target" If (!(Test-Path (Split-Path $Target -Parent))) { Write-Dbg "Target parent does not exist" Exit-Script "Invalid target $Target" } If ((Test-Path $Target)) { Write-Dbg "Target already exists" If (@(Get-ChildItem $Target).Count -eq 0) { Write-Dbg "Target is empty" } Else { Write-Dbg "Target is not empty" Exit-Script "Target contains files/folders" } } Else { Write-Dbg "Target does not exist. Prompting user..." $PromptYes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Create target folder" $PromptNo = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Do not create target folder" $PromptOptions = [System.Management.Automation.Host.ChoiceDescription[]]($PromptYes, $PromptNo) $PromptResult = $Host.UI.PromptForChoice("Create folder", "The target folder `"$target`" does not exist.`nWould you like to create the folder?", $PromptOptions, 0) Switch ($PromptResult) { 0 { Write-Dbg "User Accepted. Creating target..." $Null = New-Item -Path (Split-Path $Target -Parent) -Name (Split-Path $Target -Leaf) -ItemType "Directory" } 1 { Write-Dbg "User declined. Exiting..." Exit-Script "Target does not exist" } } } Write-Log "Target ""$Target"" ready" Write-Dbg """$Target"" ready" } Function Create-Snapshot { Write-Log "Creating snapshot..." Write-Dbg "Creating snapshot of $Volume" $Cmd = "$vshadowExePath -p $Volume" $CmdResult = Run-Command $Cmd -AsString Write-Dbg "Snapshot created successfully" $SnapshotID = $CmdResult -Match 'SNAPSHOT ID = (\{[^}]{36}\})' If ($SnapshotID) { $SnapshotID = $Matches[1] Write-Dbg "SnapshotID: $SnapshotID" Write-Log "Snapshot $SnapshotID created" } Else { Write-Dbg "Unable to determine SnapshotID" Exit-Script "Unable to determine SnapshotID" } Return $SnapshotID } Function Mount-Snapshot ($SnapshotID) { Write-Log "Mounting snapshot..." Write-Dbg "Mounting $SnapshotID at ""$Target""" $Cmd = "$vshadowExePath `"-el=$SnapshotId,$Target`"" #Must use escaped quotes because Invoke-Expression gets all weird about curly braces $CmdResult = Run-Command $Cmd Write-Log "Snapshot $SnapshotID mounted at target ""$Target""" Write-Dbg "$SnapshotID mounted at ""$Target""" } Function Delete-Snapshot { Write-Log "Deleting snapshot..." Write-Dbg "Deleting snapshot at target ""$Target""" $SnapshotID = Get-SnapshotIdbyTarget $Cmd = "$vshadowExePath `"-ds=$SnapshotId`"" $CmdResult = Run-Command $Cmd Write-Log "Snapshot $SnapshotID deleted at target ""$Target""" Write-Dbg "$SnapshotID deleted at ""$Target""" } Function Get-SnapshotIdbyTarget { Write-Dbg "Finding SnapshotID for $Target" $Cmd = "$vshadowExePath -q" $CmdResult = Run-Command $Cmd -AsString $TargetRegEx = '(?i)' + $Target.Replace('\','\\') + '\\?\r' $Snapshots = ($CmdResult.Split('*')) -Match $TargetRegEx | Out-String If ($Snapshots) { $Null = $Snapshots -Match '(\{[^}]{36}\})' $SnapshotID = $Matches[0] } Else { Write-Dbg "Unable to determine SnapshotID for target $Target" Exit-Script "Unable to determine SnapshotID" } Write-Dbg "SnapshotID: $SnapshotID" Return $SnapshotID } Function Run-Command ([String]$Cmd, [Switch]$AsString=$False, [Switch]$AsArray=$False) { Write-Dbg "Running: $Cmd" $CmdOutputArray = Invoke-Expression $Cmd $CmdOutputString = $CmdOutputArray | Out-String $CmdErrorCode = $LASTEXITCODE If ($CmdErrorCode -eq 0 ) { Write-Dbg "Command successful. Exit code: $CmdErrorCode" Write-Dbg $CmdOutputString } Else { Write-Dbg "Command failed. Exit code: $CmdErrorCode" Write-Dbg $CmdOutputString Exit-Script "Command failed. Exit code: $CmdErrorCode" } If (!($AsString -or $AsArray)) { Return $CmdErrorCode } ElseIf ($AsString) { Return $CmdOutputString } ElseIf ($AsArray) { Return $CmdOutputArray } } Function Write-Msg ([String]$Message) { If ($Message -ne "") { Write-Host $Message } } Function Write-Log ([String]$Message) { Write-Msg "[$(Get-Date -Format G)] $Message" } Function Write-Dbg ([String]$Message) { If ($Debug) { Write-Msg ("-" * 80) Write-Msg "[DEBUG] $Message" Write-Msg ("-" * 80) } } Function Exit-Script ([String]$Message) { If ($Message -ne "") { Write-Msg "`n[FATAL ERROR] $Message`n" } Exit 1 } # Main Write-Log "VssSnapshot started" Check-Environment Switch ($Action) { "Create" { Prepare-Target $SnapshotID = Create-Snapshot Mount-Snapshot $SnapshotID } "Delete" { Delete-Snapshot } } Write-Log "VssSnapshot finished" 

这里是要使用的vshadow.exe版本:

  1. Windows 2003 / 2003R2
    • 卷影复制服务SDK 7.2
    • x86:C:\ Program Files \ Microsoft \ VSSSDK72 \ TestApps \ vshadow \ bin \ release-server \ vshadow.exe
      • 重命名为: vshadow_2003_x86.exe
    • x64:我一直无法find用于Windows 2003 x64的x64版本的vshadow.exe
  2. Windows 2008
    • 用于Windows Server 2008和.NET Framework 3.5的Windows SDK
    • x86:C:\ Program Files \ Microsoft SDKs \ Windows \ v6.1 \ Bin \ vsstools \ vshadow.exe
      • 重命名为: vshadow_2008_x86.exe
    • x64:C:\ Program Files \ Microsoft SDKs \ Windows \ v6.1 \ Bin \ x64 \ vsstools \ vshadow.exe
      • 重命名为: vshadow_2008_x64.exe
  3. Windows 2008R2
    • 用于Windows 7和.NET Framework 4的Microsoft Windows SDK
    • x86:C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v7.0A \ Bin \ vsstools \ vshadow.exe
      • 重命名为: vshadow_2008R2_x86.exe
    • x64:C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v7.0A \ Bin \ x64 \ vsstools \ vshadow.exe
      • 重命名为: vshadow_2008R2_x64.exe

所以…我一直在做一个小小的VBScript,可以:

  • 采取持久的VSS快照
  • 将它们挂载到一个文件夹(然后可以从中备份文件)
  • 卸载VSS快照

它依赖于vshadow.exe ( 文档 ),这是Microsoft提供的卷影复制服务SDK 7.2的一部分。 我一直在使用此版本:“ VSHADOW.EXE 2.2 – 卷影副本示例客户端,版权所有(C)2005 Microsoft Corporation”。

基本上,这四个vshadow命令是一个整齐的小包装:

 vshadow.exe -q  - 列出系统中的所有卷影副本
 vshadow.exe -p {卷列表}  - pipe理持久性卷影副本
 vshadow.exe -el = {SnapID},dir  - 将阴影副本公开为装载点
 vshadow.exe -ds = {SnapID}  - 删除此卷影副本

这是它的帮助屏幕:

 VSS快照创build/装载工具

用法:
 cscript / nologo VssSnapshot.vbs / target:path {/ volume:X |  / unmount} [/ debug]

 /卷 - 卷的驱动器号到快照
 / target  - 将快照安装到的path(绝对或相对)
 /debugging - debugging输出

例子:
 cscript / nologo VssSnapshot.vbs / target:C:\ Backup \ DriveD / volume:D
 cscript / nologo VssSnapshot.vbs / target:C:\ Backup \ DriveD / unmount

提示:在拍摄新快照之前不需要卸载。

这里有一些示例输出:

 C:\ VssSnapshot> cscript / nologo VssSnapshot.vbs / target:MountPoints \ E / volume:E
 05/03/2010 17:13:04准备VSS挂载点...
 05/03/2010 17:13:04安装点准备在:C:\ VssSnapshot \ MountPoints \ E
 05/03/2010 17:13:04创buildVSS快照的卷:E
 05/03/2010 17:13:08快照使用ID创build{4ed3a907-c66f-4b20-bda0-9dcda3b667ec}
 05/03/2010 17:13:08 VSS快照成功安装
 05/03/2010 17:13:08完成

 C:\ VssSnapshot> cscript / nologo VssSnapshot.vbs / target:MountPoints \ E / unmount
 05/03/2010 17:13:35准备VSS挂载点...
 05/03/2010 17:13:36没事别的事
 05/03/2010 17:13:36完成

这是脚本本身。 通常的免责声明适用:本软件是按原样提供的,我不作任何保证,使用风险自负,如果有什么突破是唯一责备你自己的。 我已经完全testing了它,虽然它对我来说工作正常。 随时通过下面的评论通知我的任何错误。

 ''# VssSnapshot.vbs ''# http://serverfault.com/questions/119120/how-to-use-a-volume-shadow-copy-to-make-backups/119592#119592 Option Explicit Dim fso: Set fso = CreateObject("Scripting.FileSystemObject") ''# -- MAIN SCRIPT ------------------------------------------- Dim args, snapshotId, targetPath, success Set args = WScript.Arguments.Named CheckEnvironment Log "preparing VSS mount point..." targetPath = PrepareVssMountPoint(args("target")) If args.Exists("unmount") Then Log "nothing else to do" ElseIf targetPath <> vbEmpty Then Log "mount point prepared at: " & targetPath Log "creating VSS snapshot for volume: " & args("volume") snapshotId = CreateVssSnapshot(args("volume")) If snapshotId <> vbEmpty Then Log "snapshot created with ID: " & snapshotId success = MountVssSnapshot(snapshotId, targetPath) If success Then Log "VSS snapshot mounted sucessfully" Else Die "failed to mount snapshot" End If Else Die "failed to create snapshot" End If Else Die "failed to prepare mount point" End If Log "finished" ''# -- FUNCTIONS --------------------------------------------- Function PrepareVssMountPoint(target) ''# As String Dim cmd, result, outArray Dim path, snapshot, snapshotId Dim re, matches, match PrepareVssMountPoint = VbEmpty target = fso.GetAbsolutePathName(target) If Not fso.FolderExists(fso.GetParentFolderName(target)) Then Die "Invalid mount point: " & target End If ''# create or unmount (=delete existing snapshot) mountpoint If Not fso.FolderExists(target) Then If Not args.Exists("unmount") Then fso.CreateFolder target Else Set re = New RegExp re.MultiLine = False re.Pattern = "- Exposed locally as: ([^\r\n]*)" cmd = "vshadow -q" result = RunCommand(cmd, false) outarray = Split(result, "*") For Each snapshot In outArray snapshotId = ParseSnapshotId(snapshot) If snapshotId <> vbEmpty Then Set matches = re.Execute(snapshot) If matches.Count = 1 Then path = Trim(matches(0).SubMatches(0)) If fso.GetAbsolutePathName(path) = target Then cmd = "vshadow -ds=" & snapshotId RunCommand cmd, true Exit For End If End If End If Next If args.Exists("unmount") Then fso.DeleteFolder target End If PrepareVssMountPoint = target End Function Function CreateVssSnapshot(volume) ''# As String Dim cmd, result If Not fso.DriveExists(volume) Then Die "Drive " & volume & " does not exist." End If cmd = "vshadow -p " & Replace(UCase(volume), ":", "") & ":" result = RunCommand(cmd, false) CreateVssSnapshot = ParseSnapshotId(result) End Function Function MountVssSnapshot(snapshotId, target) ''# As Boolean Dim cmd, result If fso.FolderExists(targetPath) Then cmd = "vshadow -el=" & snapshotId & "," & targetPath result = RunCommand(cmd, true) Else Die "Mountpoint does not exist: " & target End If MountVssSnapshot = (result = "0") End Function Function ParseSnapshotId(output) ''# As String Dim re, matches, match Set re = New RegExp re.Pattern = "SNAPSHOT ID = (\{[^}]{36}\})" Set matches = re.Execute(output) If matches.Count = 1 Then ParseSnapshotId = matches(0).SubMatches(0) Else ParseSnapshotId = vbEmpty End If End Function Function RunCommand(cmd, exitCodeOnly) ''# As String Dim shell, process, output Dbg "Running: " & cmd Set shell = CreateObject("WScript.Shell") On Error Resume Next Set process = Shell.Exec(cmd) If Err.Number <> 0 Then Die Hex(Err.Number) & " - " & Err.Description End If On Error GoTo 0 Do While process.Status = 0 WScript.Sleep 100 Loop output = Process.StdOut.ReadAll If process.ExitCode = 0 Then Dbg "OK" Dbg output Else Dbg "Failed with ERRORLEVEL " & process.ExitCode Dbg output If Not process.StdErr.AtEndOfStream Then Dbg process.StdErr.ReadAll End If End If If exitCodeOnly Then Runcommand = process.ExitCode Else RunCommand = output End If End Function Sub CheckEnvironment Dim argsOk If LCase(fso.GetFileName(WScript.FullName)) <> "cscript.exe" Then Say "Please execute me on the command line via cscript.exe!" Die "" End If argsOk = args.Exists("target") argsOk = argsOk And (args.Exists("volume") Or args.Exists("unmount")) If Not argsOk Then Say "VSS Snapshot Create/Mount Tool" & vbNewLine & _ vbNewLine & _ "Usage: " & vbNewLine & _ "cscript /nologo " & fso.GetFileName(WScript.ScriptFullName) & _ " /target:path { /volume:X | /unmount } [/debug]" & _ vbNewLine & vbNewLine & _ "/volume - drive letter of the volume to snapshot" & _ vbNewLine & _ "/target - the path (absolute or relative) to mount the snapshot to" & _ vbNewLine & _ "/debug - swich on debug output" & _ vbNewLine & vbNewLine & _ "Examples: " & vbNewLine & _ "cscript /nologo " & fso.GetFileName(WScript.ScriptFullName) & _ " /target:C:\Backup\DriveD /volume:D" & vbNewLine & _ "cscript /nologo " & fso.GetFileName(WScript.ScriptFullName) & _ " /target:C:\Backup\DriveD /unmount" & _ vbNewLine & vbNewLine & _ "Hint: No need to unmount before taking a new snapshot." & vbNewLine Die "" End If End Sub Sub Say(message) If message <> "" Then WScript.Echo message End Sub Sub Log(message) Say FormatDateTime(Now()) & " " & message End Sub Sub Dbg(message) If args.Exists("debug") Then Say String(75, "-") Say "DEBUG: " & message End If End Sub Sub Die(message) If message <> "" Then Say "FATAL ERROR: " & message WScript.Quit 1 End Sub 

我希望这有助于某人。 随意按照cc-by-sa使用它。 我所要求的是,你把链接完好无损地指向这里。

  1. 使用命令vssadmin list shadows列出所有可用的阴影副本。 你会得到这样的输出…
 C:\> vssadmin列表阴影
 vssadmin 1.1  - 卷影复制服务pipe理命令行工具
 (C)版权所有2001 Microsoft Corp.

影子副本集ID的内容:{b6f6fb45-bedd-4b77-8f51-14292ee921f3}
   在创build时包含1个影子副本:9/25/2016 12:14:23 PM
      卷影复制ID:{321930d4-0442-4cc6-b2aa-ec47f21d0eb1}
         原始音量:(C:)\\?\音量{ad1dd231-1200-11de-b1df-806e6f6e6963} \
         卷影副本卷:\\?\ GLOBALROOT \ Device \ HarddiskVolumeShadowCopy68
         原始机器:joshweb.josh.com
         服务机器:joshweb.josh.com
         供应商:“微软软件影子复制提供商1.0”
         types:ClientAccessible
         属性:持久,客户端可访问,不自动释放,无写入者,差异

影子拷贝集的内容ID:{c4fd8646-57b3-4b39-be75-47dc8e7f881d}
   在创build时包含1个影子副本:8/25/2016 7:00:18 AM
      影子拷贝ID:{fa5da100-5d90-493c-89b1-5c27874a23c6}
         原始音量:(E:)\\?\ Volume {4ec17949-12b6-11de-8872-00235428b661} \
         卷影副本卷:\\?\ GLOBALROOT \ Device \ HarddiskVolumeShadowCopy3
         原始机器:joshweb.josh.com
         服务机器:joshweb.josh.com
         供应商:“微软软件影子复制提供商1.0”
         types:ClientAccessible
         属性:持久,客户端可访问,不自动释放,无写入者,差异

 C:\
  1. 记下您想要的Shadow Copy Volume名(最容易到达剪贴板)。

  2. 安装Shadow Copy

在Windows 2003上…

如果您尚未拥有它,则需要下载2003年的资源工具包工具 。

input命令…

链接到c:\ shadow \\?\ GLOBALROOT \ Device \ HarddiskVolumeShadowCopy69 \

…其中c:\shadow是希望阴影副本出现的path, \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy69是您在上面复制的名称。 请注意,您必须在影子副本名称的末尾添加反斜杠!

在Windows 2008和…

input命令…

 mklink c:\ shadow \\?\ GLOBALROOT \ Device \ HarddiskVolumeShadowCopy69 \

…其中c:\shadow是希望阴影副本出现的path, \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy69是您在上面复制的名称。 请注意,您必须在影子副本名称的末尾添加反斜杠!

  1. 使用任何你想要的工具(包括Windows资源pipe理器或XCOPY )来访问c:\shadow的文件。

您误解了VSS如何与文件系统协同工作(它与数据库的工作原理是完全不同的)。 在文件系统上,VSS用于实现“早期版本”function,该function仅用于在预定义时间点快照对文件和文件夹的更改 ,以便通过客户端中的“先前版本”选项卡进行恢复。 然后将这些更改与卷上的数据合并,以构build恢复集。 所以它依赖于原来的卷仍然存在,以便执行恢复,换句话说,对于正确的备份和恢复来说是无用的。

我认为你需要退出你想要做的事情,然后再想一想你想做什么。

350 GB的数据实际上并不是很多,我敢打赌,在日常活动中使用的百分比非常低。 您是否考虑过仅在周末进行全备份的夜间差异备份? 或者使用预定的DFS复制到备用存储以获得“快照”(然后进行备份)?

希望这是你想要的:

diskshadow -s vssbackup.cfg

vssbackup.cfg:

 set context persistent set metadata E:\backup\result.cab set verbose on begin backup add volume C: alias ConfigVolume create EXPOSE %ConfigVolume% Y: # Y is your VSS drive # run your backup script here delete shadows exposed Y: end backup 

使用VSS API,可以获取卷的“快照”。 然后,您必须挂载该快照才能从中复制。 我很熟悉现在已经死了的产品,它使用这种技术来复制数据,尽pipe文件被活动文件系统中的其他进程独占打开。 如果VSS快照中的文件是由未与VSS API集成的应用程序编写的,那么这些问题可能会出现问题。 可能有其他提供类似function的产品。

简短的回答:你不能。

稍微长一点的答案:影子复制服务可以通过API以编程方式使用,以允许备份打开的文件,但该服务不会创build系统的完整快照,只能创build部分快照。