Persistent Disk

Block storage solutions for virtual machines in Google Cloud Platform

Google Cloud Persistent Disk provides reliable, high-performance block storage for virtual machine instances running on Google Cloud Platform. It offers a range of storage options optimized for different workloads, from standard hard disk drives (HDD) to solid-state drives (SSD) and even extreme performance options.

Key Features

  • Durability: Built-in redundancy ensures data reliability

  • Automatic Encryption: All data is automatically encrypted at rest

  • Flexible Sizing: Easily scale from 10GB to 64TB per disk

  • Snapshot Support: Create point-in-time backups of your disks

  • Multiple Performance Tiers: Standard (HDD), Balanced (SSD), Performance (SSD), and Extreme (SSD)

  • Multi-writer Mode: Allows multiple VMs to read/write to a single disk simultaneously

  • Regional Persistence: Option for synchronous replication across zones

Disk Types

Type
Use Case
Performance
Price Point

Standard (pd-standard)

Batch processing, non-critical workloads

0.3-0.8 IOPS/GB

Lowest

Balanced (pd-balanced)

General purpose workloads

Up to 6,000 read IOPS, 9,000 write IOPS

Medium

SSD (pd-ssd)

I/O-intensive applications, databases

Up to 15,000 read IOPS, 15,000 write IOPS

High

Extreme (pd-extreme)

High-performance databases, analytics

Up to 120,000 read IOPS, 120,000 write IOPS

Highest

Hyperdisk Balanced

Consistent performance mid-tier workloads

Provisioned performance

Medium-high

Hyperdisk Extreme

Ultra-high performance workloads

Provisioned performance up to 350,000 IOPS

Premium

Creating and Managing Persistent Disks

Using gcloud CLI

Create a new Persistent Disk

Attach a disk to a VM

Format and mount a disk on Linux VM

Create a snapshot

Create a disk from a snapshot

Resize a disk

Using Terraform

Create a boot disk and data disk for a VM

Create a regional persistent disk with Terraform

Managing disk snapshots with Terraform

Performance Optimization

Best Practices for Disk Performance

  1. Choose the right disk type for your workload:

    • Standard PD: Batch jobs, cost-effective storage

    • Balanced PD: General purpose workloads

    • SSD PD: Database systems, I/O intensive applications

    • Extreme PD or Hyperdisk: High-performance databases, analytics

  2. Stripe multiple disks for higher performance:

  3. Enable write caching on your file system:

  4. Use appropriate file systems:

    • ext4: Good general-purpose file system with solid performance

    • XFS: Better for large files and high-performance workloads

  5. Tune I/O scheduler for your workload:

Backup Strategies

Snapshot-Based Backup

Database Backup Best Practices

For databases, consider:

  1. Consistent snapshots:

    • Freeze the filesystem or use database-specific tools to quiesce writes

    • For MySQL:

  2. Scheduled backups with custom scripts:

Disaster Recovery with Persistent Disk

Zone-to-Zone Recovery (using regional disks)

Cross-Region Recovery (using snapshots)

Multi-Writer Shared Disks

Persistent Disk supports multi-writer mode, allowing multiple VMs to concurrently access the same disk. This is useful for clustered applications like GFS, OCFS2, or other distributed file systems.

Using multi-writer disks with a cluster file system

Security and Compliance

Customer-Supplied Encryption Keys (CSEK)

Customer-Managed Encryption Keys (CMEK)

Cost Optimization

Rightsizing Persistent Disks

  1. Monitor utilization with Cloud Monitoring:

  2. Use custom metrics to track disk usage patterns:

  3. Create a disk sizing policy:

    • Start with smaller disks and increase as needed

    • Consider performance requirements (larger disks offer higher performance)

    • Use disk snapshots to preserve data when resizing

Disk Type Selection

For cost-effective disk usage:

  1. Use pd-standard for infrequently accessed data

  2. Use pd-balanced for good performance at a reasonable cost

  3. Use pd-ssd only for high-performance workloads

  4. Use snapshot lifecycle policies to automatically delete old snapshots

Monitoring and Troubleshooting

Set Up Monitoring

Common Troubleshooting Scenarios

Disk Performance Issues

Disk Full Issues

Disk Attachment Problems

Further Reading

Last updated