Swiftorial Logo
Home
Swift Lessons
Matchups
CodeSnaps
Tutorials
Career
Resources

Google Persistent Disk

Overview

Google Persistent Disk is a durable and high-performance block storage service provided by Google Cloud Platform (GCP). It is designed to work seamlessly with Google Compute Engine instances, offering both standard and SSD storage options. Persistent disks can be attached to virtual machines (VMs) as boot or data disks, making them versatile for various applications.

Key Points

  • Persistent disks are independent of VM lifecycle, meaning they can be detached and reattached to different VMs.
  • Data is automatically replicated in a given region, providing high availability.
  • Supports snapshots for backups and disaster recovery.
  • Offers both standard HDD and SSD options based on performance requirements.

Step-by-Step Process

Creating a Persistent Disk

gcloud compute disks create DISK_NAME --size SIZE --zone ZONE --type TYPE

Replace DISK_NAME with your desired disk name, SIZE with the disk size (e.g., 100GB), ZONE with the desired zone (e.g., us-central1-a), and TYPE with either pd-standard for HDD or pd-ssd for SSD.

Attaching a Persistent Disk to a VM

gcloud compute instances attach-disk INSTANCE_NAME --disk DISK_NAME --zone ZONE

Replace INSTANCE_NAME with the name of your VM, DISK_NAME with the name of your persistent disk, and ZONE with the appropriate zone.

Remember to format the disk using the operating system's tools before use.

Best Practices

  • Regularly take snapshots of your persistent disks to ensure data safety.
  • Choose the appropriate disk type based on your workload requirements.
  • Monitor disk performance and adjust as necessary for optimal operation.
  • Use labels to organize and manage disks effectively.

Frequently Asked Questions

What is the maximum size of a persistent disk?

The maximum size for a persistent disk is currently 64 TB.

Can I use persistent disks across different regions?

No, persistent disks are region-specific and cannot be used across different regions.

How do I resize a persistent disk?

You can resize a persistent disk using the command: gcloud compute disks resize DISK_NAME --size NEW_SIZE --zone ZONE.