A Cloud Engineer needs to replace a degraded secondary persistent disk attached to a production Compute Engine Virtual Machine (app-server-1) with a restored volume from a recent snapshot named app-data-snapshot-v2. The recovery process must follow Google Cloud recommended practices using gcloud CLI commands to minimize data corruption risk. What is the correct sequence of steps to replace and restore the persistent data disk?
- 1Unmount the degraded volume within the guest operating system and detach the disk from app-server-1 using gcloud compute instances detach-disk.
- 2Create a new persistent disk in the target zone using gcloud compute disks create with the --source-snapshot=app-data-snapshot-v2 parameter.
- 3Attach the newly provisioned persistent disk to app-server-1 using gcloud compute instances attach-disk.
- 4Mount the newly attached persistent disk volume to the designated directory path within the guest operating system filesystem.
Answer
The correct operational sequence begins by safely unmounting and detaching the degraded disk from the VM instance, creating a replacement persistent disk from the source snapshot via gcloud compute disks create, attaching the newly created disk to the VM instance via gcloud compute instances attach-disk, and finally mounting the restored volume inside the guest operating system.
To safely restore a data disk onto a Compute Engine VM instance, the operational lifecycle requires disconnecting the old volume first to preserve data integrity, instantiating a new persistent disk resource from the Cloud Storage snapshot, attaching the created disk to the instance via gcloud, and mounting the restored file system within the guest OS.
Step-by-Step Solution
Key Concept
Restoring Persistent Disks from Snapshots using gcloud CLI