修复导出作业Repairing an export job

在完成导出作业后,可以在本地运行 Azure 导入/导出工具来执行以下操作:After an export job has completed, you can run the Azure Import/Export Tool on-premises to:

  1. 下载 Azure 导入/导出服务无法导出的任何文件。Download any files that the Azure Import/Export service was unable to export.

  2. 验证是否正确导出了驱动器上的文件。Validate that the files on the drive were correctly exported.

若要使用此功能,必须与 Azure 存储建立连接。You must have connectivity to Azure Storage to use this functionality.

用于修复导入作业的命令是 RepairExportThe command for repairing an import job is RepairExport.

RepairExport 参数RepairExport parameters

可以使用 RepairExport 指定以下参数:The following parameters can be specified with RepairExport:

参数Parameter 说明Description
/r:<RepairFile>/r:<RepairFile> 必需。Required. 修复文件的路径。该文件用于跟踪修复进度,以及恢复已中断的修复。Path to the repair file, which tracks the progress of the repair, and allows you to resume an interrupted repair. 每个驱动器都必须有且仅有一个修复文件。Each drive must have one and only one repair file. 在开始对某个给定驱动器进行修复时,会传入尚不存在的某个修复文件的路径。When you start a repair for a given drive, you will pass in the path to a repair file which does not yet exist. 若要恢复已中断的修复,应传入现有修复文件的名称。To resume an interrupted repair, you should pass in the name of an existing repair file. 始终必须指定与目标驱动器对应的修复文件。The repair file corresponding to the target drive must always be specified.
/logdir:<LogDirectory>/logdir:<LogDirectory> 可选。Optional. 日志目录。The log directory. 详细日志文件将写入此目录。Verbose log files will be written to this directory. 如果未指定任何日志目录,则使用当前目录作为日志目录。If no log directory is specified, the current directory will be used as the log directory.
/d:<TargetDirectory>/d:<TargetDirectory> 必需。Required. 用于验证和修复的目录。The directory to validate and repair. 此目录通常是导出驱动器的根目录,但也可以是包含已导出的文件副本的网络文件共享。This is usually the root directory of the export drive, but could also be a network file share containing a copy of the exported files.
/bk:<BitLockerKey>/bk:<BitLockerKey> 可选。Optional. 如果希望工具将存储已导出文件的加密目录解锁,应指定 BitLocker 密钥。You should specify the BitLocker key if you want the tool to unlock an encrypted where the exported files are stored.
/sn:<StorageAccountName>/sn:<StorageAccountName> 必需。Required. 导出作业的存储帐户的名称。The name of the storage account for the export job.
/sk:<StorageAccountKey>/sk:<StorageAccountKey> 必需 的。Required if and only if a container SAS is not specified. 导出作业的存储帐户的帐户密钥。The account key for the storage account for the export job.
/csas:<ContainerSas>/csas:<ContainerSas> 当且仅当未指定存储帐户密钥时才是必需的。Required if and only if the storage account key is not specified. 用于访问与导出作业关联的 Blob 的容器 SAS。The container SAS for accessing the blobs associated with the export job.
/CopyLogFile:<DriveCopyLogFile>/CopyLogFile:<DriveCopyLogFile> 必需。Required. 驱动器复制日志文件的路径。The path to the drive copy log file. 该文件由 Microsoft Azure 导入/导出服务生成,可以从与该作业关联的 Blob 存储下载。The file is generated by the Windows Azure Import/Export service and can be downloaded from the blob storage associated with the job. 复制日志文件包含有关要修复的已失败 Blob 或文件的信息。The copy log file contains information about failed blobs or files which are to be repaired.
/ManifestFile:<DriveManifestFile>/ManifestFile:<DriveManifestFile> 可选。Optional. 导出驱动器的清单文件的路径。The path to the export drive's manifest file. 此文件由 Azure 导入/导出服务生成,存储在导出驱动器上,或者位于与该作业关联的存储帐户的 Blob 中。This file is generated by the Azure Import/Export service and stored on the export drive, and optionally in a blob in the storage account associated with the job.

