You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在GCP中从机器镜像创建不同启动盘大小的VM实例

从机器镜像创建VM时调整启动盘大小的解决方案

当通过机器镜像创建虚拟机实例时,直接使用--boot-disk-size参数无法覆盖镜像中启动盘的原有配置——因为机器镜像包含了完整的启动盘定义,必须通过--boot-disk参数显式指定新的磁盘大小来覆盖原有设置。

修正后的完整命令如下:

gcloud beta compute instances create test-vm \
--project=test-2511 \
--zone us-east1-b \
--network=demo-vpc \
--subnet=demo-subnet \
--machine-type=n2-standard-2 \
--boot-disk size=30GB \
--source-machine-image projects/test-2511/global/machineImages/demo \
--service-account 1266-compute@developer.gserviceaccount.com

如果需要同时调整启动盘的其他属性(比如磁盘类型),可以在--boot-disk后追加多个参数,示例:

--boot-disk size=30GB,type=pd-ssd

内容的提问来源于stack exchange,提问作者srikanth

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 15:35:22