建立 Compute Engine 執行個體時,您也必須為該執行個體建立開機磁碟。您可以使用公開映像檔、自訂映像檔,或從其他開機磁碟取得的快照。建立開機磁碟時,請將磁碟大小限制為 2 TiB,以符合 MBR 分區的限制。
當您建立執行個體時,Compute Engine 會自動建立開機磁碟。 如果您的執行個體需要其他資料儲存空間,請為執行個體新增一或多個次要執行個體儲存磁碟。
請按照本文所述程序建立開機磁碟,以便稍後建立 VM。如要提升開機磁碟效能,或為其他應用程式或作業系統檔案新增空間,可以調整 Google Cloud Hyperdisk 開機磁碟的大小。
建議您不要將地區磁碟用於開機磁碟。在容錯移轉的情況下,無法將這種磁碟強制附加至運算執行個體。
事前準備
- 使用 Google Cloud CLI 或 REST 從映像檔或磁碟建立虛擬機器 (VM) 時,每秒最多可建立 20 個 VM 執行個體。如要每秒建立更多 VM,請要求提高 映像檔資源的配額限制。
-
如果尚未設定驗證,請先完成設定。
「驗證」是指驗證身分的程序,確認您有權存取 Trusted Cloud by S3NS 服務和 API。如要從本機開發環境執行程式碼或範例,請選取下列任一選項,向 Compute Engine 進行驗證:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Trusted Cloud console to access Trusted Cloud by S3NS services and APIs, you don't need to set up authentication.
gcloud
-
安裝 Google Cloud CLI,然後 使用同盟身分登入 gcloud CLI。 登入後,執行下列指令初始化 Google Cloud CLI:
gcloud init
- Set a default region and zone.
REST
如要在本機開發環境中使用本頁的 REST API 範例,請使用您提供給 gcloud CLI 的憑證。
安裝 Google Cloud CLI,然後 使用同盟身分登入 gcloud CLI。 登入後,執行下列指令初始化 Google Cloud CLI:
gcloud init
詳情請參閱 Trusted Cloud 驗證說明文件中的「Authenticate for using REST」。
透過映像檔建立開機磁碟
除了建立執行個體以外,您還可以建立獨立開機磁碟,並在日後將它附加至執行個體。
主控台
前往 Trusted Cloud 控制台的「建立磁碟」頁面。
選取「Disk source type」(磁碟來源類型) 底下的「Image」(映像檔)。從清單中選擇圖片。
點選「建立」。
gcloud
如要建立獨立的開機磁碟,請使用
gcloud compute disks create
指令:gcloud compute disks create DISK_NAME --image IMAGE_NAME
REST
如要建立新的開機磁碟,請對
disks.insert
方法發出POST
要求:POST https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_NAME/zones/ZONE/disks?sourceImage=IMAGE
將
IMAGE
替換為來源圖片的完整 URI,並經過網址編碼,以套用至這個開機磁碟。要求主體必須包含這個新磁碟的名稱:
{ "name": "DISK_NAME" }
如果您建立的開機磁碟比映像檔大,可能需要重新分割開機磁碟。
透過快照建立開機磁碟
建立開機磁碟的快照後,您可以使用該快照建立新的開機磁碟。
您只能在首次建立磁碟時套用快照中的資料。您無法將快照套用至現有磁碟,也無法將快照套用至所屬專案與這個快照不同的磁碟。
主控台
前往 Trusted Cloud 控制台的「建立磁碟」頁面。
在「Disk source type」(磁碟來源類型) 下方,選取「Snapshot」(快照)。
從清單中選擇快照。
完成磁碟屬性的設定,然後按一下「建立」。
gcloud
如要套用磁碟快照中的資料,請執行下列指令:
gcloud compute disks create DISK_NAME --source-snapshot SNAPSHOT_NAME
REST
如要透過快照建立開機磁碟,請對
disks.insert
方法發出POST
要求:POST https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_NAME/zones/ZONE/disks
要求主體必須包含這個新磁碟的名稱,以及建立磁碟時要使用的快照網址:
{ "name": "DISK_NAME", "sourceSnapshot": "zones/ZONE/snapshots/SNAPSHOT_NAME" }
後續步驟
- 調整開機磁碟大小與調整非開機磁碟大小的程序相同。詳情請參閱「 變更 Hyperdisk 磁碟區的大小或佈建效能」中的操作說明。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-19 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-19 (世界標準時間)。"],[[["When creating a Compute Engine instance, a boot disk is required, which can be sourced from a public image, custom image, or a snapshot of another boot disk."],["Boot disks should be limited to 2 TiB in size due to MBR partitioning limitations, and additional storage can be added via secondary instance storage disks."],["Boot disks can be created independently of instance creation and attached later, and they can be created from an image or a snapshot of an existing disk."],["You can resize Persistent Disk or Google Cloud Hyperdisk boot disks to enhance performance or accommodate more applications and operating system files."],["When creating virtual machines from images or disks using Google Cloud CLI or REST there is a limit of 20 instances per second, and users can request a higher quota for the **Images** resource if needed."]]],[]] -