Skip to content

Instantly share code, notes, and snippets.

@nov05
Created May 11, 2026 06:51
Show Gist options
  • Select an option

  • Save nov05/3210338bf31c3dce2dd931933be4c9f2 to your computer and use it in GitHub Desktop.

Select an option

Save nov05/3210338bf31c3dce2dd931933be4c9f2 to your computer and use it in GitHub Desktop.

⚠️ The original script is outdated.

https://github.com/nov05/gcp-skills-boost/tree/dev/Creating%20a%20Persistent%20Disk

Welcome to Cloud Shell! Type "help" to get started, or type "gemini" to try prompting with Gemini CLI.
Your Cloud Platform project in this session is set to qwiklabs-gcp-03-df11d5f22b4b.
Use `gcloud config set project [PROJECT_ID]` to change to a different project.
student_04_da5e6ebc25be@cloudshell:~ (qwiklabs-gcp-03-df11d5f22b4b)$ curl -LO https://raw.githubusercontent.com/Itsabhishek7py/GoogleCloudSkillsboost/refs/heads/main/Creating%20a%20Persistent%20Disk/abhishek.sh
sudo chmod +x abhishek.sh
./abhishek.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3677  100  3677    0     0  10785      0 --:--:-- --:--:-- --:--:-- 10910

╔════════════════════════════════════════════════════════╗
                  Welcome to Dr abhishek Cloud Tutorials...                   
╚════════════════════════════════════════════════════════╝


 Enter ZONE: us-east4-c
 ========================== Setting the compute zone and region ========================== 

Updated property [compute/zone].
Updated property [compute/region].
 ========================== Creating a compute instance 'gcelab' ========================== 

Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-03-df11d5f22b4b/zones/us-east4-c/instances/gcelab].
NAME: gcelab
ZONE: us-east4-c
MACHINE_TYPE: e2-standard-2
PREEMPTIBLE: 
INTERNAL_IP: 10.150.0.2
EXTERNAL_IP: 34.85.142.34
STATUS: RUNNING
 ========================== Creating a disk 'mydisk' of 200GB ========================== 

Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-03-df11d5f22b4b/zones/us-east4-c/disks/mydisk].
NAME: mydisk
ZONE: us-east4-c
SIZE_GB: 200
TYPE: pd-standard
STATUS: READY

New disks are unformatted. You must format and mount a disk before it
can be used. You can find instructions on how to do this at:

For Linux: https://cloud.google.com/compute/docs/disks/format-mount-disk-linux
For Windows: https://cloud.google.com/compute/docs/disks/format-mount-disk-windows

 ========================== Attaching disk 'mydisk' to instance 'gcelab' ========================== 

Updated [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-03-df11d5f22b4b/zones/us-east4-c/instances/gcelab].
 ========================== Creating the 'prepare_disk.sh' script ========================== 

 ========================== Transfering script 'prepare_disk.sh' to 'gcelab' instance ========================== 

WARNING: The private SSH key file for gcloud does not exist.
WARNING: The public SSH key file for gcloud does not exist.
WARNING: You do not have an SSH key for gcloud.
WARNING: SSH keygen will be executed to generate a key.
Generating public/private rsa key pair.
Your identification has been saved in /home/student_04_da5e6ebc25be/.ssh/google_compute_engine
Your public key has been saved in /home/student_04_da5e6ebc25be/.ssh/google_compute_engine.pub
The key fingerprint is:
SHA256:x6wS+kRzwsgcqe8aVW6QoO93PozPvdev1UqFmaqljZM student_04_da5e6ebc25be@cs-433647997079-default
The key's randomart image is:
+---[RSA 3072]----+
|  .              |
| . . o           |
|.   = .          |
| . + B   o     + |
|  o = O S +   + .|
| . o + = o   . o |
|  o +o+ .  oo o .|
|   +.*oo  E*.o . |
|  ....=.oo+.ooo  |
+----[SHA256]-----+
ssh: connect to host 34.85.142.34 port 22: Connection refused
/usr/bin/scp: Connection closed
ERROR: (gcloud.compute.scp) [/usr/bin/scp] exited with return code [255].
 ========================== Executing the 'prepare_disk.sh' script on 'gcelab' ========================== 

ssh: connect to host 34.85.142.34 port 22: Connection refused

Recommendation: To check for possible causes of SSH connectivity issues and get
recommendations, rerun the ssh command with the --troubleshoot option.

gcloud compute ssh gcelab --project=qwiklabs-gcp-03-df11d5f22b4b --zone=us-east4-c --troubleshoot

Or, to investigate an IAP tunneling issue:

gcloud compute ssh gcelab --project=qwiklabs-gcp-03-df11d5f22b4b --zone=us-east4-c --troubleshoot --tunnel-through-iap

ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].

