为导入作业准备硬盘驱动器Preparing hard drives for an import job

若要为导入作业准备一个或多个硬盘驱动器,请执行以下步骤:To prepare one or more hard drives for an import job, follow these steps:

确定要导入的数据Identify the data to be imported

创建导入作业的第一步是,确定要导入的目录和文件。The first step to creating an import job is to determine which directories and files you are going to import. 可以是目录列表、独特文件的列表或这两者的组合。This can be a list of directories, a list of unique files, or a combination of those two. 包含某个目录时,该目录及其子目录中的所有文件都会成为导入作业的一部分。When a directory is included, all files in the directory and its subdirectories will be part of the import job.

Note

由于在包含父目录时将以递归方式包含子目录,因此仅指定父目录。Since subdirectories are included recursively when a parent directory is included, specify only the parent directory. 请勿同时指定其任何子目录。Do not also specify any of its subdirectories.

目前,Azure 导入/导出工具存在以下限制:如果目录包含的数据超过硬盘驱动器可包含的数据,该目录需要分解为小目录。Currently, the Azure Import/Export Tool has the following limitation: if a directory contains more data than a hard drive can contain, then the directory needs to be broken into smaller directories. 例如,如果目录包含 2.5TB 数据,而硬盘驱动器的容量仅为 2TB,则需要将此 2.5TB 目录分解为多个小目录。For example, if a directory contains 2.5TB of data and the hard drive's capacity is only 2TB, then you need to break the 2.5TB directory into smaller directories. 该工具的更高版本中将解除该限制。This limitation will be addressed in a later version of the tool.

在 Blob 服务中确定目标位置Identify the destination locations in the blob service

对于要导入的每个目录或文件,需要在 Azure Blob 服务中指定一个目标虚拟目录或 Blob。For each directory or file that will be imported, you need to identify a destination virtual directory or blob in the Azure Blob service. 这些目标将用作 Azure 导入/导出工具的输入。You will use these targets as inputs to the Azure Import/Export Tool. 请注意,目录应使用正斜杠字符“/”来分隔。Note that directories should be delimited with the forward slash character "/".

下表显示了 Blob 目标的一些示例:The following table shows some examples of blob targets:

源文件或目录Source file or directory 目标 Blob 或虚拟目录Destination blob or virtual directory
H:\VideoH:\Video https://mystorageaccount.blob.core.chinacloudapi.cn/video
H:\PhotoH:\Photo https://mystorageaccount.blob.core.chinacloudapi.cn/photo
K:\Temp\FavoriteVideo.ISOK:\Temp\FavoriteVideo.ISO https://mystorageaccount.blob.core.chinacloudapi.cn/favorite/FavoriteVideo.ISO
\myshare\john\music\\myshare\john\music https://mystorageaccount.blob.core.chinacloudapi.cn/music

确定所需的驱动器数Determine how many drives are needed

接下来,需要确定:Next, you need to determine:

  • 存储数据所需的硬盘驱动器数。The number of hard drives needed to store the data.

  • 将复制到每个硬盘驱动器中的目录和/或独立文件。The directories and/or standalone files that will be copied to each of your hard drive.

    确保准备好所需数量的硬盘驱动器,以便能够存储所要传输的数据。Ensure that you have the number of hard drives you will need to store the data you are transferring.

将数据复制到硬盘驱动器Copy data to your hard drive

