建立 Azure Stack HCI 的記憶體路徑

適用於:Azure Stack HCI 版本 23H2

本文說明如何為 Azure Stack HCI 叢集上使用的 VM 映射建立記憶體路徑。 記憶體路徑是 Azure 資源,可用來提供路徑來儲存叢集上的 VM 組態檔、VM 映射和 VHD。 您可以使用 Azure CLI 建立記憶體路徑。

關於記憶體路徑

部署 Azure Stack HCI 叢集時,記憶體路徑會建立為部署的一部分。 預設選項會自動選取具有高可用性的記憶體路徑。 不過,您可能會決定使用特定的記憶體路徑。 在此情況下,請確定指定的儲存路徑有足夠的儲存空間。

Azure Stack HCI 叢集上的記憶體路徑應該指向叢集上所有伺服器都可以存取的叢集共用磁碟區。 為了具有高可用性,強烈建議您在叢集共用磁碟區下建立記憶體路徑。

叢集共用磁碟區中的可用空間會決定儲存路徑上可用的存放區大小。 例如,如果記憶體路徑為 C:\ClusterStorage\UserStorage_1\Volume01 ,且 Volume01 為 4 TB,則記憶體路徑的大小是可用空間, (在 上的 4 TB) 外 Volume01

必要條件

開始之前,請務必完成下列必要條件:

  1. 請確定您可以存取已部署和註冊的 Azure Stack HCI 叢集。 在部署期間,也會建立Arc資源網橋和自定義位置。

    移至 Azure 中的資源群組。 您可以看到為 Azure Stack HCI 叢集建立的自定義位置和 Azure Arc 資源網橋。 記下您稍後在此案例中使用的訂用帳戶、資源群組和自定義位置。

  2. 請確定叢集共用磁碟區存在於您的 Azure Stack HCI 叢集上,該叢集可從叢集中的所有伺服器存取。 您想要在叢集共用磁碟區上提供的記憶體路徑應該有足夠的空間來儲存 VM 映像。 根據預設,叢集共用磁碟區會在部署 Azure Stack HCI 叢集期間建立。

    您只能在叢集中提供的叢集共用磁碟區內建立記憶體路徑。 如需詳細資訊,請參閱 建立叢集共用磁碟區

在您的叢集上建立記憶體路徑

您可以使用 Azure CLI 或 Azure 入口網站 在叢集上建立記憶體路徑。

您可以使用 stack-hci-vm storagepath Cmdlet 來建立、顯示及列出 Azure Stack HCI 叢集上的記憶體路徑。

檢閱用來建立記憶體路徑的參數

當您建立記憶體路徑時 ,需要 下列參數:

參數 描述
name 您為 Azure Stack HCI 叢集建立的記憶體路徑名稱。 請務必提供遵循 Azure 資源規則的名稱。 您無法在建立記憶體路徑之後重新命名。
resource-group 您要在其中建立記憶體路徑的資源群組名稱。 為了方便管理,我們建議您使用與 Azure Stack HCI 叢集相同的資源群組。
訂用帳戶 部署 Azure Stack HCI 之訂用帳戶的名稱或標識碼。 這也可能是您用於 Azure Stack HCI 叢集上記憶體路徑的另一個訂用帳戶。
custom-location 您要在其中建立此記憶體路徑的 Azure Stack HCI 叢集相關聯之自定義位置的名稱或識別碼。
path 磁碟上要建立記憶體路徑的路徑。 選取的路徑應該有足夠的空間可用來儲存 VM 映像。

您也可以使用下列 選擇性 參數:

參數 描述
location 由所指定的 az locationsAzure 區域。

建立記憶體路徑

在 Azure Stack HCI 叢集的其中一部伺服器上遵循下列步驟來建立記憶體路徑:

登入並設定訂用帳戶

  1. 線上到 Azure Stack HCI 系統上的伺服器。

  2. 登入。 輸入:

    az login --use-device-code
    
  3. 設定您的訂用帳戶。

    az account set --subscription <Subscription ID>
    

