修复导入作业Repairing an import job

Azure 导入/导出服务可能无法将某些文件或某个文件的部分内容复制到 Windows Azure Blob 服务。The Azure Import/Export service may fail to copy some of your files or parts of a file to the Windows Azure Blob service. 失败的部分原因包括:Some reasons for failures include:

  • 文件已损坏Corrupted files

  • 驱动器受损Damaged drives

  • 存储帐户密钥在传输文件时已更改。The storage account key changed while the file was being transferred.

可以使用导入作业的复制日志文件运行 Azure 导入/导出工具。You can run the Azure Import/Export Tool with the import job's copy log files. 该工具会将缺少的文件(或某个文件的部分内容)上传到 Windows Azure 存储帐户,从而完成导入作业。The tool uploads the missing files, or parts of a file, to your Windows Azure storage account to complete the import job.

RepairImport 参数RepairImport parameters

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

参数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, pass in the path to a repair file, which doesn't yet exist. 若要恢复已中断的修复,应该传入现有修复文件的名称。To resume an interrupted repair, you should pass in the name of an existing repair file. 始终指定与目标驱动器对应的修复文件。Always specify the repair file corresponding to the target drive.
/logdir:<LogDirectory>/logdir:<LogDirectory> 可选。Optional. 日志目录。The log directory. 详细日志文件将写入此目录。Verbose log files are written to this directory. 如果未指定任何日志目录,将使用当前目录作为日志目录。If no log directory is specified, the current directory is used as the log directory.
/d:<TargetDirectories>/d:<TargetDirectories> 必需。Required. 包含已导入的原始文件的一个或多个目录(以分号分隔)。One or more semicolon-separated directories that contain the original files that were imported. 也可以使用导入驱动器,但如果原始文件的备用位置可用,则无需使用该驱动器。The import drive may also be used, but isn't required if alternate locations of original files are available.
/bk: <BitLockerKey>/bk:<BitLockerKey> 可选。Optional. 如果希望工具将原始文件所在的已加密驱动器解锁,请指定 BitLocker 密钥。Specify the BitLocker key if you want the tool to unlock an encrypted drive where the original files are available.
/sn:<StorageAccountName>/sn:<StorageAccountName> 必需。Required. 导入作业的存储帐户的名称。The name of the storage account for the import job.
/sk:<StorageAccountKey>/sk:<StorageAccountKey> 当且仅当未指定容器 SAS 时才是必需的。Required if and only if a container SAS isn't specified. 导入作业的存储帐户的帐户密钥。The account key for the storage account for the import job.
/csas:<ContainerSas>/csas:<ContainerSas> 当且仅当未指定存储帐户密钥时才是必需的。Required if and only if the storage account key isn't specified. 用于访问与导入作业关联的 Blob 的容器 SAS。The container SAS for accessing the blobs associated with the import job.
/CopyLogFile:<DriveCopyLogFile>/CopyLogFile:<DriveCopyLogFile> 必需。Required. 驱动器复制日志文件(详细日志或错误日志)的路径。Path to the drive copy log file (either verbose log or error log). 该文件由 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.
/PathMapFile:<DrivePathMapFile>/PathMapFile:<DrivePathMapFile> 可选。Optional. 用于解决歧义(如果在同一作业中导入多个同名文件)的文本文件的路径。Path to a text file used to resolve ambiguities if you have multiple files with the same name that you were importing in the same job. 工具首次运行时,会在此文件中填充所有不明确的名称。The first time the tool is run, it can populate this file with all of the ambiguous names. 工具以后运行时会使用此文件来解决歧义。Later runs of the tool use this file to resolve the ambiguities.

使用 RepairImport 命令Using the RepairImport command

若要通过网络流式传输导入数据来修复这些数据,必须使用 /d 参数指定包含导入的原始文件的目录。To repair import data by streaming the data over the network, you must specify the directories that contain the original files you were importing using the /d parameter. 此外,指定从存储帐户下载的复制日志文件。Also specify the copy log file that you downloaded from your storage account. 下面显示了一个用于修复部分失败的导入作业的典型命令行:A typical command line to repair an import job with partial failures looks like:

WAImportExport.exe RepairImport /r:C:\WAImportExport\9WM35C2V.rep /d:C:\Users\bob\Pictures;X:\BobBackup\photos /sn:bobmediaaccount /sk:VkGbrUqBWLYJ6zg1m29VOTrxpBgdNOlp+kp0C9MEdx3GELxmBw4hK94f7KysbbeKLDksg7VoN1W/a5UuM2zNgQ== /CopyLogFile:C:\WAImportExport\9WM35C2V.log  

