Overview and What You Will Learn
A zonal Persistent Disk stores data in one zone and costs less, while a regional Persistent Disk synchronously replicates data across two zones in the same region and survives a single-zone failure. Pick regional only when the data cannot tolerate waiting for a zone to recover.
In this lab, you will:
- Create a zonal and a regional disk and compare their configuration
- Attach each to a VM
- Take a snapshot and see how it complements regional replication
Why This Matters in Production
A team runs a production database on a zonal disk because it was the default in the console, without asking whether a zone outage of an hour or more is acceptable to the business. A regional disk would have let a replacement VM in the second zone attach and carry on. Payment platforms like Razorpay and Stripe make this decision explicitly for every stateful tier, because the storage choice sets the recovery floor.
Core Principles
A Persistent Disk is Compute Engine's network block storage, comparable to an AWS EBS volume or an Azure Managed Disk. The replication scope decides what failure it survives.
zone a)] end subgraph Regional[Regional disk] R1[(Replica
zone a)] <-->|sync copy| R2[(Replica
zone b)] end Z1 --> ZR([Lower cost,
zone loss = outage]) R2 --> RR([Higher cost,
survives one zone loss]) classDef store fill:#326CE5,color:#FFFFFF classDef note fill:#DBEAFE,color:#1E293B class Z1,R1,R2 store class ZR,RR note
| Aspect | Zonal | Regional |
|---|---|---|
| Replication | Within one zone | Two zones, synchronous |
| Cost | Lower | Higher |
| Zone failure | Data unavailable until recovery | Attach to a VM in the other zone |
Detailed Step-by-Step Practical Lab
Use a sandbox project with billing enabled. Replace mumbai-prod-disk-lab with your own project ID.
- Set the project and enable Compute Engine:
gcloud config set project mumbai-prod-disk-labgcloud services enable compute.googleapis.com- Create a zonal disk:
gcloud compute disks create disk-zonal-app-data \ --zone=asia-south1-a \ --size=50GB \ --type=pd-ssd- Create a regional disk with two replica zones in the same region:
gcloud compute disks create disk-regional-app-data \ --region=asia-south1 \ --replica-zones=asia-south1-a,asia-south1-b \ --size=50GB \ --type=pd-ssd- Compare the two configurations:
gcloud compute disks describe disk-zonal-app-data \ --zone=asia-south1-a --format="value(type,zone)" gcloud compute disks describe disk-regional-app-data \ --region=asia-south1 --format="value(type,region,replicaZones)"The regional disk lists both replica zones, and the zonal disk lists one.
- Create a VM with the zonal disk attached:
gcloud compute instances create vm-zonal-test \ --zone=asia-south1-a \ --machine-type=e2-medium \ --image-family=debian-12 \ --image-project=debian-cloud \ --disk=name=disk-zonal-app-data,mode=rw- Create a VM with the regional disk attached. Regional disks need
scope=regionalin the disk flag:
gcloud compute instances create vm-regional-test \ --zone=asia-south1-a \ --machine-type=e2-medium \ --image-family=debian-12 \ --image-project=debian-cloud \ --disk=name=disk-regional-app-data,scope=regional,mode=rwRememberA regional disk can attach to a VM in either replica zone. If
asia-south1-afails, you can start a VM inasia-south1-band attach the same disk. For a disk still attached to an unreachable VM, GCP lets you force-attach it to the replacement.
- Take a snapshot of the regional disk. Snapshots protect against corruption and accidental deletion, which replication does not:
gcloud compute snapshots create snap-app-data-1 \ --source-disk=disk-regional-app-data \ --source-disk-region=asia-south1 \ --storage-location=asia-south1- Clean up. Delete the VMs first, because attached disks cannot be deleted:
gcloud compute snapshots delete snap-app-data-1 --quietgcloud compute instances delete vm-zonal-test vm-regional-test \ --zone=asia-south1-a --quietgcloud compute disks delete disk-zonal-app-data --zone=asia-south1-a --quietgcloud compute disks delete disk-regional-app-data --region=asia-south1 --quietProduction Best Practices & Common Pitfalls
Common MistakeUsing zonal disks for every workload out of habit. A stateless app server's boot disk is fine as zonal because the VM can be recreated anywhere, but a database holding data you cannot easily rebuild is a strong candidate for regional.
TipFor a stateful service that must survive a zone loss, combine a regional disk with a failover VM or instance group ready in the second replica zone, so recovery needs minimal manual work.
- Budget for the price difference. A regional disk costs noticeably more than a zonal disk of the same size and type, so compare that cost against the real cost of downtime for the workload.
- Keep snapshots on a schedule. Replication copies bad writes and deletions to both zones instantly, so only snapshots give you a point-in-time recovery.
- Check machine series support. Newer machine series use Hyperdisk, which has its own high-availability options, so confirm the disk type your chosen machine supports before you plan.
- Stay within one region. Regional disks replicate across zones, not across regions, so they do not cover a full regional outage.
Quick Reference & Troubleshooting Commands
| Command | Description |
|---|---|
gcloud compute disks create --zone=ZONE |
Create a zonal disk |
gcloud compute disks create --replica-zones=Z1,Z2 |
Create a regional disk |
gcloud compute disks describe |
View type, zone, and replica zones |
gcloud compute instances attach-disk --disk-scope=regional |
Attach a regional disk to an existing VM |
gcloud compute snapshots create |
Take a point-in-time backup of a disk |