将使用在此文件中包含的 MD5 哈希验证导出驱动器上文件的内容。The content of the files on the export drive will be verified with the MD5 hashes contained in this file. 确定下载已损坏的所有文件并将其重新写入目标目录。Any files that are determined to be corrupted will be downloaded and rewritten to the target directories.

使用 RepairExport 模式更正失败的导出Using RepairExport mode to correct failed exports

可以使用 Azure 导入/导出工具来下载未能导出的文件。You can use the Azure Import/Export Tool to download files that failed to export. 复制日志文件包含未能导出的文件列表。The copy log file will contain a list of files that failed to export.

导出失败的可能原因包括:The causes of export failures include the following possibilities:

  • 驱动器受损Damaged drives

  • 传输过程中更改了存储帐户密钥The storage account key changed during the transfer process

要在 RepairExport 模式下运行该工具,首先需要将包含已导出文件的驱动器连接到计算机。To run the tool in RepairExport mode, you first need to connect the drive containing the exported files to your computer. 接下来,运行 Azure 导入/导出工具,并使用 /d 参数指定该驱动器的路径。Next, run the Azure Import/Export Tool, specifying the path to that drive with the /d parameter. 还需要指定已下载的驱动器复制日志文件的路径。You also need to specify the path to the drive's copy log file that you downloaded. 以下示例命令行运行该工具,修复未能导出的所有文件:The following command line example below runs the tool to repair any files that failed to export:

WAImportExport.exe RepairExport /r:C:\WAImportExport\9WM35C3U.rep /d:G:\ /sn:bobmediaaccount /sk:VkGbrUqBWLYJ6zg1m29VOTrxpBgdNOlp+kp0C9MEdx3GELxmBw4hK94f7KysbbeKLDksg7VoN1W/a5UuM2zNgQ== /CopyLogFile:C:\WAImportExport\9WM35C3U.log  

下面是复制日志文件的一个示例,显示未能导出的 Blob 中的一个块:The following is an example of a copy log file that shows that one block in the blob failed to export:

<?xml version="1.0" encoding="utf-8"?>  
<DriveLog>  
  <DriveId>9WM35C2V</DriveId>  
  <Blob Status="CompletedWithErrors">  
    <BlobPath>pictures/wild/desert.jpg</BlobPath>  
    <FilePath>\pictures\wild\desert.jpg</FilePath>  
    <LastModified>2012-09-18T23:47:08Z</LastModified>  
    <Length>163840</Length>  
    <BlockList>  
      <Block Offset="65536" Length="65536" Id="AQAAAA==" Status="Failed" />  
    </BlockList>  
  </Blob>  
  <Status>CompletedWithErrors</Status>  
</DriveLog>  

复制日志文件指示 Azure 导入/导出服务在将 Blob 的某个块下载到导出驱动器上的文件时发生失败。The copy log file indicates that a failure occurred while the Azure Import/Export service was downloading one of the blob's blocks to the file on the export drive. 该文件的其他组成部分已成功下载,并且正确设置了文件长度。The other components of the file downloaded successfully, and the file length was correctly set. 在本例中,工具在驱动器上打开该文件,从存储帐户下载该块并将其写入从偏移位置 65536 开始、长度为 65536 的文件范围。In this case, the tool will open the file on the drive, download the block from the storage account, and write it to the file range starting from offset 65536 with length 65536.

使用 RepairExport 验证驱动器内容Using RepairExport to validate drive contents

还可以使用提供 RepairExport 选项的 Azure 导入/导出服务来验证驱动器上的内容是否正确。You can also use Azure Import/Export with the RepairExport option to validate the contents on the drive are correct. 每个导出驱动器上的清单文件包含驱动器内容的 MD5 哈希。The manifest file on each export drive contains MD5s for the contents of the drive.

Azure 导入/导出服务还可以在导出过程中将清单文件保存到某个存储帐户。The Azure Import/Export service can also save the manifest files to a storage account during the export process. 完成作业后,可通过获取作业操作获得清单文件的位置。The location of the manifest files is available via the Get Job operation when the job has completed. 有关驱动器清单文件格式的详细信息,请参阅导入/导出服务清单文件格式See Import/Export service Manifest File Format for more information about the format of a drive manifest file.