本部分介绍如何调用 Azure 导入/导出工具,将数据复制到一个或多个硬盘驱动器。This section describes how to call the Azure Import/Export Tool to copy your data to one or more hard drives. 每次调用 Azure 导入/导出工具都会创建一个新的复制会话。Each time you call the Azure Import/Export Tool, you create a new copy session. 需要为数据复制到的每个驱动器至少创建一个复制会话;在某些情况下,可能需要使用多个复制会话将所有数据复制到单个驱动器。You create at least one copy session for each drive to which you copy data; in some cases, you may need more than one copy session to copy all of your data to single drive. 下面是可能需要多个复制会话的一些原因:Here are some reasons that you may need multiple copy sessions:

  • 必须为将数据复制到的每个驱动器创建一个单独的复制会话。You must create a separate copy session for each drive that you copy to.

  • 复制会话可将单个目录或单个 Blob 复制到驱动器。A copy session can copy either a single directory or a single blob to the drive. 若要复制多个目录、多个 Blob 或两者的组合,需要创建多个复制会话。If you are copying multiple directories, multiple blobs, or a combination of both, you'll need to create multiple copy sessions.

  • 可以指定要在执行导入作业过程中导入的 Blob 上设置的属性和元数据。You can specify properties and metadata that will be set on the blobs imported as part of an import job. 为某个复制会话指定的属性或元数据将应用到该复制会话指定的所有 Blob。The properties or metadata that you specify for a copy session will apply to all blobs specified by that copy session. 若要为某些 Blob 指定不同的属性或元数据,需要创建单独的复制会话。If you want to specify different properties or metadata for some blobs, you'll need to create a separate copy session. 有关详细信息,请参阅在导入过程中设置属性和元数据See Setting Properties and Metadata during the Import Processfor more information.

Note

如果有多台计算机满足设置 Azure 导入/导出工具中所述的要求,可以通过在每台计算机上运行此工具的实例,将数据并行复制到多个硬盘驱动器。If you have multiple machines that meet the requirements outlined in Setting Up the Azure Import/Export Tool, you can copy data to multiple hard drives in parallel by running an instance of this tool on each machine.

对于使用 Azure 导入/导出工具准备的每个硬盘驱动器,该工具创建单个日记文件。For each hard drive that you prepare with the Azure Import/Export Tool, the tool will create a single journal file. 需要使用所有驱动器中的日记文件创建导入作业。You will need the journal files from all of your drives to create the import job. 在工具中断的情况下,还可使用日记文件来恢复驱动器准备操作。The journal file can also be used to resume drive preparation if the tool is interrupted.

导入作业的 Azure 导入/导出工具语法Azure Import/Export Tool syntax for an import job

若要为导入作业准备驱动器,请使用 PrepImport 命令调用 Azure 导入/导出工具。To prepare drives for an import job, call the Azure Import/Export Tool with the PrepImport command. 要包含的参数取决于这是第一个复制会话还是后续复制会话。Which parameters you include depends on whether this is the first copy session, or a subsequent copy session.

驱动器的第一个复制会话需要一些附加参数来指定:存储帐户密钥;目标驱动器号;是否必须格式化驱动器;是否必须对驱动器加密,如果是,则指定 BitLocker 密钥;以及日志目录。The first copy session for a drive requires some additional parameters to specify the storage account key; the target drive letter; whether the drive must be formatted; whether the drive must be encrypted and if so, the BitLocker key; and the log directory. 下面是用于复制目录或单个文件的初始复制会话的语法:Here is the syntax for an initial copy session to copy a directory or a single file:

用于复制单个目录的第一个复制会话First copy session to copy a single directory

WAImportExport PrepImport /sk:<StorageAccountKey> /csas:<ContainerSas> /t: <TargetDriveLetter> [/format] [/silentmode] [/encrypt] [/bk:<BitLockerKey>] [/logdir:<LogDirectory>] /j:<JournalFile> /id:<SessionId> /srcdir:<SourceDirectory> /dstdir:<DestinationBlobVirtualDirectory> [/Disposition:<Disposition>] [/BlobType:<BlockBlob|PageBlob>] [/PropertyFile:<PropertyFile>] [/MetadataFile:<MetadataFile>]

用于复制单个文件的第一个复制会话First copy session to copy a single file

WAImportExport PrepImport /sk:<StorageAccountKey> /csas:<ContainerSas> /t: <TargetDriveLetter> [/format] [/silentmode] [/encrypt] [/bk:<BitLockerKey>] [/logdir:<LogDirectory>] /j:<JournalFile> /id:<SessionId> /srcfile:<SourceFile> /dstblob:<DestinationBlobPath> [/Disposition:<Disposition>] [/BlobType:<BlockBlob|PageBlob>] [/PropertyFile:<PropertyFile>] [/MetadataFile:<MetadataFile>]

