VM storage is network block storage: the disk lives apart from the VM, so you can detach it, resize it and snapshot it.
flowchart LR VM["VM db-1"] --> PD["Persistent Disk data-1<br/>pd-balanced 200 GB"] PD -- "schedule daily 02:00" --> SN["Snapshots<br/>incremental, multi-regional"] SN --> NEW["New disk in another zone"] BOOT["Boot disk of web-1"] --> IMG["Custom image web-v3<br/>family web"] IMG --> TPL["Instance template"] %% step VM: db-1 keeps its data on a separate Persistent Disk, not on the boot disk. %% step PD: pd-balanced gives SSD-backed performance at a moderate price; performance grows with size. %% step SN: A snapshot schedule takes incremental snapshots and deletes old ones after the retention period. %% step NEW: Any snapshot can become a new disk in any zone or region, for restore or migration. %% step BOOT: A configured boot disk becomes a custom image, grouped in the image family web. %% step TPL: Instance templates reference the family, so new VMs start from the latest image.
Disk types
| Type | Backed by | Use |
|---|---|---|
pd-standard |
HDD | Cheap, sequential, backups |
pd-balanced |
SSD | Default for most VMs |
pd-ssd |
SSD | Databases needing more IOPS |
pd-extreme |
SSD | Very high IOPS (older option) |
| Hyperdisk (Balanced, Throughput, Extreme, ML) | Next-generation | Provision IOPS and throughput independently of size; required by newer machine series such as C4 and N4 |
| Local SSD | Physically attached | Fastest, but data is lost when the VM stops or is deleted |
- Zonal disks live in one zone; regional Persistent Disk / Hyperdisk Balanced HA replicate synchronously to a second zone.
- Disks can be resized up while attached; then grow the file system (
resize2fs,xfs_growfs). They cannot shrink. - All disks are encrypted at rest; use CMEK if required.
Snapshots
- Incremental: only changed blocks after the first one; deleting a snapshot never breaks the others.
- Stored multi-regionally by default (or in a chosen region).
- Snapshot schedules (resource policies) automate daily/weekly snapshots with retention.
- For consistent database snapshots, flush or freeze writes first (or use application-consistent snapshots on Windows/Linux guest agents).
- Archive snapshots cost less for long retention.
Images and machine images
| Use | |
|---|---|
| Custom image | One boot disk you configured; share across projects; group in an image family; deprecate old ones |
| Machine image | A whole VM: all disks, metadata, machine type; good for cloning or backup of a VM |
gcloud compute resource-policies create snapshot-schedule daily-2am --region=asia-southeast1 --daily-schedule --start-time=19:00 --max-retention-days=14
gcloud compute disks add-resource-policies data-1 --resource-policies=daily-2am --zone=asia-southeast1-a
gcloud compute images create web-v3 --source-disk=web-1 --source-disk-zone=asia-southeast1-a --family=web
(--start-time is UTC: 19:00 UTC is 02:00 in Vietnam.)
| Command | Meaning |
|---|---|
gcloud compute disks resize data-1 --size=400GB --zone=… |
Grow a disk |
gcloud compute disks snapshot data-1 --snapshot-names=data-1-manual --zone=… |
One-off snapshot |
gcloud compute images deprecate web-v2 --state=DEPRECATED --replacement=web-v3 |
Retire an old image |
Traps: Local SSD is not durable; resizing the disk does not resize the file system; creating an image from a running boot disk needs --force and may be inconsistent.