以下示例演示如何结合 /ManifestFile/CopyLogFile 参数运行 Azure 导入/导出工具:The following example shows how to run the Azure Import/Export Tool with the /ManifestFile and /CopyLogFile parameters:

WAImportExport.exe RepairExport /r:C:\WAImportExport\9WM35C3U.rep /d:G:\ /sn:bobmediaaccount /sk:VkGbrUqBWLYJ6zg1m29VOTrxpBgdNOlp+kp0C9MEdx3GELxmBw4hK94f7KysbbeKLDksg7VoN1W/a5UuM2zNgQ== /CopyLogFile:C:\WAImportExport\9WM35C3U.log /ManifestFile:G:\9WM35C3U.manifest  

下面是清单文件的一个示例:The following is an example of a manifest file:

<?xml version="1.0" encoding="utf-8"?>  
<DriveManifest Version="2011-10-01">  
  <Drive>  
    <DriveId>9WM35C3U</DriveId>  
    <ClientCreator>Windows Azure Import/Export service</ClientCreator>  
    <BlobList>
      <Blob>  
        <BlobPath>pictures/city/redmond.jpg</BlobPath>  
        <FilePath>\pictures\city\redmond.jpg</FilePath>  
        <Length>15360</Length>  
        <PageRangeList>  
          <PageRange Offset="0" Length="3584" Hash="72FC55ED9AFDD40A0C8D5C4193208416" />  
          <PageRange Offset="3584" Length="3584" Hash="68B28A561B73D1DA769D4C24AA427DB8" />  
          <PageRange Offset="7168" Length="512" Hash="F521DF2F50C46BC5F9EA9FB787A23EED" />  
        </PageRangeList>  
        <PropertiesPath Hash="E72A22EA959566066AD89E3B49020C0A">\pictures\city\redmond.jpg.properties</PropertiesPath>  
      </Blob>  
      <Blob>  
        <BlobPath>pictures/wild/canyon.jpg</BlobPath>  
        <FilePath>\pictures\wild\canyon.jpg</FilePath>  
        <Length>10884</Length>  
        <BlockList>  
          <Block Offset="0" Length="2721" Id="AAAAAA==" Hash="263DC9C4B99C2177769C5EBE04787037" />  
          <Block Offset="2721" Length="2721" Id="AQAAAA==" Hash="0C52BAE2CC20EFEC15CC1E3045517AA6" />  
          <Block Offset="5442" Length="2721" Id="AgAAAA==" Hash="73D1CB62CB426230C34C9F57B7148F10" />  
          <Block Offset="8163" Length="2721" Id="AwAAAA==" Hash="11210E665C5F8E7E4F136D053B243E6A" />  
        </BlockList>  
        <PropertiesPath Hash="81D7F81B2C29F10D6E123D386C3A4D5A">\pictures\wild\canyon.jpg.properties</PropertiesPath>  
      </Blob> 
    </BlobList>  
 </Drive>  
</DriveManifest>  

完成修复过程后,工具将读取在该清单文件中引用的每个文件,并使用 MD5 哈希验证该文件的完整性。After finishing the repair process, the tool will read through each file referenced in the manifest file and verify the file's integrity with the MD5 hashes. 对于上面的清单文件,工具将遍历以下组成部分。For the manifest above, it will go through the following components.

G:\pictures\city\redmond.jpg, offset 0, length 3584  
  
G:\pictures\city\redmond.jpg, offset 3584, length 3584  
  
G:\pictures\city\redmond.jpg, offset 7168, length 3584  
  
G:\pictures\city\redmond.jpg.properties  
  
G:\pictures\wild\canyon.jpg, offset 0, length 2721  
  
G:\pictures\wild\canyon.jpg, offset 2721, length 2721  
  
G:\pictures\wild\canyon.jpg, offset 5442, length 2721  
  
G:\pictures\wild\canyon.jpg, offset 8163, length 2721  
  
G:\pictures\wild\canyon.jpg.properties  

工具将下载验证失败的所有组成部分,并将其重新写入驱动器上的同一文件。Any component failing the verification will be downloaded by the tool and rewritten to the same file on the drive.

后续步骤Next steps

[Troubleshooting the Azure Import/Export Tool](storage-import-export-tool-troubleshooting-v1.md)