GCP Persistent Disks Explained: Types, Performance, Resizing, and When to Use Them
Persistent disks are the storage layer for Compute Engine VMs. They work like a hard drive, but the storage lives on Google’s network infrastructure rather than the physical machine running your VM. This page covers the four disk types, how performance and IOPS actually work, how to resize a disk without downtime, and when to use persistent disks instead of local SSD or Filestore.
Persistent disks in simple terms
When you create a Compute Engine VM, it needs somewhere to store the operating system, application files, and data. That storage is a persistent disk.
Unlike a physical hard drive that sits inside a server, a persistent disk is network-attached block storage. It connects to your VM over Google’s internal network and behaves like a local drive, but it is a separate managed resource. This matters for three reasons:
- The disk outlives the VM. Delete the VM and the disk (if it is a data disk) stays intact.
- You can detach a disk from one VM and attach it to another, making migrations and disk swaps straightforward.
- Disk performance and VM compute are independent resources you size separately.
Think of a persistent disk like an external USB drive you plug into a laptop. The laptop does the computing, the drive holds your files. If you swap laptops, you unplug the drive and plug it into the new one. The files never lived inside the laptop itself. Persistent disks work the same way: the VM computes, the disk stores, and the two can be separated or recombined independently.
Every VM has at least one persistent disk: the boot disk, which holds the operating system. You can attach additional data disks for application storage, database files, or anything else that needs to persist.
How persistent disks work in Compute Engine
The mental model is straightforward: the VM handles compute, and the persistent
disk handles storage. They are separate resources connected over Google’s
network fabric, but from inside the VM they look and behave like local block
devices (for example, /dev/sda for a boot disk,
/dev/sdb for an attached data disk).
A few things worth understanding upfront:
Attaching is not the same as mounting. When you attach a disk to a VM in GCP, the disk becomes visible as a block device inside the OS. You still need to format it and mount it before you can write files. GCP handles the attachment; the OS handles the filesystem.
Boot disk vs data disk. The boot disk contains the OS image and is attached automatically when the VM starts. Data disks are additional disks you attach for application data. Boot disks are deleted by default when you delete a VM; data disks are not.
Performance depends on both the disk and the VM. Each persistent disk type has a maximum IOPS and throughput ceiling, but there is also a per-VM cap. A small machine type with few vCPUs can limit disk performance even if the disk itself supports higher I/O. Size both resources together.
IOPS scales with disk size. For pd-standard and pd-balanced, IOPS and throughput limits increase as you provision larger disks, up to the per-VM cap. If your workload is I/O-constrained, provisioning a larger disk can increase throughput even if you do not need the extra storage space.
Attaching a disk in GCP is like connecting a new hard drive to a PC using a cable. Windows or Linux can now see that a drive exists, but you cannot open it in File Explorer yet. You still need to format it and assign it a drive letter (on Linux: create a filesystem and mount it to a directory). The attach step is just the cable. The mount step is what makes it usable.
Disk types and when to choose each
| Type | Storage | Best for | Avoid for |
|---|---|---|---|
pd-standard | HDD | Sequential batch reads, cold archives, infrequent access, backups | Databases, any random I/O workload, latency-sensitive applications |
pd-balanced | SSD | Most workloads: a sensible general-purpose default | Very high IOPS database workloads that need more than balanced can provide |
pd-ssd | SSD | Databases requiring lower latency and higher random I/O | Sequential workloads where pd-balanced is already sufficient and cheaper |
pd-extreme | SSD | Mission-critical OLTP with the highest I/O demand; provisioned IOPS independent of size | Cost-sensitive workloads: charged per provisioned IOPS regardless of usage |
| Hyperdisk | SSD | N2/C3 VMs needing IOPS and throughput tuned independently of disk size | Older VM families: compatibility with the machine type is required |
Not sure which type to pick? Start with pd-balanced.
It uses SSD-backed storage, handles both random and sequential workloads
well, and costs less than pd-ssd. Only move to pd-ssd or pd-extreme after
you have measured an I/O bottleneck or have a database with documented
high random I/O requirements. See
Machine Types Explained
for how the VM shape constrains disk performance.
The pd-standard type is often selected by mistake when cost is a concern. HDD is cheap per GB, but random read latency on HDD is measured in milliseconds rather than microseconds. For anything involving random I/O (which includes almost every database query) pd-standard becomes a bottleneck quickly. It is genuinely useful for cold storage, sequential log archiving, or large batch reads that scan data linearly.
When to use persistent disks
Persistent disks are the right choice when:
You need a VM boot disk. Every Compute Engine VM has one. This is the default unless you configure diskless or RAM-disk boot configurations.
Data must survive VM restarts or replacements. If a VM stops, is deleted, or is replaced by a managed instance group rolling update, the data on a persistent disk stays intact.
You run a database on a VM. Databases require durable, consistent storage. Use pd-balanced or pd-ssd depending on your IOPS requirements.
You need to take disk snapshots. Persistent disks support incremental snapshots for backup and disaster recovery. Local SSDs do not support snapshots.
You need to reuse or move data across VMs. A persistent disk can be detached from one VM and attached to another, or shared read-only across multiple VMs simultaneously.
You want to create a reusable VM image. Custom VM images are built from persistent disk data. You cannot create an image from a local SSD.
When persistent disks are not the best choice
Persistent disks are flexible but not the right tool for every situation:
Ultra-low-latency temporary storage: use local SSD instead. Local SSDs are physically attached to the host server. They offer significantly lower latency and higher IOPS than any persistent disk type. The trade-off is that all data is lost permanently when the VM is stopped or deleted. Use local SSDs for caches, scratch space, or shuffle storage where the application layer handles durability separately.
Shared writable storage across multiple VMs: use Filestore instead. A read-write persistent disk can only be attached to one VM at a time. If multiple VMs need to write to the same filesystem simultaneously, you need an NFS solution. Filestore provides a managed NFS file server that multiple VMs can mount concurrently with read-write access.
Object storage for files, media, or backups: use Cloud Storage instead. If you are storing files that do not need to be mounted as a filesystem (uploads, exports, backups, static assets) Cloud Storage is cheaper, more scalable, and does not require a running VM. Persistent disks are block storage, not object storage.
Persistent disk vs local SSD vs Filestore
Choosing between these three depends on what your application needs: durability, sharing, or raw speed.
| Persistent Disk | Local SSD | Filestore | |
|---|---|---|---|
| Storage type | Network-attached block | Physically-attached NVMe | Managed NFS |
| Data persistence | Survives VM stop/delete | Lost on VM stop or delete | Independent of any VM |
| Concurrent write access | One VM at a time (RW) | One VM only | Multiple VMs simultaneously |
| Latency | Sub-millisecond (SSD types) | Microseconds | Low to moderate (NFS overhead) |
| Snapshots | Yes, incremental | No | No (backups via separate process) |
| Common use cases | Boot disks, databases, app storage | Caches, shuffle storage, temp data | Shared config, CMS media, NFS workloads |
| Cost model | Per GB provisioned | Per GB (included with VM family) | Per GB provisioned; significantly more expensive than persistent disk |
For a deeper look at Filestore vs Cloud Storage (object storage), the Cloud Storage vs Filestore comparison covers the cost difference and the semantics of each in detail.
Creating and attaching disks
# Create a standalone persistent disk
gcloud compute disks create my-data-disk \
--zone=europe-west2-a \
--size=100GB \
--type=pd-ssd
# Attach the disk to a running VM
gcloud compute instances attach-disk my-app-server \
--disk=my-data-disk \
--zone=europe-west2-a \
--mode=rw
# List disks in a zone
gcloud compute disks list --filter="zone:europe-west2-a"After attaching, the disk appears as a block device inside the VM (for
example, /dev/sdb). Attaching it in GCP does not automatically
make it usable. You must format the disk and mount it inside the OS before
you can write files.
# Inside the VM: format and mount the new disk
sudo mkfs.ext4 -F /dev/sdb
sudo mkdir -p /mnt/data
sudo mount /dev/sdb /mnt/data
# Make the mount persistent across reboots
echo '/dev/sdb /mnt/data ext4 defaults 0 2' | sudo tee -a /etc/fstabUsing /dev/sdb directly in /etc/fstab can fail
if device ordering changes after a reboot. For production VMs, use the
stable device symlink under /dev/disk/by-id/ instead. Run
ls -l /dev/disk/by-id/ inside the VM to find the correct
identifier for your attached disk.
You can also create a disk directly when launching a VM. See Creating Your First VM for how boot disk and additional disk options work at VM creation time.
Resizing a disk online
Disk resizing is a two-step process: resize the disk in GCP, then extend the filesystem inside the VM. Both steps are required. Skipping the second step means the OS cannot see the new space.
# Step 1: Resize the disk in GCP (VM can remain running)
gcloud compute disks resize my-data-disk \
--zone=europe-west2-a \
--size=200GB
# Step 2a: Inside the VM — extend the filesystem (ext4)
sudo resize2fs /dev/sdb
# Step 2b: Inside the VM — extend the filesystem (XFS)
sudo xfs_growfs /mnt/dataDisk size can only increase. There is no way to shrink a persistent disk after provisioning. If you need a smaller disk, create a new one, copy the data across, and delete the old disk.
Resizing does not cause downtime. The VM continues running throughout. This is one of the practical advantages of network-attached storage over physically provisioned drives.
IOPS and throughput on pd-standard and pd-balanced scale with disk size. Increasing disk size for performance reasons (not storage) is a valid and common approach. Check the per-VM throughput cap in Machine Types Explained to understand the upper bound for your VM shape.
Detaching and deleting
# Detach a disk (unmount inside the OS first)
gcloud compute instances detach-disk my-app-server \
--disk=my-data-disk \
--zone=europe-west2-a
# Delete a disk permanently
gcloud compute disks delete my-data-disk --zone=europe-west2-aBy default, deleting a VM also deletes its boot disk. Additional data
disks are not deleted automatically unless you set —auto-delete
on them. Check disk auto-delete settings before deleting a VM. Take a
snapshot first if you
need to preserve the data. Deleted disks cannot be recovered.
Read-only shared disks
A persistent disk can be attached to multiple VMs simultaneously in read-only mode. This is useful for sharing reference data, static assets, or configuration files across a fleet of VMs without copying the data to each boot disk. It is a common pattern in managed instance groups where all instances need access to the same read-only dataset.
# Attach an existing disk to a second VM in read-only mode
gcloud compute instances attach-disk my-second-vm \
--disk=my-reference-data-disk \
--zone=europe-west2-a \
--mode=roA read-write disk (—mode=rw) can only be attached to one VM
at a time. For a disk that must be writable by multiple VMs simultaneously,
use Filestore (NFS) rather than a persistent disk.
Backing up disks with snapshots
Persistent disks support incremental snapshots. The first snapshot copies the full disk. Every subsequent snapshot stores only the blocks that changed. Snapshots are stored independently of the disk: you can delete the source disk and the snapshot stays intact.
Snapshots are the standard way to back up persistent disk data in GCP. You can restore a snapshot to a new disk in any zone and attach it to a VM. See Disk Snapshots for full coverage of snapshot creation, scheduling, and cross-region recovery.
If you want to turn a disk backup into a reusable boot template, you can create a custom VM image from a snapshot rather than from a live disk.
Common beginner mistakes
Using pd-standard for a database. HDD-backed storage has high latency for random reads. Databases are almost entirely random I/O. pd-standard will bottleneck any database that handles more than trivial query volumes. Use pd-balanced or pd-ssd.
Attaching a disk but forgetting to format and mount it. Attaching in GCP makes the disk visible as a block device inside the OS. It does not appear in the filesystem automatically. You still need to run
mkfs(on a new disk) andmountbefore you can write files.Not adding the mount to
/etc/fstab. A disk mounted manually at the command line will not remount after the VM restarts. Add the mount entry to/etc/fstabto make it survive reboots. Use a stable device identifier from/dev/disk/by-id/rather than/dev/sdbto avoid device ordering issues.Resizing the disk without extending the filesystem. After
gcloud compute disks resize, the block device is larger but the filesystem still sees the old boundary. Runresize2fs(ext4) orxfs_growfs(XFS) inside the VM to extend the filesystem into the new space.Deleting a VM without checking boot disk auto-delete behaviour. Boot disks are set to auto-delete by default when you create a VM via the Console. If you have data on the boot disk, check the auto-delete setting before deleting the VM, or take a snapshot first.
Using persistent disks where local SSD is the right tool. If you are running a caching layer, a temporary sort buffer, or a high-throughput scratch workload where the data is genuinely ephemeral, local SSD will outperform any persistent disk type. The durability of persistent disks is an overhead if you do not need it.
Summary
- Persistent disks are network-attached block storage: they behave like local drives but live independently of the VM
- Disk types: pd-standard (HDD, cold storage only), pd-balanced (SSD, sensible default), pd-ssd (higher IOPS), pd-extreme (provisioned IOPS for OLTP)
- IOPS and throughput scale with disk size on pd-standard and pd-balanced, up to the per-VM cap
- Attaching a disk in GCP makes it a block device; you must format and mount it inside the OS before writing files
- Disks can be resized online (increase only); extend the filesystem inside the VM after resizing or the new space remains invisible
- Boot disks are deleted when the VM is deleted by default; additional data disks are not unless auto-delete is set
- For temporary high-performance storage, use local SSD; for shared writable storage across multiple VMs, use Filestore
- Persistent disks support incremental snapshots for backups; local SSDs do not
Frequently asked questions
What is a persistent disk in GCP?
A persistent disk is network-attached block storage for Compute Engine VMs. It behaves like a hard drive attached to your VM, but the data lives on Google's storage infrastructure rather than the physical host machine. Data on a persistent disk survives VM restarts, reboots, and for non-boot data disks, even VM deletion. You can also detach a persistent disk from one VM and reattach it to another.
What is the difference between persistent disk and local SSD?
A persistent disk is network-attached and durable. Data survives VM stops, restarts, and deletions. Local SSDs are physically connected to the host server. They are significantly faster and have lower latency, but all data is permanently lost when the VM stops or is deleted. Use persistent disks for anything you cannot afford to lose. Use local SSDs only for temporary scratch space, caches, or high-performance buffers where durability is handled by the application layer.
Which persistent disk type should I use for a database?
Use pd-balanced at minimum, or pd-ssd if your database has high random I/O requirements. pd-standard uses HDD-backed storage with high latency on random reads. Databases generate almost exclusively random I/O, so pd-standard will be a consistent bottleneck. For high-demand OLTP workloads, consider pd-extreme or Hyperdisk Extreme, both of which offer provisioned IOPS independent of disk size.
Can I resize a persistent disk without stopping the VM?
Yes. You can increase disk size while the VM is running using gcloud compute disks resize or the Cloud Console. After the resize completes, you must extend the filesystem inside the OS: resize2fs for ext4, xfs_growfs for XFS. The new space is available at the block device level but the OS cannot use it until the filesystem is extended. Disk size can only be increased, never decreased.
Are persistent disks deleted when a VM is deleted?
It depends on the disk. The boot disk is deleted by default when you delete a VM. This is the auto-delete setting, which is enabled by default on boot disks. Additional data disks you attach are not deleted automatically unless you explicitly set --auto-delete on them. Always check the auto-delete settings before deleting a VM. Taking a snapshot first is a safe precaution if the data has any value.