Repairing an import job

The Microsoft 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.

You can run the Microsoft Azure Import/Export Tool with the import job's copy log files, and the tool uploads the missing files (or parts of a file) to your Windows Azure storage account to complete the import job.

RepairImport parameters

The following parameters can be specified with RepairImport:

/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 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> 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> Required. One or more semicolon-separated directories that contain the original files that were imported. The import drive may also be used, but is not required if alternate locations of original files are available.
/bk:<BitLockerKey> Optional. You should specify the BitLocker key if you want the tool to unlock an encrypted drive where the original files are available.
/sn:<StorageAccountName> Required. The name of the storage account for the import job.
/sk:<StorageAccountKey> Required if and only if a container SAS is not specified. The account key for the storage account for the import job.
/csas:<ContainerSas> Required if and only if the storage account key is not specified. The container SAS for accessing the blobs associated with the import job.
/CopyLogFile:<DriveCopyLogFile> Required. Path to the drive copy log file (either verbose log or error log). The file is generated by the Windows Azure Import/Export service and can be downloaded from the blob storage associated with the job. The copy log file contains information about failed blobs or files, which are to be repaired.
/PathMapFile:<DrivePathMapFile> Optional. Path to a text file that can be 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. Subsequent runs of the tool use this file to resolve the ambiguities.

Using the RepairImport command

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. You must 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  

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. Since this is the only failure indicated, the rest of the blobs in the job were successfully imported.

<?xml version="1.0" encoding="utf-8"?>  
<DriveLog>  
 <DriveId>9WM35C2V</DriveId>  
 <Blob Status="CompletedWithErrors">  
 <BlobPath>pictures/animals/koala.jpg</BlobPath>  
 <FilePath>\animals\koala.jpg</FilePath>  
 <Length>163840</Length>  
 <ImportDisposition Status="Overwritten">overwrite</ImportDisposition>  
 <PageRangeList>  
  <PageRange Offset="65536" Length="65536" Hash="AA2585F6F6FD01C4AD4256E018240CD4" Status="Corrupted" />  
 </PageRangeList>  
 </Blob>  
 <Status>CompletedWithErrors</Status>  
</DriveLog>  

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. Following 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. If 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.windows.net/pictures/animals/koala.jpg.

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 could not be found, the file is not accessible, the file name is ambiguous, or the content of the file is no longer correct.

An ambiguous error could occur if the tool is trying to locate \animals\koala.jpg and there is a file with that name under both C:\Users\bob\pictures and X:\BobBackup\photos. That is, both C:\Users\bob\pictures\animals\koala.jpg and X:\BobBackup\photos\animals\koala.jpg exist on the import job drives.

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 was not able to correctly identify. The 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  

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:

\animals\koala.jpg  
\animals\kangaroo.jpg  

For each file in the list, you should attempt to locate and open the file to ensure it is available to the tool. If you wish to tell the tool explicitly where to find a file, you can 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