設定參數

  1. 為映像設定訂用帳戶、資源群組、位置、OS 類型的參數。 < >將取代為適當的值。

    $storagepathname="<Storage path name>"
    $path="<Path on the disk to cluster shared volume>"
    $subscription="<Subscription ID>"
    $resource_group="<Resource group name>"
    $customLocName="<Custom location of your Azure Stack HCI cluster>"
    $customLocationID="/subscriptions/<Subscription ID>/resourceGroups/$reource_group/providers/Microsoft.ExtendedLocation/customLocations/$customLocName"
    $location="<Azure region where the cluster is deployed>"
    
  2. 在下列路徑建立記憶體路徑 test-storagepathC:\ClusterStorage\test-storagepath。 執行下列 Cmdlet:

    az stack-hci-vm storagepath create --resource-group $resource_group --custom-location $customLocationID --name $storagepathname --path $path
    

    如需此 Cmdlet 的詳細資訊,請參閱 az stack-hci-vm storagepath create

    以下是範例輸出:

    PS C:\windows\system32> $storagepathname="test-storagepath"
    PS C:\windows\system32> $path="C:\ClusterStorage\UserStorage_1\mypath"
    PS C:\windows\system32> $subscription="<Subscription ID>"
    PS C:\windows\system32> $resource_group="myhci-rg"
    PS C:\windows\system32> $customLocationID="/subscriptions/<Subscription ID>/resourceGroups/myhci-rg/providers/Microsoft.ExtendedLocation/customLocations/myhci-cl"
    
    PS C:\windows\system32> az stack-hci-vm storagepath create --name $storagepathname --resource-group $resource_group --custom-location $customLocationID --path $path
    Command group 'stack-hci-vm' is experimental and under development. Reference and support levels: https://aka.ms/CLI_refstatus
    {
      "extendedLocation": {
        "name": "/subscriptions/<Subscription ID>/resourceGroups/myhci-rg/providers/Microsoft.ExtendedLocation/customLocations/myhci-cl",
        "type": "CustomLocation"
      },
      "id": "/subscriptions/<Subscription ID>/resourceGroups/myhci-rg/providers/Microsoft.AzureStackHCI/storagecontainers/test-storagepath",
      "location": "eastus",
      "name": "test-storagepath",
      "properties": {
        "path": "C:\\ClusterStorage\\UserStorage_1\\mypath",
        "provisioningState": "Succeeded",
        "status": {
          "availableSizeMB": 36761,
          "containerSizeMB": 243097
        }
      },
      "resourceGroup": "myhci-rg",
      "systemData": {
        "createdAt": "2023-10-06T04:45:30.458242+00:00",
        "createdBy": "guspinto@contoso.com",
        "createdByType": "User",
        "lastModifiedAt": "2023-10-06T04:45:57.386895+00:00",
        "lastModifiedBy": "319f651f-7ddb-4fc6-9857-7aef9250bd05",
        "lastModifiedByType": "Application"
      },
      "tags": null,
      "type": "microsoft.azurestackhci/storagecontainers"
    }
    

一旦記憶體路徑建立完成,您就可以建立虛擬機映像。

刪除記憶體路徑

如果不需要記憶體路徑,您可以將其刪除。 若要刪除記憶體路徑,請先移除相關聯的工作負載,然後執行下列命令來刪除記憶體路徑:

az stack-hci-vm storagepath delete --resource-group "<resource group name>" --name "<storagepath name>" --yes

若要確認記憶體路徑已刪除,請執行下列命令:

az stack-hci-vm storagepath show --resource-group "<resource group name>" --name "<storagepath name>" 

您會收到記憶體路徑不存在的通知。

若要刪除磁碟區,請先移除相關聯的工作負載,然後移除記憶體路徑,然後刪除磁碟區。 如需詳細資訊,請參閱 刪除磁碟區

如果記憶體路徑的空間不足,則使用該記憶體路徑的 VM 布建將會失敗。 您可能需要展開與記憶體路徑相關聯的磁碟區。 如需詳細資訊,請參閱 展開磁碟區

下一步