如何将 Azure 磁盘映射到 Windows VM 来宾磁盘How to map Azure Disks to Windows VM guest disks

你需要确定支持 VM 来宾磁盘的 Azure 磁盘。You may need to determine the Azure Disks that back a VM's guest disks. 在某些方案中,可以将磁盘或卷大小与附加的 Azure 磁盘的大小进行比较。In some scenarios, you can compare the disk or volume size to the size of the attached Azure Disks. 如果有多个相同大小的 Azure 磁盘附加到 VM,则需要使用数据磁盘的逻辑单元号 (LUN)。In scenarios where there are multiple Azure Disks of the same size attached to the VM you need to use the Logical Unit Number (LUN) of the data disks.

什么是 LUN?What is a LUN?

逻辑单元号 (LUN) 是用于标识特定存储设备的数字。A Logical Unit Number (LUN) is a number that is used to identify a specific storage device. 会为每个存储设备分配一个唯一的数字标识符(从零开始)。Each storage device is assigned a unique numeric identifier, starting at zero. 设备的完整路径由总线编号、目标 ID 号和逻辑单元号 (LUN) 表示。The full path to a device is represented by the bus number, target ID number, and Logical Unit Number (LUN).

例如:总线编号 0,目标 ID 0,LUN 3For example: Bus Number 0, Target ID 0, LUN 3

在我们的练习中,只需要使用 LUN。For our exercise, you only need to use the LUN.

查找 LUNFinding the LUN

有两种方法可查找 LUN,选择哪一种方法取决于你是否使用存储空间There are two methods to finding the LUN, which one you choose will depend on if you are using Storage Spaces or not.

磁盘管理Disk Management

如果使用的不是存储池,则可以使用磁盘管理查找 LUN。If you are not using Storage Pools, you can use Disk Management to find the LUN.

  1. 连接到 VM 并打开“磁盘管理”Connect to the VM and open Disk Management

    a.a. 右键单击“开始”按钮并选择“磁盘管理”。Right-click on the Start button and choose "Disk Management" b. 还可以在“开始搜索”框中键入 diskmgmt.mscYou can also type diskmgmt.msc into the Start Search box

  2. 在下面的窗格中,右键单击任一磁盘,然后选择“属性”In the lower pane, right-click any of the Disks and choose "Properties"

  3. LUN 列在“常规”选项卡上的“位置”属性中The LUN will be listed in the "Location" property on the "General" tab

存储池Storage Pools

  1. 连接到 VM 并打开“服务器管理器”Connect to the VM and open Server Manager
  2. 选择“文件和存储服务”、“卷”、“存储池”Select "File and Storage Services", "Volumes", "Storage Pools"
  3. 在“服务器管理器”右下角,会出现一个“物理磁盘”部分。In the bottom-right corner of Server Manager, there will be a "Physical Disks" section. 此处列出了构成存储池的磁盘,以及每个磁盘的 LUN。The disks that make up the Storage Pool are listed here as well as the LUN for each disk.

查找 Azure 磁盘的 LUNFinding the LUN for the Azure Disks

可以使用 Azure 门户、Azure CLI 或 Azure PowerShell 查找 LUNYou can locate the LUN for an Azure Disk using the Azure portal, Azure CLI, or Azure PowerShell

在 Azure 门户中查找 Azure 磁盘的 LUNFinding an Azure Disk's LUN in the Azure portal

  1. 在 Azure 门户中,选择“虚拟机”以显示虚拟机的列表In the Azure portal, select "Virtual Machines" to display a list of your Virtual Machines
  2. 选择虚拟机Select the Virtual Machine
  3. 选择“磁盘”Select "Disks"
  4. 从附加的磁盘列表中选择一个数据磁盘。Select a data disk from the list of attached disks.
  5. 磁盘的 LUN 显示在“磁盘详细信息”窗格中。The LUN of the disk will be displayed in the disk detail pane. 此处显示的 LUN 与使用设备管理器或服务器管理器在来宾中查找的 LUN 相关联。The LUN displayed here correlates to the LUNs that were looked up in the Guest using Device Manager or Server Manager.

使用 Azure CLI 或 Azure PowerShell 查找 Azure 磁盘的 LUNFinding an Azure Disk's LUN using Azure CLI or Azure PowerShell

az vm show -g myResourceGroup -n myVM --query "storageProfile.dataDisks"