At Google Cloud, block storage in the form of disks emulating physical drives and attached to a compute layer is used by Google Kubernetes Engine (GKE) and Google Compute Engine (GCE). An operating system recognizes block storage as a volume that can be formatted so applications can use it.
Compute Engine instance has, by default, a single boot persistent disk where the operating system is running. However, you can add multiple local or persistent disks if you need additional storage space.
The step-by-step guide on configuring a Compute Engine VM, including persistent disks, was already presented in Chapter 4. Please look at Figure 4.38, which presents a table comparing available persistent disk types in Google Cloud: Balanced, Extreme, SSD, and Standard.
The following table summarizes the differences between available disks for Compute Engine VMs. Note that some disks can be replicated between zones. Also, a persistent disk can exist without a VM, whereas data on a local one will be discarded when a VM is stopped. Finally, you can expand a disk without powering off your VM.
Figure 8.21 – Summary of available block storage options for Compute Engine VMs
Check out the following page for a more detailed comparison and performance characteristics for the block storage options: https://cloud.google.com/compute/docs/disks.
Data on zonal and regional persistent disks can be protected with snapshots. Snapshots can be manual or scheduled, and you can store them in a selected region or a multi-regional location. Refer to the Creating instance snapshot section in Chapter 4 for more details on this topic.
Note that Google has also introduced a new type of block storage called Hyperdisk, which outperforms persistent disks. With Hyperdisk, each volume provides maximum IOPS and throughput, unlike in persistent disks where performance is shared across all attached volumes for a single virtual machine. Additionally, Hyperdisk volumes are independent of VMs, which means you can detach or move them to keep your data even after deleting your VMs. Furthermore, you can dynamically update the performance, resize existing Hyperdisk volumes, or add more volumes to a VM to meet your storage and performance needs, as Hyperdisk performance is not tied to size.
Although VMs can share disks among each other (for some disk types), the number of VMs that can be attached to a disk is limited, and such access is primarily suitable for applications and databases. However, if you are looking for shared storage for files that multiple applications or users can access, this will be covered in the next section.
File storage – Cloud Filestore
Cloud Filestore is a Google-managed, high-performance, network-attached storage for applications that require a (shared) filesystem interface to store files in a folder structure. Filestore’s most common use cases are storing website content, users’ home directories, images, or videos for editing, and storing data for batch jobs such as rendering.
Each created Filestore instance represents a single file share that can be mounted using the NFSv3 protocol (a networking protocol for distributed file sharing) to Compute Engine VMs, GKE, and even workstations on-premises, assuming they have network connectivity to such a Filestore instance.
To interact with Filestore, you can use the Google Cloud console, APIs, or gcloud commands. By default, Filestore automatically encrypts your data at rest. The access to a file share can be controlled based on the client’s IP address. The following table presents the available service tiers.
Figure 8.22 – Filestore service tiers and their characteristics
The Basic tier is for general-purpose use such as file sharing and web hosting, with the solid-state drive (SSD) tier providing better read and write throughput than the hard disk drive (HDD). The High Scale tier is designed for workloads with the highest capacity and performance demands, such as media rendering. The Enterprise tier has a regional redundancy to meet high availability requirements for mission-critical workloads. Note that the Basic HDD tier is the least expensive one. With High Scale and Enterprise, you can grow your instance and later shrink it. For the Basic tier, you can create a backup, and it will be a standalone copy of data. You can restore it to a source or another instance. The Enterprise tier offers snapshots that are a point-in-time view of a file share to which you can roll back your instance. They are stored on the instance and use its capacity.
In the next section, we will work on an example task to create a Filestore instance and mount its share to Compute Engine VMs.