在后续复制会话中,无需指定初始参数。In subsequent copy sessions, you do not need to specify the initial parameters. 下面是用于复制目录或单个文件的后续复制会话的语法:Here is the syntax for a subsequent copy session to copy a directory or a single file:

用于复制单个目录的后续复制会话Subsequent copy sessions to copy a single directory

WAImportExport PrepImport /j:<JournalFile> /id:<SessionId> /srcdir:<SourceDirectory> /dstdir:<DestinationBlobVirtualDirectory> [/Disposition:<Disposition>] [/BlobType:<BlockBlob|PageBlob>] [/PropertyFile:<PropertyFile>] [/MetadataFile:<MetadataFile>]

用于复制单个文件的后续复制会话Subsequent copy sessions to copy a single file

WAImportExport PrepImport /j:<JournalFile> /id:<SessionId> /srcfile:<SourceFile> /dstblob:<DestinationBlobPath> [/Disposition:<Disposition>] [/BlobType:<BlockBlob|PageBlob>] [/PropertyFile:<PropertyFile>] [/MetadataFile:<MetadataFile>]

硬盘驱动器的第一个复制会话的参数Parameters for the first copy session for a hard drive

每次运行 Azure 导入/导出工具将文件复制到硬盘驱动器时,该工具会创建一个复制会话。Each time you run the Azure Import/Export Tool to copy files to the hard drive, the tool creates a copy session. 每个复制会话会将单个目录或单个文件复制到硬盘驱动器。Each copy session copies a single directory or a single file to a hard drive. 复制会话的状态将写入日记文件。The state of the copy session is written to the journal file. 如果某个复制会话中断(例如,由于系统电源中断),可以通过重新运行该工具并在命令行上指定日记文件来恢复该复制会话。If a copy session is interrupted (for example, due to a system power loss), it can be resumed by running the tool again and specifying the journal file on the command line.

Warning

如果为第一个复制会话指定 /format 参数,将格式化驱动器并清除该驱动器上的所有数据。If you specify the /format parameter for the first copy session, the drive will be formatted and all data on the drive will be erased. 建议仅对复制会话使用空白驱动器。It's recommended that you use blank drives only for your copy session.

用于每个驱动器的第一个复制会话的命令需要的参数不同于后续复制会话的命令所需的参数。The command used for the first copy session for each drive requires different parameters than the commands for subsequent copy sessions. 下表列出了可用于第一个复制会话的附加参数:The following table lists the additional parameters that are available for the first copy session:

命令行参数Command-line parameter 说明Description
/sk:<StorageAccountKey>/sk:<StorageAccountKey> Optional. 将数据导入到的存储帐户的存储帐户密钥。Optional. The storage account key for the storage account to which the data will be imported. 必须在命令中包含 /sk:<StorageAccountKey> 或 /csas:<ContainerSas>。You must include either /sk:<StorageAccountKey> or /csas:<ContainerSas> in the command.
/csas:<ContainerSas>/csas:<ContainerSas> OptionalOptional. 用于将数据导入存储帐户的容器 SAS。The container SAS to use to import data to the storage account. 必须在命令中包含 /sk:<StorageAccountKey> 或 /csas:<ContainerSas>。You must include either /sk:<StorageAccountKey> or /csas:<ContainerSas> in the command.

此参数的值必须以容器名称开头,后接问号 (?) 和 SAS 令牌。The value for this parameter must begin with the container name, followed by a question mark (?) and the SAS token. 例如:For example:

mycontainer?sv=2014-02-14&sr=c&si=abcde&sig=LiqEmV%2Fs1LF4loC%2FJs9ZM91%2FkqfqHKhnz0JM6bqIqN0%3D&se=2014-11-20T23%3A54%3A14Z&sp=rwdl

无论是在 URL 上还是存储的访问策略中指定,权限都必须包括“读取”、“写入”和“删除”导入作业,以及“读取”、“写入”和“列出”导出作业。The permissions, whether specified on the URL or in a stored access policy, must include Read, Write, and Delete for import jobs, and Read, Write and List for export jobs.