在以下复制日志文件的示例中,为导入作业寄送的驱动器上某个文件的 64K 内容已损坏。In the following example of a copy log file, one 64-K piece of a file was corrupted on the drive that was shipped for the import job. 由于此失败是指出的唯一失败,因此作业中剩余 Blob 已成功导入。Since this failure is the only one indicated, the rest of the blobs in the job were successfully imported.

<?xml version="1.0" encoding="utf-8"?>  
 <Blob Status="CompletedWithErrors">  
 <ImportDisposition Status="Overwritten">overwrite</ImportDisposition>  
  <PageRange Offset="65536" Length="65536" Hash="AA2585F6F6FD01C4AD4256E018240CD4" Status="Corrupted" />  

将此复制日志传递给 Azure 导入/导出工具后,该工具将尝试通过网络复制缺少的内容来完成此文件的导入。When this copy log is passed to the Azure Import/Export Tool, the tool tries to finish the import for this file by copying the missing contents across the network. 根据上面的示例,该工具会在两个目录(C:\Users\bob\PicturesX:\BobBackup\photos)中查找原始文件 \animals\koala.jpgFollowing the example above, the tool looks for the original file \animals\koala.jpg within the two directories C:\Users\bob\Pictures and X:\BobBackup\photos. 如果文件 C:\Users\bob\Pictures\animals\koala.jpg 存在,Azure 导入/导出工具会将缺少的数据部分复制到对应的 Blob http://bobmediaaccount.blob.core.chinacloudapi.cn/pictures/animals/koala.jpgIf the file C:\Users\bob\Pictures\animals\koala.jpg exists, the Azure Import/Export Tool copies the missing range of data to the corresponding blob http://bobmediaaccount.blob.core.chinacloudapi.cn/pictures/animals/koala.jpg.

使用 RepairImport 时解决冲突Resolving conflicts when using RepairImport

在某些情况下,可能会出于以下原因之一,工具无法找到或打开所需的文件:找不到该文件、文件不可访问、文件名不明确,或文件内容不再正确。In some situations, the tool may not be able to find or open the necessary file for one of the following reasons: the file couldn't be found, the file isn't accessible, the file name is ambiguous, or the content of the file is no longer correct.

如果工具尝试查找 \animals\koala.jpg 并且 C:\Users\bob\picturesX:\BobBackup\photos 中存在同名的文件,可能会发生歧义错误。An ambiguous error could occur if the tool is trying to locate \animals\koala.jpg and there's a file with that name under both C:\Users\bob\pictures and X:\BobBackup\photos. 也就是说,C:\Users\bob\pictures\animals\koala.jpgX:\BobBackup\photos\animals\koala.jpg 都位于导入作业驱动器上。That is, both C:\Users\bob\pictures\animals\koala.jpg and X:\BobBackup\photos\animals\koala.jpg exist on the import job drives.

使用 /PathMapFile 选项可以解决这些错误。The /PathMapFile option allows you to resolve these errors. 可以指定包含工具无法正确识别的文件列表的文件名称。You can specify the name of the file, which contains the list of files that the tool couldn't correctly identify. 以下命令行示例填充 9WM35C2V_pathmap.txtThe following command-line example populates 9WM35C2V_pathmap.txt:

WAImportExport.exe RepairImport /r:C:\WAImportExport\9WM35C2V.rep /d:C:\Users\bob\Pictures;X:\BobBackup\photos /sn:bobmediaaccount /sk:VkGbrUqBWLYJ6zg1m29VOTrxpBgdNOlp+kp0C9MEdx3GELxmBw4hK94f7KysbbeKLDksg7VoN1W/a5UuM2zNgQ== /CopyLogFile:C:\WAImportExport\9WM35C2V.log /PathMapFile:C:\WAImportExport\9WM35C2V_pathmap.txt  

然后,工具会将有问题的文件路径写入 9WM35C2V_pathmap.txt(每行一个路径)。The tool will then write the problematic file paths to 9WM35C2V_pathmap.txt, one on each line. 例如,在运行该命令后,该文件可能包含以下条目:For instance, the file may contain the following entries after running the command:


对于列表中的每个文件,应尝试找到并打开该文件,确保工具可对其进行处理。For each file in the list, you should attempt to locate and open the file to ensure it's available to the tool. 若要明确告知工具可找到文件的位置,请修改路径映射文件,并在同一行上添加每个文件的路径(制表符分隔):If you wish to tell the tool explicitly where to find a file, modify the path map file and add the path to each file on the same line, separated by a tab character:

\animals\koala.jpg           C:\Users\bob\Pictures\animals\koala.jpg  
\animals\kangaroo.jpg        X:\BobBackup\photos\animals\kangaroo.jpg  

使工具可以处理所需的文件或者更新路径映射文件后,可返回此工具完成导入过程。After making the necessary files available to the tool, or updating the path map file, you can rerun the tool to complete the import process.

后续步骤Next steps