
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create a new instance in the specified zone.
/ 40
Create a new persistent disk in the specified zone.
/ 30
Attaching and Mounting the persistent disk.
/ 30
Compute Engine lets you create and run virtual machines on Google infrastructure. You can create virtual machines running different operating systems, including multiple flavors of Linux (Debian, Ubuntu, Suse, Red Hat, CoreOS) and Windows Server!
Compute Engine provides persistent disks for use as the primary storage for your virtual machine instances. Like physical hard drives, persistent disks exist independently of the rest of your machine – if a virtual machine instance is deleted, the attached persistent disk continues to retain its data and can be attached to another instance.
In this hands-on lab, you'll learn how to create a persistent disk and attach it to a virtual machine.
vim
, emacs
or nano
will be helpfulRead these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details pane.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud
, in Google Cloud, refer to the gcloud CLI overview guide.
Learn more from the Regions & Zones documentation.
gcloud
on your own machine, the config settings are persisted across sessions. But in Cloud Shell, you need to set this for every new session or reconnection.
First, create a Compute Engine virtual machine instance that has only a boot disk.
gcloud
command to create a new virtual machine instance named gcelab
:Example Output:
The newly created virtual machine instance will have a default 10 GB persistent disk as the boot disk.
Click Check my progress to verify the objective.
mydisk
:Output:
Click Check my progress to verify the objective.
You can attach a disk to a running virtual machine. Attach the new disk (mydisk
) to the virtual machine instance you just created (gcelab
).
Output:
That's it!
The persistent disk is now available as a block device in the virtual machine instance. Let's take a look.
Output:
Output:
/dev/disk/by-id/.
:Output:
You found the file, the default name is:
scsi-0Google_PersistentDisk_persistent-disk-1.
device-name
parameter. For example, to specify a device name, when you attach the disk you would use the command:
gcloud compute instances attach-disk gcelab --disk mydisk --device-name <YOUR_DEVICE_NAME> --zone $ZONE
Once you find the block device, you can partition the disk, format it, and then mount it using the following Linux utilities:
mkfs:
creates a filesystemmount
: attaches to a filesystemext4
filesystem using the mkfs tool. This command deletes all data from the specified disk:Last lines of the output:
discard
option enabled:That's it!
By default the disk will not be remounted if your virtual machine restarts. To make sure the disk is remounted on restart, you need to add an entry into /etc/fstab
.
/etc/fstab
in nano to edit:/etc/fstab
content should look like this:
Click Check my progress to verify the objective.
Test your knowledge about Google cloud Platform by taking this quiz.
For migrating data from a persistent disk to another region, reorder the following steps in which they should be performed:
Compute Engine can also attach local SSDs. Local SSDs are physically attached to the server hosting the virtual machine instance to which they are mounted. This tight coupling offers superior performance, with very high input/output operations per second (IOPS) and very low latency compared to persistent disks.
Local SSD performance offers:
These performance gains require certain trade-offs in availability, durability, and flexibility. Because of these trade-offs, local SSD storage is not automatically replicated and all data can be lost in the event of a host error or a user configuration error that makes the disk unreachable. Users must take extra precautions to backup their data.
This lab does not cover local SSDs.
You've learned how to create, find, and attach persistent disks to a virtual machine instance and the key difference between persistent disks and local SSDs. You can use persistent disks to setup and configure your database servers.
gcloud
Documentation and tutorial video....helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated: January 15, 2024
Lab Last Tested: January 15, 2024
Copyright 2025 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one
In this hands-on lab, you will learn how to create a persistent disk and use it on a Google Compute Engine virtual machine. You will also learn about zones, regions, and different disk types. Watch the short preview Create a Persistent Disk, GCP Essentials.
Duration: 0m setup · 30m access · 30m completion
AWS Region: []
Levels: introductory
Permalink: https://www.cloudskillsboost.google/catalog_lab/559