指定此参数时,要导入或导出的所有 Blob 都必须位于共享访问签名中指定的容器内。When this parameter is specified, all blobs to be imported or exported must be within the container specified in the shared access signature.
/t:<TargetDriveLetter>/t:<TargetDriveLetter> Required. 当前复制会话的目标硬盘驱动器的驱动器号(不带尾随冒号)。Required. The drive letter of the target hard drive for the current copy session, without the trailing colon.
/format/format Optional. 在需要格式化驱动器时指定此参数;否则,请将其忽略。Optional. Specify this parameter when the drive needs to be formatted; otherwise, omit it. 在对驱动器进行格式化之前,该工具将提示你通过控制台进行确认。Before the tool formats the drive, it will prompt for a confirmation from console. 若不希望显示该确认,请指定 /silentmode 参数。To suppress the confirmation, specify the /silentmode parameter.
/silentmode/silentmode Optional. 指定此参数不会显示对目标驱动器进行格式化的确认。Optional. Specify this parameter to suppress the confirmation for formatting the target drive.
/encrypt/encrypt Optional. 在尚未使用 BitLocker 对驱动器进行加密但需要使用此工具进行加密时,指定此参数。Optional. Specified this parameter when the drive has not yet been encrypted with BitLocker and needs to be encrypted by the tool. 如果已使用 BitLocker 对驱动器进行加密,则在提供现有 BitLocker 密钥的情况下,忽略此参数并指定 /bk 参数。If the drive has already been encrypted with BitLocker, then omit this parameter and specify the /bk parameter, providing the existing BitLocker key.

如果指定 /format 参数,还必须指定 /encrypt 参数。If you specify the /format parameter, then you must also specify the /encrypt parameter.
/bk:<BitLockerKey>/bk:<BitLockerKey> Optional. 如果省略 /encrypt ,请省略此参数。Optional. If /encrypt is specified, omit this parameter. 如果省略 /encrypt ,则需要事先使用 BitLocker 为驱动器加密。If /encrypt is omitted, you need to have already have encrypted the drive with BitLocker. 使用此参数可指定 BitLocker 密钥。Use this parameter to specify the BitLocker key. 导入作业的所有硬盘驱动器都需要 BitLocker 加密。BitLocker encryption is required for all hard drives for import jobs.
/logdir:<LogDirectory>/logdir:<LogDirectory> Optional. 日志目录指定用于存储详细日志和临时清单文件的目录。Optional. The log directory specifies a directory to be used to store verbose logs as well as temporary manifest files. 如果未指定,则使用当前目录作为日志目录。If not specified, the current directory will be used as the log directory.

所有复制会话所需的参数Parameters required for all copy sessions

日记文件包含硬盘驱动器的所有复制会话的状态。The journal file contains the status for all copy sessions for a hard drive. 它还包含创建导入作业所需的信息。It also contains the information needed to create the import job. 运行 Azure 导入/导出工具时,必须始终指定一个日志文件,以及一个复制会话 ID:You must always specify a journal file when running the Azure Import/Export Tool, as well as a copy session ID:

命令行参数Command line parameter 说明Description
/j:<JournalFile>/j:<JournalFile> Required. 日记文件的路径。Required. The path to the journal file. 每个驱动器必须正好有一个日志文件。Each drive must have exactly one journal file. 请注意,日志文件不得驻留在目标驱动器上。Note that the journal file must not reside on the target drive. 日记文件扩展名为 .jrnThe journal file extension is .jrn.
/id:<SessionId>/id:<SessionId> Required. 会话 ID 标识复制会话。Required. The session ID identifies a copy session. 它用于确保准确恢复中断的复制会话。It is used to ensure accurate recovery of an interrupted copy session. 复制会话中复制的文件存储在以目标驱动器上的会话 ID 命名的目录中。Files that are copied in a copy session are stored in a directory named after the session ID on the target drive.

用于复制单个目录的参数Parameters for copying a single directory

复制单个目录时,可应用以下必需和可选参数:When copying a single directory, the following required and optional parameters apply:

命令行参数Command line parameter 说明Description
/srcdir:<SourceDirectory>/srcdir:<SourceDirectory> Required. 包含要复制到目标驱动器中的文件的源目录。Required. The source directory that contains files to be copied to the target drive. 目录路径必须是绝对路径(而非相对路径)。The directory path must be an absolute path (not a relative path).
/dstdir:<DestinationBlobVirtualDirectory>/dstdir:<DestinationBlobVirtualDirectory> Required. Azure 存储帐户中目标虚拟目录的路径。Required. The path to the destination virtual directory in your Azure storage account. 虚拟目录可能存在,也可能不存在。The virtual directory may or may not already exist.

可以指定容器或 blob 前缀(如 music/70s/)。You can specify a container, or a blob prefix like music/70s/. 目标目录必须以容器名称开头,后接正斜杠“/”,并且可以选择包含以“/”结尾的虚拟 blob 目录。The destination directory must begin with the container name, followed by a forward slash "/", and optionally may include a virtual blob directory that ends with "/".

目标容器为根容器时,必须显式指定根容器(包含正斜杠,如 $root/)。When the destination container is the root container, you must explicitly specify the root container, including the forward slash, as $root/. 由于根容器下的 Blob 的名称中不能包含“/”,因此当目标目录为根容器时,不会复制源目录中的任何子目录。Since blobs under the root container cannot include "/" in their names, any subdirectories in the source directory will not be copied when the destination directory is the root container.

在指定目标虚拟目录或 blob 时,请确保使用有效的容器名称。Be sure to use valid container names when specifying destination virtual directories or blobs. 请记住,容器名称必须是小写的。Keep in mind that container names must be lowercase. 有关容器命名规则,请参阅命名和引用容器、Blob 与元数据For container naming rules, see Naming and Referencing Containers, Blobs, and Metadata.
/Disposition:<rename|no-overwrite|overwrite>/Disposition:<rename|no-overwrite|overwrite> Optional. 指定存在带指定地址的 Blob 时的行为。Optional. Specifies the behavior when a blob with the specified address already exists. 此参数的有效值为:renameno-overwriteoverwriteValid values for this parameter are: rename, no-overwrite and overwrite. 请注意,这些值区分大小写。Note that these values are case-sensitive. 如果未指定任何值,将使用默认值 renameIf no value is specified, the default is rename.

为此参数指定的值会影响 /srcdir 参数指定的目录中的所有文件。The value specified for this parameter affects all the files in the directory specified by the /srcdir parameter.
/BlobType:<BlockBlob|PageBlob>/BlobType:<BlockBlob|PageBlob> Optional. 指定目标 blob 的 blob 类型。Optional. Specifies the blob type for the destination blobs. 有效值为:BlockBlobPageBlobValid values are: BlockBlob and PageBlob. 请注意,这些值区分大小写。Note that these values are case-sensitive. 如果未指定任何值,将使用默认值 BlockBlobIf no value is specified, the default is BlockBlob.

大多数情况下,建议使用 BlockBlobIn most cases, BlockBlob is recommended. 如果指定 PageBlob,目录中每个文件的长度必须是 512 的倍数(即页 blob 的页面大小)。If you specify PageBlob, the length of each file in the directory must be a multiple of 512, the size of a page for page blobs.
/PropertyFile:<PropertyFile>/PropertyFile:<PropertyFile> Optional. 目标 Blob 的属性文件的路径。Optional. Path to the property file for the destination blobs. 有关详细信息,请参阅导入/导出服务元数据和属性文件格式See Import/Export service Metadata and Properties File Format for more information.
/MetadataFile:<MetadataFile>/MetadataFile:<MetadataFile> Optional. 目标 Blob 的元数据文件的路径。Optional. Path to the metadata file for the destination blobs. 有关详细信息,请参阅导入/导出服务元数据和属性文件格式See Import/Export service Metadata and Properties File Format for more information.

用于复制单个文件的参数Parameters for copying a single file

复制单个文件时,可应用以下必需和可选参数:When copying a single file, the following required and optional parameters apply:

命令行参数Command line parameter 说明Description
/srcfile:<SourceFile>/srcfile:<SourceFile> Required. 要复制的文件的完整路径。Required. The full path to the file to be copied. 目录路径必须是绝对路径(而非相对路径)。The directory path must be an absolute path (not a relative path).
/dstblob:<DestinationBlobPath>/dstblob:<DestinationBlobPath> Required. Azure 存储帐户中目标 blob 的路径。Required. The path to the destination blob in your Azure storage account. 该 blob 可能存在,也可能不存在。The blob may or may not already exist.