╔════════════════════════════════════════════════════════╗
              Lab Completed Successfully!               
╚════════════════════════════════════════════════════════╝

Subscribe to Dr. Abhishek Cloud Tutorials: https://www.youtube.com/@drabhishek.5460/videos
@nov05

nov05 commented May 11, 2026

Copy link
Copy Markdown
Author

✅ Created a new script nov05_GSP004.sh and it passed all the lab checks.

Welcome to Cloud Shell! Type "help" to get started, or type "gemini" to try prompting with Gemini CLI.
Your Cloud Platform project in this session is set to qwiklabs-gcp-01-6b2800287ffd.
Use `gcloud config set project [PROJECT_ID]` to change to a different project.
student_04_2597fc454701@cloudshell:~ (qwiklabs-gcp-01-6b2800287ffd)$ rm -f nov05_GSP004.sh
curl -LO https://raw.githubusercontent.com/nov05/gcp-skills-boost/refs/heads/dev/Creating%20a%20Persistent%20Disk/nov05_GSP004.sh
sudo chmod +x nov05_GSP004.sh
./nov05_GSP004.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2003  100  2003    0     0   7660      0 --:--:-- --:--:-- --:--:--  7645

Enter ZONE: us-east4-c
Updated property [compute/zone].
Updated property [compute/region].
Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-01-6b2800287ffd/zones/us-east4-c/instances/gcelab].
NAME: gcelab
ZONE: us-east4-c
MACHINE_TYPE: e2-standard-2
PREEMPTIBLE: 
INTERNAL_IP: 10.150.0.2
EXTERNAL_IP: 136.107.130.217
STATUS: RUNNING
🔹  VM gcelab Current status: RUNNING
Generating public/private rsa key pair.
Your identification has been saved in /home/student_04_2597fc454701/.ssh/google_compute_engine
Your public key has been saved in /home/student_04_2597fc454701/.ssh/google_compute_engine.pub
The key fingerprint is:
SHA256:DQHlocqnlptc/RqgRwwVSGw3pNjB7w8CrKXEZ+D/tSo student_04_2597fc454701@cs-583177819718-default
The key's randomart image is:
+---[RSA 3072]----+
|   +oo=++        |
| . o=+oo o       |
|o.o.+o..o        |
| +++ +.  o       |
|.++.o.= S .      |
|o  ..*o+         |
|    *.+o+        |
|   E * ..o       |
|    =.. ...      |
+----[SHA256]-----+
🔹  Waiting for VM gcelab SSH readiness...
ready
Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-01-6b2800287ffd/zones/us-east4-c/disks/mydisk].
NAME: mydisk
ZONE: us-east4-c
SIZE_GB: 200
TYPE: pd-standard
STATUS: READY

New disks are unformatted. You must format and mount a disk before it
can be used. You can find instructions on how to do this at:

For Linux: https://cloud.google.com/compute/docs/disks/format-mount-disk-linux
For Windows: https://cloud.google.com/compute/docs/disks/format-mount-disk-windows

Updated [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-01-6b2800287ffd/zones/us-east4-c/instances/gcelab].
prepare_disk.sh                                                                                                                                              100%  281     4.8KB/s   00:00    
total 0
lrwxrwxrwx 1 root root  9 May 11 07:05 google-persistent-disk-0 -> ../../sda
lrwxrwxrwx 1 root root 10 May 11 07:05 google-persistent-disk-0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 11 May 11 07:05 google-persistent-disk-0-part14 -> ../../sda14
lrwxrwxrwx 1 root root 11 May 11 07:05 google-persistent-disk-0-part15 -> ../../sda15
lrwxrwxrwx 1 root root  9 May 11 07:05 google-persistent-disk-1 -> ../../sdb
lrwxrwxrwx 1 root root  9 May 11 07:05 scsi-0Google_PersistentDisk_persistent-disk-0 -> ../../sda
lrwxrwxrwx 1 root root 10 May 11 07:05 scsi-0Google_PersistentDisk_persistent-disk-0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 11 May 11 07:05 scsi-0Google_PersistentDisk_persistent-disk-0-part14 -> ../../sda14
lrwxrwxrwx 1 root root 11 May 11 07:05 scsi-0Google_PersistentDisk_persistent-disk-0-part15 -> ../../sda15
lrwxrwxrwx 1 root root  9 May 11 07:05 scsi-0Google_PersistentDisk_persistent-disk-1 -> ../../sdb
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done                            
Creating filesystem with 52428800 4k blocks and 13107200 inodes
Filesystem UUID: df8a55b0-6495-440d-9afa-d7ada836521e
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment