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

使用Terraform创建Google Compute Disk时物理块大小不支持错误的修复方法

Fixing "requested physical block size 2048 is not supported by this disk" Error in Terraform GCP Compute Disk

The Problem

You're trying to create a Google Compute Disk with Terraform using this configuration:

resource "google_compute_disk" "default2" {
  name = "test-disk"
  type = "pd-balanced"
  zone = "us-central1-a"
  image = "centos-7-v20210609"
  physical_block_size_bytes = 20480
}

When running terraform apply, you hit this error:

requested physical block size 2048 is not supported by this disk

The Root Cause

Google Cloud enforces strict limits on allowed physical block sizes based on your disk type. For pd-balanced disks, the only supported physical block size is 4096 bytes (4KB). The 20480-byte (20KB) value you specified doesn't fall into the allowed range for this disk type.

The Fix

You have two simple, valid options to resolve this:

Option 1: Use the supported block size for pd-balanced

Update the physical_block_size_bytes value to 4096, the only valid size for pd-balanced disks:

resource "google_compute_disk" "default2" {
  name = "test-disk"
  type = "pd-balanced"
  zone = "us-central1-a"
  image = "centos-7-v20210609"
  physical_block_size_bytes = 4096 # Valid for pd-balanced disks
}

Option 2: Remove the block size parameter entirely

If you don’t have a specific need for a custom block size, just delete the physical_block_size_bytes line. GCP will automatically use the default supported size (4096 bytes) for pd-balanced disks:

resource "google_compute_disk" "default2" {
  name = "test-disk"
  type = "pd-balanced"
  zone = "us-central1-a"
  image = "centos-7-v20210609"
  # Default 4KB block size will be applied automatically
}

Quick Reference for All GCP Disk Types

To avoid similar issues later, here’s the supported physical block sizes for each disk type:

  • pd-standard / pd-balanced: Only 4096 bytes (4KB)
  • pd-ssd: 4096 bytes (4KB) or 1048576 bytes (1MB)
  • Local SSD: 512 bytes

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.29 20:52:32