指定以容器名称开头的 blob 名称。Specify the blob name beginning with the container name. Blob 名称不能以“/”或存储帐户名称开头。The blob name cannot start with "/" or the storage account name. 有关 blob 命名规则,请参阅命名和引用容器、Blob 与元数据For blob naming rules, see Naming and Referencing Containers, Blobs, and Metadata.

目标容器为根容器时,必须显式将 $root 指定为容器,如 $root/sample.txtWhen the destination container is the root container, you must explicitly specify $root as the container, such as $root/sample.txt. 请注意,根容器下的 blob 的名称中不能包含“/”。Note that blobs under the root container cannot include "/" in their names.
/Disposition:<rename|no-overwrite|overwrite>/Disposition:<rename|no-overwrite|overwrite> Optional. 指定存在带指定地址的 Blob 时的行为。Optional. Specifies the behavior when a blob with the specified address already exists. 此参数的有效值为:renameno-overwriteoverwriteValid values for this parameter are: rename, no-overwrite and overwrite. 请注意,这些值区分大小写。Note that these values are case-sensitive. 如果未指定任何值,则使用默认值 renameIf no value is specified, the default is rename.
/BlobType:<BlockBlob|PageBlob>/BlobType:<BlockBlob|PageBlob> Optional. 指定目标 blob 的 blob 类型。Optional. Specifies the blob type for the destination blobs. 有效值为:BlockBlobPageBlobValid values are: BlockBlob and PageBlob. 请注意,这些值区分大小写。Note that these values are case-sensitive. 如果未指定任何值,将使用默认值 BlockBlobIf no value is specified, the default is BlockBlob.

大多数情况下,建议使用 BlockBlobIn most cases, BlockBlob is recommended. 如果指定 PageBlob,目录中每个文件的长度必须是 512 的倍数(即页 blob 的页面大小)。If you specify PageBlob, the length of each file in the directory must be a multiple of 512, the size of a page for page blobs.
/PropertyFile:<PropertyFile>/PropertyFile:<PropertyFile> Optional. 目标 Blob 的属性文件的路径。Optional. Path to the property file for the destination blobs. 有关详细信息,请参阅导入/导出服务元数据和属性文件格式See Import/Export service Metadata and Properties File Format for more information.
/MetadataFile:<MetadataFile>/MetadataFile:<MetadataFile> Optional. 目标 Blob 的元数据文件的路径。Optional. Path to the metadata file for the destination blobs. 有关详细信息,请参阅导入/导出服务元数据和属性文件格式See Import/Export service Metadata and Properties File Format for more information.

恢复已中断的复制会话Resuming an interrupted copy session

如果复制会话因任何原因导致中断,可通过在仅指定日记文件的情况下运行该工具来恢复会话:If a copy session is interrupted for any reason, you can resume it by running the tool with only the journal file specified:

WAImportExport.exe PrepImport /j:<JournalFile> /id:<SessionId> /ResumeSession

只能恢复最近异常终止的复制会话。Only the most recent copy session, if terminated abnormally, can be resumed.

Important

恢复复制会话时,请不要通过添加或删除文件来修改源数据文件和目录。When you resume a copy session, do not modify the source data files and directories by adding or removing files.

中止已中断的复制会话Aborting an interrupted copy session

如果复制会话已中断且无法恢复(例如,如果源目录被证实不可访问),则必须中止当前会话,使其可以回滚并启动新的复制会话:If a copy session is interrupted and it is not possible to resume (for example, if a source directory proved inaccessible), you must abort the current session so that it can be rolled back and new copy sessions can be started:

WAImportExport.exe PrepImport /j:<JournalFile> /id:<SessionId> /AbortSession

如果异常终止,则只能中止最后的复制会话。Only the last copy session, if terminated abnormally, can be aborted. 请注意,无法中止驱动器的第一个复制会话。Note that you cannot abort the first copy session for a drive. 在此情况下,必须重新启动包含新日记文件的复制会话。Instead you must restart the copy session with a new journal file.

后续步骤Next steps